void CBitmapHanFont::renderText(SDL_Surface * surface, const std::string & data, const SDL_Color & color, const Point & pos) const { int posX = pos.x; int posY = pos.y; SDL_LockSurface(surface); for(size_t i=0; i<data.size(); i += getCharacterSize(data[i])) { if (ui8(data[i]) < 0x80) renderCharacter(surface, getCharacterIndex(0xa3, data[i] + 0x80), color, posX, posY); else renderCharacter(surface, getCharacterIndex(data[i], data[i+1]), color, posX, posY); } SDL_UnlockSurface(surface); }
void ObjectRenderer::buildRenderList(GameObject* object, RenderList& outList) { // Right now specialized on each object type switch (object->type()) { case GameObject::Instance: renderInstance(static_cast<InstanceObject*>(object), outList); break; case GameObject::Character: renderCharacter(static_cast<CharacterObject*>(object), outList); break; ; case GameObject::Vehicle: renderVehicle(static_cast<VehicleObject*>(object), outList); break; ; case GameObject::Pickup: renderPickup(static_cast<PickupObject*>(object), outList); break; case GameObject::Projectile: renderProjectile(static_cast<ProjectileObject*>(object), outList); break; case GameObject::Cutscene: renderCutsceneObject(static_cast<CutsceneObject*>(object), outList); break; default: break; } }
void render() { clearScreen(); // clears the current screen and draw from scratch renderMap(); // renders the map to the buffer first renderCharacter(); // renders the character into the buffer renderFramerate(); // renders debug information, frame rate, elapsed time, etc renderToScreen(); // dump the contents of the buffer to the screen, one frame worth of game }
/*This is the render loop At this point, you should know exactly what to draw onto the screen, so just draw it! To get an idea of the values for colours, look at console.h and the URL listed there*/ void render() { //Clears the current screen and draw from scratch. clearScreen(); renderMap(); renderShooter(); renderCharacter(mummy.charDirection); renderBoxes(); renderMonsters(); renderMessages(); //Dump the contents of the buffer to the screen. One frame worth of the game. renderToScreen(); }
void renderGame() { renderMap(); // renders the character into the buffer renderCharacter(); // renders the character into the buffer renderMonster(); // renders Ghost renderGuards(); // renders guards projectile(); // projectile function bomb(); // bomb function Ultimate(); // ultimate skills function if (fight == BATTLE){ BossAttack(); if (elapsedTime > bossFightTime){ bossSpeed(); // Seeding bossFightTime = elapsedTime + 30; // map and boss pattern refreshes every 30 seconds for (int i = 0; i < MAP_HEIGHT; i++){ for (int j = 0; j < MAP_WIDTH; j++){ printMap[i][j] = BossMap[i][j]; } } } } }
void CBitmapFont::renderText(SDL_Surface * surface, const std::string & data, const SDL_Color & color, const Point & pos) const { if (data.empty()) return; assert(surface); int posX = pos.x; int posY = pos.y; // Should be used to detect incorrect text parsing. Disabled right now due to some old UI code (mostly pregame and battles) //assert(data[0] != '{'); //assert(data[data.size()-1] != '}'); SDL_LockSurface(surface); // for each symbol for(auto & elem : data) { renderCharacter(surface, chars[ui8(elem)], color, posX, posY); } SDL_UnlockSurface(surface); }
void renderGame() { renderMap(); // renders the map to the buffer first renderCharacter(); // renders the character into the buffer }