/* updateText - updates the text. Note that the text must already have been added to the text manager via the initText method. Also not that there should be a separate TextGenerator for each line of text we wish to render. */ void BalloonEscapeTextGenerator::updateText(Game *game) { // THE TEXT MANAGER (GameText) HAS A POINTER TO OUR TEXT, SO WE CAN // SIMPLY CLEAR IT OUT OF OLD CHARACTER DATA AND FILL IT IN WITH // WHAT WE WANT. textToGenerate.clear(); appendMouseCoords(game); }
/* initText - Provides an example of how to render text to our screen every frame, allowing for the text to continually change. This method adds a text object to the text manager (GameText), which allows it to be updated each frame. This method should be called only once for each object. */ void BalloonEscapeTextGenerator::initText(Game *game) { // FIRST UPDATE THE TEXT THIS GENERATOR IS USING appendMouseCoords(game); // AND THEN HAND IT TO THE TEXT MANAGER, SPECIFYING WHERE IT SHOULD BE RENDERED GameText *text = game->getText(); text->addText(&textToGenerate, W_TEXT_X, W_TEXT_Y, game->getGraphics()->getScreenWidth(), game->getGraphics()->getScreenHeight()); }
void OdysseyTextGenerator::updateText(Game *game) { textToGenerate.clear(); if (B_DEBUG) { appendMouseCoords(game); appendExtraData(game); } else//Append Player Hud Info { appendStats(game); appendObjectives(game); } }