void ChoiceText::render(Screen *screen) { GameData *gameData = GameData::getInstance(); float posy; posy = pos.y; int start, end; if(texts.size() > 2) { start = currentChoice - 1; end = currentChoice + 1; if(start < 0) { start++; end++; } if(end > (int)texts.size() - 1) { start--; end--; } } else if(texts.size() == 2) { start = 0; end = 1; } else { start = 0; end = 0; } for(std::vector<Text*>::iterator it = texts.begin() + start; it != texts.begin() + end + 1; ++it) { Text* text = *it; text->pos.y = posy; text->centerTextX(); text->render(screen); posy += 20; } Text *currentText = texts.at(mouseCurrentChoice); Rectangle rectSelection = Rectangle(currentText->pos.x - 3, currentText->pos.y - 3, currentText->rect.w + 6, currentText->rect.h + 6); Sprite::drawRoundRectNoScrolling(rectSelection, 255, 255, 255, selectorAlpha, 100, screen); if(texts.size() > 2) { Vector2 posSetaRef; posSetaRef.x = gameData->resWidth/2; if(currentChoice > 1) { posSetaRef.y = pos.y - 3; Sprite::drawTriangleNoScrolling(Vector2(posSetaRef.x - 2, posSetaRef.y), Vector2(posSetaRef.x + 2, posSetaRef.y), Vector2(posSetaRef.x, posSetaRef.y - 2), 255, 255, 255, selectorAlpha, screen); } if(currentChoice < (int)texts.size() - 2) { posSetaRef.y = pos.y + 63; Sprite::drawTriangleNoScrolling(Vector2(posSetaRef.x - 2, posSetaRef.y), Vector2(posSetaRef.x + 2, posSetaRef.y), Vector2(posSetaRef.x, posSetaRef.y + 2), 255, 255, 255, selectorAlpha, screen); } } }