本文整理汇总了C++中RenderManager类的典型用法代码示例。如果您正苦于以下问题:C++ RenderManager类的具体用法?C++ RenderManager怎么用?C++ RenderManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RenderManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cullObjects
void cullObjects(){
for (unsigned int i = 0; i < GameObjects.dead_objects.size(); i++) {
dynamic_cast<RenderComponent*>(GameObjects.dead_objects[i]->GetComponent(COMPONENT_RENDER))->objRef->setVisible(false);
}
for (unsigned int i = 0; i < GameObjects.dead_feathers.size(); i++) {
dynamic_cast<RenderComponent*>(GameObjects.dead_feathers[i]->GetComponent(COMPONENT_RENDER))->objRef->setVisible(false);
}
for (unsigned int i = 0; i < GameObjects.dead_minions.size(); i++) {
dynamic_cast<RenderComponent*>(GameObjects.dead_minions[i]->GetComponent(COMPONENT_RENDER))->objRef->setVisible(false);
}
//SCREEN WIDTH SCREEN HEIGHT, coordinates received from renMan seem to be offset so width and height are currently set larger than they should be.
RenderManager* renMan = RenderManager::getRenderManager();
int width = SCREEN_WIDTH + (SCREEN_WIDTH/2);
int height = SCREEN_HEIGHT * 2;
int left, right, top, bot;
left = right = top = bot = 0;
for (unsigned int i = 0; i < GameObjects.alive_objects.size(); i++) {
left = right = top = bot = 0;
SDLRenderObject* obj = dynamic_cast<RenderComponent*>(GameObjects.alive_objects[i]->GetComponent(COMPONENT_RENDER))->objRef;
renMan->worldCoordToWindowCoord(left, top, obj->posX, obj->posY, obj->posZ);
renMan->worldCoordToWindowCoord(right, bot, (obj->posX + obj->width), (obj->posY + obj->height), obj->posZ);
if ((right < -width / 2) || (left > width) || (top > height / 2) || (bot < -height / 2)){ //if object is out of screen bounds, dont draw.
obj->setVisible(false);
}
else{
obj->setVisible(true);
}
}
}
示例2: playDeathSFX
void PlayerLogicComponent::playDeathSFX(int playerClass, uint64_t deadPlayerID){
//Need to pass a reference to the GameObject* associated with player who was killed
GameObject* deadPlayer = GameObjects.GetGameObject(deadPlayerID);
PlayerRenderComponent* rendComp = dynamic_cast<PlayerRenderComponent*>(deadPlayer->GetComponent(COMPONENT_RENDER));
RenderManager* renderMan = RenderManager::getRenderManager();
if (renderMan->isObjOnScreen(rendComp->objRef)){
AudioManager* audioMan = AudioManager::getAudioInstance();
switch (playerClass){
case CLASS_CHICKEN:
audioMan->playByName("chickensfx.ogg");
break;
case CLASS_PEACOCK:
audioMan->playByName("peacocksfx.ogg");
break;
case CLASS_FLAMINGO:
audioMan->playByName("flamingosfx.ogg");
break;
case CLASS_QUAIL:
audioMan->playByName("quailsfx.ogg");
break;
case CLASS_TURKEY:
audioMan->playByName("turkeysfx.ogg");
break;
case CLASS_EAGLE:
//Unimplemented
//audioMan->playByName("eaglesfx.ogg");
break;
}
}
}
示例3: createButtons
void MainMenu::createButtons() {
int w, h;
float x, y;
RenderManager* renderMan = RenderManager::getRenderManager();
renderMan->getWindowSize(&w, &h);
// play button
renderMan->windowCoordToWorldCoord(x, y, (int)(w*(0.91f)), (int)(h*(0.75f)));
playButt = bFactory.Spawn(3521, x, y, 19, 55.0f, 75.0f, 0.3f);
ButtonRenderComponent* playRender = dynamic_cast<ButtonRenderComponent*>(playButt->GetComponent(COMPONENT_RENDER));
playRender->addSecondSprite(31);
GameObjects.AddObject(playButt);
// quit button
renderMan->windowCoordToWorldCoord(x, y, (int)(w*(0.91f)), (int)(h*(0.9f)));
quitButt = bFactory.Spawn(3522, x, y, 22, 55.0f, 75.0f, 0.3f);
ButtonRenderComponent* quitRender = dynamic_cast<ButtonRenderComponent*>(quitButt->GetComponent(COMPONENT_RENDER));
quitRender->addSecondSprite(32);
GameObjects.AddObject(quitButt);
//configure buttons to work with controller
ButtonLogicComponent* playLogic = dynamic_cast<ButtonLogicComponent*>(playButt->GetComponent(COMPONENT_LOGIC));
playLogic->setNavButtons(NULL, quitButt, NULL, NULL);
playLogic->selectButton();
ButtonLogicComponent* quitLogic = dynamic_cast<ButtonLogicComponent*>(quitButt->GetComponent(COMPONENT_LOGIC));
quitLogic->setNavButtons(playButt, NULL, NULL, NULL);
}
示例4:
PlayerRenderComponent::PlayerRenderComponent(GameObject* player, function_t func)
{
gameObjectRef = player;
gameObjectRef->AddComponent(COMPONENT_RENDER, this);
RenderComponent::RenderComponent();
SceneManager* sceneMan = SceneManager::GetSceneManager();
RenderManager* renderMan = RenderManager::getRenderManager();
std::string playerName = NetworkManager::sInstance->getLobbyMap().find(gameObjectRef->ID)->second;
SDLRenderObject * name = sceneMan->InstantiateBlankObject(sceneMan->findLayer("layer2"), 0, 0, 0, 0);
int r, g, b;
if (gameObjectRef->posY < 0){
r = 200, g=0, b = 200;
}
else r = 255, g = 255, b=0;
name->setResourceObject(renderMan->renderText(playerName.c_str(), r, g, b, 20, "BowlbyOneSC-Regular"));
//name->setParent(base);
name->setPos(0, -60);
allObjs["name"] = name;
if (allObjs["box"])allObjs["box"]->visible = true;
//pick random egg resource. currently hardcoded to 74
SDLRenderObject* egg = sceneMan->InstantiateObject(sceneMan->findLayer("layer2"), 74, 0, 0);
egg->visible = false;
egg->setParent(allObjs["base"]);
allObjs["egg"] = egg;
//assign animations
func(&objRef, allObjs, animations);
}
示例5: updateLobby
void Lobby::updateLobby(){
RenderManager* renderMan = RenderManager::getRenderManager();
GamerServices::sInstance->Update();
NetworkManager::sInstance->ProcessIncomingPackets();
if (playersInLobby)
playersInLobby->setResourceObject(renderMan->renderText(std::to_string(numPlayers).c_str(), 255, 0, 0, 50, "VT323-Regular"));
SceneManager::GetSceneManager()->AssembleScene();
}
示例6: playShieldCollisionSFX
void PowerShieldLogicComponent::playShieldCollisionSFX() {
//Need shield object
PowerShieldRenderComponent* rendComp = dynamic_cast<PowerShieldRenderComponent*>(gameObjectRef->GetComponent(COMPONENT_RENDER));
RenderManager* renderMan = RenderManager::getRenderManager();
if (renderMan->isObjOnScreen(rendComp->objRef)) {
AudioManager* audioMan = AudioManager::getAudioInstance();
audioMan->playByName("chickenshieldsfx.ogg");
}
}
示例7: main
void main(int argc, char* argv[])
{
glutInit(&argc, argv);
gRenderManager.StartUp();
glutMainLoop();
gRenderManager.ShutDown();
}
示例8: execute
bool ActionSetPartialScreen::execute(ZVision *engine) {
RenderManager *renderManager = engine->getRenderManager();
if (_backgroundColor > 0) {
renderManager->clearWorkingWindowTo555Color(_backgroundColor);
}
renderManager->renderImageToScreen(_fileName, _x, _y);
return true;
}
示例9: CreateGrid2
void CreateGrid2() {
int size = 10;
int size_l = (2 * size + 1) * 2;
int size_v = size_l * 2;
VERTEX3D *v = (VERTEX3D*)malloc(sizeof(VERTEX3D)*size_v);
LINE* l = (LINE*)malloc(sizeof(LINE)*(size_l));
int current_pos = -size;
for (int i = 0; i < size_l / 2; i++){
v[i * 2].x = -size;
v[i * 2].y = 0;
v[i * 2].z = current_pos;
v[i * 2 + 1].x = size;
v[i * 2 + 1].y = 0;
v[i * 2 + 1].z = current_pos;
l[i].i = i * 2;
l[i].j = i * 2 + 1;
current_pos++;
}
current_pos = -size;
for (int i = size_l / 2; i < size_l; i++){
v[i * 2].x = current_pos;
v[i * 2].y = 0;
v[i * 2].z = -size;
v[i * 2 + 1].x = current_pos;
v[i * 2 + 1].y = 0;
v[i * 2 + 1].z = size;
l[i].i = i * 2;
l[i].j = i * 2 + 1;
current_pos++;
}
Object3D *line = new Object3D(v, l, size_v, size_l);
RenderManager *rmg = RenderManager::getInstance();
rmg->RegisterObject(line);
free(v);
free(l);
}
示例10: createButtons
void Lobby::createButtons(){
RenderManager* renderMan = RenderManager::getRenderManager();
int w, h;
float x, y;
renderMan->getWindowSize(&w, &h);
// ready button
renderMan->windowCoordToWorldCoord(x, y, (int)(w*(7/8.0f)), (int)(h*(48/100.0f)));
readyButt = bFactory.Spawn(buttonID++, x, y, 25, 75.0f, 75.0f, 0.75f);
GameObjects.AddObject(readyButt);
// back button
}
示例11: GetTexture
Texture2D* TexturePool::GetTexture(const string& inTextureName)
{
// Find the texture in the pool
map<string, PooledTexture>::iterator it = pooledTextures.find(inTextureName);
if(it!= pooledTextures.end())
{
// If the texture requested exists in the pool, increment the ref count
// and return a reference to the pooled texture;
it->second.refCount++;
return it->second.texResource;
}
else
{
// Check if the texture exists
const string filepath = gFileManager.FindFile(inTextureName.c_str(), gEngineSettings.GetString("TexturesDirectoryPath", "Paths"));
if(filepath.length() > 0)
{
// Create a new pooled texture and return it
PooledTexture newTexture;
newTexture.texResource = gRenderAPI->CreateTexture2DFromFile(inTextureName.c_str());
pooledTextures[inTextureName] = newTexture;
return newTexture.texResource;
}
else
{
// Return the default texture
return gRenderManager.GetDefaultTexture();
}
}
}
示例12: getParticleLayer
void Particles::updateRender(RenderManager& theRenderManager)
{
for(auto it = getParticlesBegin(); it != getParticlesEnd(); it++)
{
mpe::Vec2 anPosition = it->getPosition();
mpe::TextRect anTexRect = it->getTextRect();
mpe::Color anColor = it->getColor();
sf::Transform anTransform;
Id anLayerID = getParticleLayer(*it);
anTransform.translate(anPosition.getX() * getXFactor(), anPosition.getY() * getYFactor());
anTransform.rotate(it->getAngle());
anTransform.scale(it->getSize(), it->getSize());
sf::Vector2f anPositions[4];
anPositions[0] = anTransform.transformPoint(sf::Vector2f(-(anTexRect.width / 2), -(anTexRect.height / 2)));
anPositions[1] = anTransform.transformPoint(sf::Vector2f( (anTexRect.width / 2), -(anTexRect.height / 2)));
anPositions[2] = anTransform.transformPoint(sf::Vector2f( (anTexRect.width / 2), (anTexRect.height / 2)));
anPositions[3] = anTransform.transformPoint(sf::Vector2f(-(anTexRect.width / 2), (anTexRect.height / 2)));
sf::Vector2f anTexCoords[4];
anTexCoords[0] = sf::Vector2f(anTexRect.x, anTexRect.y);
anTexCoords[1] = sf::Vector2f(anTexRect.x + anTexRect.width - 1, anTexRect.y);
anTexCoords[2] = sf::Vector2f(anTexRect.x + anTexRect.width - 1, anTexRect.y + anTexRect.height - 1);
anTexCoords[3] = sf::Vector2f(anTexRect.x, anTexRect.y + anTexRect.height - 1);
for (int i = 0; i < 4; i++)
{
theRenderManager.addVertex(anLayerID, sf::Vertex(anPositions[i], sf::Color(anColor.r, anColor.g, anColor.b, anColor.a) , anTexCoords[i]));
}
}
}
示例13: LoadHUD
void GameSession::LoadHUD(GameObject* player, SystemUIObjectQueue queue){
//initialize HUD info for the player. Should only be called once
SceneManager* sceneMan = SceneManager::GetSceneManager();
RenderManager* renderMan = RenderManager::getRenderManager();
//SystemUIObjectQueue queue;
UIObjectFactory HUDFactory;
renderMan->setBackground("Space-Muscle-Beach__0011_Sky.png");
std::vector<UIObject*> UIObjs;
//add the birdseed reference to player logic
UIObject* birdseedMeter = HUDFactory.Spawn(BIRDSEED_BAR, 30, 30);
UIObjs.push_back(birdseedMeter);
queue.AddObject(birdseedMeter);
UIObject* birdseedShell = HUDFactory.Spawn(BIRDSEED_SHELL, 30, 30);
UIObjs.push_back(birdseedShell);
queue.AddObject(birdseedShell);
PlayerLogicComponent* playerLogic = dynamic_cast<PlayerLogicComponent*>(player->GetComponent(COMPONENT_LOGIC));
PlayerUIComponent* playerUI = dynamic_cast<PlayerUIComponent*>(player->GetComponent(COMPONENT_UI));
playerUI->birdseedHUD = dynamic_cast<UIRenderComponent*>(birdseedMeter->GetComponent(COMPONENT_RENDER))->objRef;
playerUI->defaultRect = playerUI->birdseedHUD->renderRect;
//add a timer to top of screen
UIObject* countdownTimer = HUDFactory.Spawn(TIMER, SCREEN_WIDTH - 200, 30);
UIObjs.push_back(countdownTimer);
queue.AddObject(countdownTimer);
playerUI->timerHUD = dynamic_cast<UIRenderComponent*>(countdownTimer->GetComponent(COMPONENT_RENDER))->objRef;
PlayerRenderComponent* playerRender = dynamic_cast<PlayerRenderComponent*>(player->GetComponent(COMPONENT_RENDER));
//add ui components to show player kills
std::vector<std::pair<SDLRenderObject*, clock_t>> killHUD;
for (int i = 0; i < 5; i++){
UIObject* currKillHUD = HUDFactory.Spawn(KILL_NOTIFICATION,SCREEN_WIDTH-250,200+i*30);
SDLRenderObject* currKillObj = dynamic_cast<UIRenderComponent*>(currKillHUD->GetComponent(COMPONENT_RENDER))->objRef;
killHUD.push_back(std::pair<SDLRenderObject*, clock_t>(currKillObj, clock()));
UIObjs.push_back(currKillHUD);
}
playerUI->killHUD = killHUD;
playerUI->UIObjs = UIObjs;
}
示例14: createSlots
void LobbyMenu::createSlots(){
RenderManager* renderMan = RenderManager::getRenderManager();
GameObject* slot, *readySlot;
ButtonRenderComponent* br;
int w, h;
float topH, bottH, offset;
float x, y;
renderMan->getWindowSize(&w, &h);
// height for the slots on the top half
topH = h * (1 / 10.0f);
// height for the slots on the bottom half
bottH = h * (9 / 10.0f);
// finding the offset of the slots
offset = w * (1 / 6.0f);
for (int i = 0; i < 8; ++i){
if (i % 2){
h = (int)bottH;
}
else {
h = (int)topH;
offset += w * (1 / 8.0f);
}
renderMan->windowCoordToWorldCoord(x, y, (int)offset, h);
// ready slots
//readySlot = bFactory.Spawn(buttonID++, x, y, 28);
readySlot = bFactory.Spawn(buttonID++, x, y-14, 28, 0, 0, 0.3, -1);
br = dynamic_cast<ButtonRenderComponent*>(readySlot->GetComponent(COMPONENT_RENDER));
br->addSecondSprite(30);
readySlots.push_back(readySlot);
GameObjects.AddObject(readySlot);
// slots
//slot = bFactory.Spawn(buttonID++, x, y, 28);
slot = bFactory.Spawn(buttonID++, x, y-14, 28, 0, 0, 0.3, -1);
br = dynamic_cast<ButtonRenderComponent*>(slot->GetComponent(COMPONENT_RENDER));
br->changeLayer("layer2");
slots.push_back(slot);
GameObjects.AddObject(slot);
}
}
示例15: SceneManager
void GameManager::_init(GameEngine *engine) {
// save the game engine
mEngine = engine;
// create the log
mLog = mEngine->getLogManager()->createLog("GameManager.log");
mLog->logMessage("GAMEMANAGER: Initialising game manager");
// create the scene manager
mSceneMan = new SceneManager();
// Register listeners
// * Render events
RenderManager* renderMan = mEngine->getRenderManager();
renderMan->addWindowEventListener(this);
renderMan->addRenderListener(this);
// * Input events
InputManager* inputMan = mEngine->getInputManager();
inputMan->addMouseListener(this);
inputMan->addKeyListener(this);
inputMan->addJoystickListener(this);
}