/* 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 DummyTextGenerator::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(); appendTargetFPS(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 GroupGameTextGenerator::initText(Game *game) { // FIRST UPDATE THE TEXT THIS GENERATOR IS USING appendTargetFPS(game); // AND THEN HAND IT TO THE TEXT MANAGER, SPECIFYING WHERE IT SHOULD BE RENDERED GameText *text = game->getText(); //text->addText(&textToGenerate, GG_TARGET_FPS_X, GG_TARGET_FPS_Y, 300,1000);//game->getGraphics()->getScreenWidth(), game->getGraphics()->getScreenHeight()); }
/* 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 DummyTextGenerator::initText(Game *game) { // FIRST UPDATE THE TEXT THIS GENERATOR IS USING appendTargetFPS(game); // AND THEN HAND IT TO THE TEXT MANAGER, SPECIFYING WHERE IT SHOULD BE RENDERED GameText *text = game->getText(); text->addText(&textToGenerate, 350, 50, game->getGraphics()->getScreenWidth(), game->getGraphics()->getScreenHeight()); }
/* 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 WalkaboutTextGenerator::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(); appendTargetFPS(game); if(game->getGSM()->isGameInProgress()){ wstringstream wss; wss << L"Player HealtH: "; wss << game->getGSM()->getSpriteManager()->getPlayer()->getHitPoints(); //textToGenerate.append(wss.str()); } }