void GuiList::SetSelected(int child, bool selected) { Assert(child < GetNumChildren()); #ifdef LB_DEBUG GuiText* text = dynamic_cast<GuiText*>(GetChild(child)); if (text) { std::cout << "List box " << m_name << ": " << text->GetText() << (selected ? " selected" : " UNselected") << "\n"; } #endif if (selected && !IsMultiSel()) { // Not multi select, so at most one member in set. for (SelSet::iterator it = m_selset.begin(); it != m_selset.end(); ++it) { int i = *it; GetChild(i)->SetSelected(false); } m_selset.clear(); } GetChild(child)->SetSelected(selected); if (selected) { m_selset.insert(child); } else { m_selset.erase(child); } }
void TrailCircle::Draw() { static GuiImage* circleImg = 0; static GuiText text; if (!circleImg) { circleImg = new GuiImage; Texture* tex = (Texture*)TheResourceManager::Instance()->GetRes("circ1.png"); tex->SetFilter(AmjuGL::AMJU_TEXTURE_NICE); circleImg->SetTexture(tex); float aspect = (float)Screen::X() / (float)Screen::Y(); circleImg->SetSize(Vec2f(CIRCLE_SIZE, CIRCLE_SIZE * aspect)); text.SetSize(Vec2f(0.1f, 0.1f)); } const Colour BLACK(0, 0, 0, 1); const Colour WHITE(1, 1, 1, 1); const Colour RED(1, 0, 0, 1); circleImg->SetLocalPos(Vec2f(m_pos.x - CIRCLE_SIZE * 0.5f, m_pos.y + CIRCLE_SIZE * 0.5f)); PushColour(); MultColour(m_incorrect ? RED : (m_clicked ? BLACK : WHITE)); circleImg->Draw(); PopColour(); // Draw number/letter text.SetSize(Vec2f(0.2f, 0.1f)); text.SetJust(GuiText::AMJU_JUST_CENTRE); text.SetLocalPos(m_pos + Vec2f(-0.1f, 0.012f)); text.SetText(m_str); text.SetFgCol(m_clicked || m_incorrect ? WHITE : BLACK); text.Draw(); }
void BroadcastConsole::OnMsgRecv(const std::string& str) { // Discard if same as last msg if (!m_texts.empty()) { if (m_texts[0]->GetText() == str) { std::cout << "Discarding duplicate msg\n"; return; } } GuiText* text = new GuiText; text->SetIsMulti(true); text->SetTextSize(1.0f); // TODO CONFIG text->SetSize(Vec2f(2.0f, 0.1f)); // assume single line text->SetText(str); text->SizeToText(); text->SetFgCol(Colour(1, 1, 0, 1)); m_texts.push_front(text); static const unsigned int NUM_LINES = ROConfig()->GetInt("chat-max-lines", 10); if (m_texts.size() > NUM_LINES) { m_texts.pop_back(); } ReposText(); }
void GSGui::UpdateHeartCount() { if (m_gui) { GuiText* text = (GuiText*)GetElementByName(m_gui, "score-num"); if (text) { int h = 0; if (GetPlayerCount(SCORE_KEY, &h)) { text->SetText(ToString(h)); } else { text->SetText(""); } } } }
void GSYesNo::OnActive() { GSGui::OnActive(); m_gui = LoadGui("gui-yesno.txt"); Assert(m_gui); GuiButton* yes = (GuiButton*)GetElementByName(m_gui, "yes-button"); yes->SetCommand(Amju::OnYes); yes->SetHasFocus(true); yes->SetText(m_yesText); GuiButton* no = (GuiButton*)GetElementByName(m_gui, "no-button"); no->SetCommand(Amju::OnNo); no->SetIsCancelButton(true); no->SetText(m_noText); GuiText* q = (GuiText*)GetElementByName(m_gui, "question"); q->SetText(m_question); }
void GSFileUpdateCheck::OnDownloadedFile(const std::string& filename) { // If we are no longer the current state, it doesn't matter if (TheGame::Instance()->GetState() != this) { return; } m_numFilesDownloaded++; if (m_numFilesDownloaded >= m_numFilesToWaitFor) { // Done! Update to new timestamp OnFinishedChecking(m_newtimestamp); if (m_gui) { GuiText* t = (GuiText*)GetElementByName(m_gui, "filename"); t->SetText(filename); } } }
void Hud::UpdateScores() { // Names of gui elements in hud gui text file const char* GUI_NAME[2][2] = { { "p1-score-text", "p1-lives-text" }, { "p2-score-text", "p2-lives-text" } }; for (int i = 0; i < 2; i++) { PlayerNum pn = (PlayerNum)i; int score = TheScores::Instance()->GetScore(pn); GuiText* t = (GuiText*)m_gui->GetElementByName(GUI_NAME[i][0]); Assert(t); t->SetText(ToString(score)); int lives = TheScores::Instance()->GetLives(pn); t = (GuiText*)m_gui->GetElementByName(GUI_NAME[i][1]); Assert(t); t->SetText(ToString(lives)); } int hiScore = TheScores::Instance()->GetHiScore(); GuiText* t = (GuiText*)m_gui->GetElementByName("hi-score-text"); Assert(t); t->SetText(ToString(hiScore)); t = (GuiText*)m_gui->GetElementByName("hi-name-text"); Assert(t); t->SetText(TheScores::Instance()->GetHiScoreName()); }
void GSNetError::OnActive() { GSGui::OnActive(); m_gui = LoadGui("gui-error.txt"); Assert(m_gui); //// m_gui->GetElementByName("error-ok-button")->SetCommand(Amju::OnErrorOk); //// m_gui->GetElementByName("error-quit-button")->SetCommand(Amju::OnErrorQuit); GuiButton* ok = (GuiButton*)GetElementByName(m_gui, "error-ok-button"); ok->SetCommand(Amju::OnErrorOk); ok->SetHasFocus(true); GuiButton* quit = (GuiButton*)GetElementByName(m_gui, "error-quit-button"); quit->SetCommand(Amju::OnErrorQuit); quit->SetIsCancelButton(true); GuiText* t = dynamic_cast<GuiText*>(m_gui->GetElementByName("error")); Assert(t); t->SetText(m_errorStr); }
void IconEmuMiiBrowser::AddButton() { //!File Icon GuiImage * BtnImg = new GuiImage(fileMii); BtnImg->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); BtnImg->SetPosition(0, 10); ButtonImg.push_back(BtnImg); //!File Name GuiText * BtnTxt = new GuiText((char *) NULL, 14, (GXColor){0, 0, 0, 255}); BtnTxt->SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM); BtnTxt->SetPosition(0, -20); BtnTxt->SetLinesToDraw(2); BtnTxt->SetMaxWidth(75, WRAP); ButtonText.push_back(BtnTxt); //!selection img GuiImage * Marker = new GuiImage(bgSelectionEntry); Marker->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); Marker->SetPosition(0, -7); FileSelectionImg.push_back(Marker); //!tooltip GuiTooltip * tmpToolTip = new GuiTooltip((char *) NULL); tmpToolTip->SetPosition(0, 0); Tooltip.push_back(tmpToolTip); GuiButton * Btn = new GuiButton(90, 90); Btn->SetParent(this); Btn->SetLabel(BtnTxt); Btn->SetIcon(BtnImg); Btn->SetImageOver(Marker); Btn->SetTrigger(trigA); Btn->SetSoundClick(btnSoundClick); Btn->SetToolTip(tmpToolTip, 0, 0, ALIGN_CENTRE, ALIGN_TOP); Buttons.push_back(Btn); }
virtual void Draw() { // Don't draw name of local player ? if (IsVisible() && m_player->GetId() != GetLocalPlayerId()) { //Assert(m_player->GetAABB()); //DrawAABB(*(m_player->GetAABB())); // Print name // TODO Do all these in one go, to minimise state changes AmjuGL::PushAttrib(AmjuGL::AMJU_BLEND | AmjuGL::AMJU_DEPTH_READ); AmjuGL::Enable(AmjuGL::AMJU_BLEND); AmjuGL::Disable(AmjuGL::AMJU_DEPTH_READ); GuiText text; text.SetTextSize(5.0f); // TODO CONFIG text.SetText(m_player->GetName()); static const float MAX_NAME_WIDTH = 4.0f; // minimise this to reduce overdraw - calc from text text.SetSize(Vec2f(MAX_NAME_WIDTH, 1.0f)); text.SetJust(GuiText::AMJU_JUST_CENTRE); //text.SetInverse(true); //text.SetDrawBg(true); text.SetFgCol(Colour(1, 1, 1, 1)); AmjuGL::PushMatrix(); Matrix m; m.SetIdentity(); // Reverse modelview rotation Matrix r; r.ModelView(); m = TransposeRot(r); Vec3f tr(m_combined[12], m_combined[13], m_combined[14]); m.TranslateKeepRotation(tr); AmjuGL::MultMatrix(m); static const float SCALE_FACTOR = 20.0f; float x = MAX_NAME_WIDTH * SCALE_FACTOR * -0.5f; AmjuGL::Translate(x, 60.0f, 0); // TODO CONFIG AmjuGL::Scale(SCALE_FACTOR, SCALE_FACTOR, 10); text.Draw(); AmjuGL::PopMatrix(); AmjuGL::PopAttrib(); } }
void LurkMsg::Set(const std::string& str, const Colour& fgCol, const Colour& bgCol, LurkPos lp, CommandFunc onFinished) { GuiText* text = new GuiText; if (lp == AMJU_CENTRE) { text->SetIsMulti(true); } text->SetTextSize(1.5f); // TODO CONFIG text->SetSize(Vec2f(1.6f, 0.1f)); // assume single line text->SetText(str); text->SizeToText(); text->SetFgCol(fgCol); Set(text, fgCol, bgCol, lp, onFinished); }
void PolynomialEvolutionApp::update() { // Check if population has an update: if( mPopulation->hasUpdate() ) { // Remove previous generation from plotter: if( mBest ) { mPlotRef->removeInput( mBest ); } // Get update: mBest = mPopulation->getUpdate(); // Set drawing parameters: mBest->setDrawParameters( -10.0, 10.0, true, true, ColorA( 0, 1, 1, 1 ) ); // Add current generation to plotter: mPlotRef->addInput( mBest ); // Update info label: mInfoLabel->setText( mBest->getFormulaString() ); } // Update info label: //mInfoLabel->setText( "FPS: " + to_string( getAverageFps() ) + "\t\tRunning Time: " + to_string( getElapsedSeconds() ) + " seconds" ); }
void Hud::SetLevel(int level) { GuiText* t = (GuiText*)m_gui->GetElementByName("level-num"); Assert(t); t->SetText(ToString(level)); }
void GuiArrowOption::AddOption(const char * name, int PositionX, int PositionY) { int Center = PositionX; GuiText * OptName = new GuiText(name, 16, (GXColor) { 0, 0, 0, 255 }); OptName->SetAlignment(ALIGN_LEFT | ALIGN_TOP); OptName->SetPosition(Center-OptName->GetTextWidth()/2, PositionY); GuiText * OptText = new GuiText(" ", 16, (GXColor) { 0, 0, 0, 255 }); OptText->SetPosition(Center-OptText->GetTextWidth()/2, PositionY+30); OptText->SetAlignment(ALIGN_LEFT | ALIGN_TOP); GuiButton * OptBtn = new GuiButton(OptName->GetTextWidth(), 18); OptBtn->SetSoundOver(btnSoundOver); OptBtn->SetSoundClick(btnClick); OptBtn->SetTrigger(trigA); OptBtn->SetPosition(Center-OptText->GetTextWidth()/2, PositionY+30); OptBtn->SetAlignment(ALIGN_LEFT | ALIGN_TOP); OptBtn->Clicked.connect(this, &GuiArrowOption::OnButtonClick); GuiImage * OptImgLeft = new GuiImage(ArrowImgData); OptImgLeft->SetAngle(180); GuiButton * OptBtnLeft = new GuiButton(OptImgLeft->GetWidth(), OptImgLeft->GetHeight()); OptBtnLeft->SetImage(OptImgLeft); OptBtnLeft->SetSoundOver(btnSoundOver); OptBtnLeft->SetSoundClick(btnClick); OptBtnLeft->SetTrigger(trigA); OptBtnLeft->SetEffectGrow(); OptBtnLeft->SetPosition(Center-(OptText->GetTextWidth()/2+10), PositionY+30); OptBtnLeft->SetAlignment(ALIGN_LEFT | ALIGN_TOP); OptBtnLeft->Clicked.connect(this, &GuiArrowOption::OnLeftButtonClick); GuiImage * OptImgRight = new GuiImage(ArrowImgData); GuiButton * OptBtnRight = new GuiButton(OptImgRight->GetWidth(), OptImgRight->GetHeight()); OptBtnRight->SetImage(OptImgRight); OptBtnRight->SetSoundOver(btnSoundOver); OptBtnRight->SetSoundClick(btnClick); OptBtnRight->SetTrigger(trigA); OptBtnRight->SetEffectGrow(); OptBtnRight->SetPosition(Center+(OptText->GetTextWidth()/2+10), PositionY+30); OptBtnRight->SetAlignment(ALIGN_LEFT | ALIGN_TOP); OptBtnRight->Clicked.connect(this, &GuiArrowOption::OnRightButtonClick); Append(OptName); Append(OptText); Append(OptBtn); Append(OptBtnLeft); Append(OptBtnRight); OptionsName.push_back(OptName); OptionsText.push_back(OptText); OptionsBtn.push_back(OptBtn); OptionsImgLeft.push_back(OptImgLeft); OptionsBtnLeft.push_back(OptBtnLeft); OptionsImgRight.push_back(OptImgRight); OptionsBtnRight.push_back(OptBtnRight); }
void GSMain::Draw2d() { AmjuGL::Viewport(0, 0, Screen::X(), Screen::Y()); TheHud::Instance()->Draw(); // Store scaled modelview matrix float mat[16]; AmjuGL::GetMatrix(AmjuGL::AMJU_MODELVIEW_MATRIX, mat); // Split screen -- draw all screens int numVps = TheViewportManager::Instance()->GetNumViewports(); for (int i = 0; i < numVps; i++) { AmjuGL::SetMatrixMode(AmjuGL::AMJU_MODELVIEW_MATRIX); AmjuGL::SetIdentity(); // Restore scaled mv matrix AmjuGL::MultMatrix(mat); TheViewportManager::Instance()->GetViewport(i)->Draw2d(); } m_gui->Draw(); // split screen line etc TheLurker::Instance()->Draw(); #ifdef GEKKO TheCursorManager::Instance()->Draw(); #endif #ifdef SHOW_INFO // TODO Switch on/off if (true) { static GuiText t; t.SetFgCol(Colour(1, 1, 1, 1)); t.SetBgCol(Colour(0, 0, 0, 1)); t.SetDrawBg(true); t.SetFontSize(0.8f); // TODO CONFIG t.SetIsMulti(true); t.SetLocalPos(Vec2f(-1.0f, -0.8f)); t.SetSize(Vec2f(1.0f, 0.2f)); t.SetJust(GuiText::AMJU_JUST_LEFT); float playerX = Player::GetPlayer(AMJU_P1)->GetPos().x; static std::string old; std::string s = "Depth: " + ToString((int)GetCurrentDepth()) + " X: " + ToString((int)playerX) + "\nNum Game Objects: " + ToString((int)TheGame::Instance()->GetGameObjects()->size()); if (old != s) { t.SetText(s); } old = s; t.Draw(); } #endif // SHOW_INFO }
void GSTitle::Draw2d() { GSGui::Draw2d(); #ifdef SHOW_ENV_INFO // Draw env info, etc. static GuiText t; t.SetSize(Vec2f(1.0f, 0.1f)); t.SetJust(GuiText::AMJU_JUST_LEFT); t.SetDrawBg(true); t.SetLocalPos(Vec2f(-1.0f, 0.8f)); std::string s = "SaveDir: " + GetAppName(); t.SetText(s); t.Draw(); t.SetLocalPos(Vec2f(-1.0f, 0.7f)); s = "Server: " + GetServer(); t.SetText(s); t.Draw(); t.SetLocalPos(Vec2f(-1.0f, 0.6f)); s = "Env: " + GetEnv(); t.SetText(s); t.Draw(); #endif }
void GSTitle::OnActive() { static bool first = true; if (first) { first = false; TheAvatarManager::Instance()->Load(); // Set default keyboard layout KbSetLayout(KB_LAYOUT_REGULAR); TheGSOptions::Instance()->LoadFromConfig(); } // Kill off any dummy player object TheGame::Instance()->ClearGameObjects(); #ifdef SHOW_FRAME_TIME Font* font = (Font*)TheResourceManager::Instance()->GetRes("font2d/arial-font.font"); TheGame::Instance()->SetFrameTimeFont(font); #endif GSGui::OnActive(); if (!m_titleImage.OpenAndLoad("title-bgimage.txt")) { std::cout << "Failed to load GUI title bg image!\n"; Assert(0); } m_gui = LoadGui("gui-title.txt"); Assert(m_gui); GuiButton* start = (GuiButton*)GetElementByName(m_gui, "start-button"); start->SetCommand(Amju::OnStartButton); start->SetHasFocus(true); GuiButton* options = (GuiButton*)GetElementByName(m_gui, "options-button"); options->SetCommand(Amju::OnOptionsButton); GuiButton* quick = (GuiButton*)GetElementByName(m_gui, "quick-start-button"); static PlayerInfoManager* pim = ThePlayerInfoManager::Instance(); if (pim->GetNumPlayerNames() > 0) { quick->SetVisible(true); quick->SetCommand(Amju::OnQuickStartButton); quick->SetHasFocus(true); // Change button text to player name Strings names = pim->GetPlayerNames(); Assert(!names.empty()); pim->SetCurrentPlayer(names[0]); PlayerInfo* pi = pim->GetPI(); Assert(pi); std::string playername = pi->PIGetString(PI_KEY("playername")); quick->SetText(playername); } else { quick->SetVisible(false); } GuiButton* quit = (GuiButton*)GetElementByName(m_gui, "quit-button"); quit->SetCommand(Amju::OnQuitButton); quit->SetIsCancelButton(true); #ifdef SHOW_VERSION GuiText* ver = (GuiText*)GetElementByName(m_gui, "version"); std::string s = "v." + ToString(VersionMajor) + "." + ToString(VersionMinor); #ifdef _DEBUG s += " DEBUG"; #endif ver->SetText(s); #endif //CreateText("my game"); #ifdef PLAY_MUSIC TheSoundManager::Instance()->PlaySong(ROConfig()->GetValue("music-title", "Sound/hammers.it")); #endif }
KeyPadMenu::KeyPadMenu(int w, int h, const std::string & strTitle, const std::string & prefil) : GuiFrame(w, h) , buttonClickSound(Resources::GetSound("settings_click_2.mp3")) , backImageData(Resources::GetImageData("keyPadBackButton.png")) , backImage(backImageData) , backButton(backImage.getWidth(), backImage.getHeight()) , okImageData(Resources::GetImageData("keyPadOkButton.png")) , okImage(okImageData) , okButton(okImage.getWidth(), okImage.getHeight()) , okText("O.K.", 46, glm::vec4(0.8f, 0.8f, 0.8f, 1.0f)) , touchTrigger(GuiTrigger::CHANNEL_1, GuiTrigger::VPAD_TOUCH) , wpadTouchTrigger(GuiTrigger::CHANNEL_2 | GuiTrigger::CHANNEL_3 | GuiTrigger::CHANNEL_4 | GuiTrigger::CHANNEL_5, GuiTrigger::BUTTON_A) , buttonATrigger(GuiTrigger::CHANNEL_ALL, GuiTrigger::BUTTON_A, true) , buttonBTrigger(GuiTrigger::CHANNEL_ALL, GuiTrigger::BUTTON_B, true) , keyPadBgImageData(Resources::GetImageData("keyPadBg.png")) , keyPadButtonImgData(Resources::GetImageData("keyPadButton.png")) , keyPadButtonClickImgData(Resources::GetImageData("keyPadButtonClicked.png")) , deleteButtonImgData(Resources::GetImageData("keyPadDeleteButton.png")) , deleteButtonClickImgData(Resources::GetImageData("keyPadDeleteClicked.png")) , fieldImageData(Resources::GetImageData("keyPadField.png")) , fieldBlinkerImageData(Resources::GetImageData("keyPadFieldBlinker.png")) , bgImage(keyPadBgImageData) , fieldBlinkerImg(fieldBlinkerImageData) , deleteButtonImg(deleteButtonImgData) , deleteButtonImgClick(deleteButtonClickImgData) , deleteButton(deleteButtonImgData->getWidth(), deleteButtonImgData->getHeight()) , DPADButtons(w,h) { lastFrameCount = 0; currentText = prefil; if(currentText.size() > MAX_FIELDS) currentText.resize(MAX_FIELDS); textPosition = currentText.size(); bgImage.setAlignment(ALIGN_CENTER | ALIGN_BOTTOM); append(&bgImage); backButton.setImage(&backImage); backButton.setAlignment(ALIGN_BOTTOM | ALIGN_LEFT); backButton.clicked.connect(this, &KeyPadMenu::OnBackButtonClick); backButton.setTrigger(&touchTrigger); backButton.setTrigger(&wpadTouchTrigger); backButton.setSoundClick(buttonClickSound); backButton.setEffectGrow(); append(&backButton); okText.setPosition(0, -10); okButton.setLabel(&okText); okButton.setImage(&okImage); okButton.setAlignment(ALIGN_BOTTOM | ALIGN_RIGHT); okButton.clicked.connect(this, &KeyPadMenu::OnOkButtonClick); okButton.setTrigger(&touchTrigger); okButton.setTrigger(&wpadTouchTrigger); okButton.setSoundClick(buttonClickSound); okButton.setEffectGrow(); append(&okButton); titleText.setColor(glm::vec4(1.0f, 1.0f, 1.0f, 1.0f)); titleText.setFontSize(46); titleText.setPosition(0, 230); titleText.setBlurGlowColor(5.0f, glm::vec4(0.0, 0.0, 0.0f, 1.0f)); titleText.setText(strTitle.c_str()); append(&titleText); deleteButton.setImage(&deleteButtonImg); deleteButton.setImageOver(&deleteButtonImgClick); deleteButton.setTrigger(&touchTrigger); deleteButton.setTrigger(&wpadTouchTrigger); deleteButton.setSoundClick(buttonClickSound); deleteButton.setPosition(-(keyPadButtonImgData->getWidth() + 5) * (MAX_COLS - 1) * 0.5f + (keyPadButtonImgData->getWidth() + 5) * MAX_COLS, -60); deleteButton.setEffectGrow(); deleteButton.clicked.connect(this, &KeyPadMenu::OnDeleteButtonClick); append(&deleteButton); for(int i = 0; i < MAX_FIELDS; i++) { char fieldTxt[2]; fieldTxt[0] = (i < (int)currentText.size()) ? currentText[i] : 0; fieldTxt[1] = 0; GuiText *text = new GuiText(fieldTxt, 46, glm::vec4(0.0f, 0.0f, 0.0f, 1.0f)); GuiImage *image = new GuiImage(fieldImageData); GuiButton *button = new GuiButton(image->getWidth(), image->getHeight()); button->setImage(image); button->setLabel(text); button->setPosition(-(image->getWidth() + 8) * (MAX_FIELDS - 1) * 0.5f + (image->getWidth() + 8) * i, 120); button->setTrigger(&touchTrigger); button->setTrigger(&wpadTouchTrigger); button->setSoundClick(buttonClickSound); button->clicked.connect(this, &KeyPadMenu::OnTextPositionChange); append(button); textFieldText.push_back(text); textFieldImg.push_back(image); textFieldBtn.push_back(button); } fieldBlinkerImg.setAlignment(ALIGN_LEFT | ALIGN_LEFT); fieldBlinkerImg.setPosition(5, 0); if(textPosition < MAX_FIELDS) textFieldBtn[textPosition]->setIcon(&fieldBlinkerImg); int row = 0, column = 0; for(int i = 0; cpKeyPadButtons[i]; i++) { char buttonTxt[2]; buttonTxt[0] = cpKeyPadButtons[i]; buttonTxt[1] = 0; GuiImage *image = new GuiImage(keyPadButtonImgData); GuiImage *imageClick = new GuiImage(keyPadButtonClickImgData); GuiButton *button = new GuiButton(image->getWidth(), image->getHeight()); GuiText *text = new GuiText(buttonTxt, 46, glm::vec4(0.0f, 0.0f, 0.0f, 1.0f)); text->setTextBlur(5.0f); button->setImage(image); button->setImageOver(imageClick); button->setLabel(text); button->setPosition(-(image->getWidth() + 5) * (MAX_COLS - 1) * 0.5f + (image->getWidth() + 5) * column, -60 - (image->getHeight() + 5) * row); button->setTrigger(&touchTrigger); button->setTrigger(&wpadTouchTrigger); button->setSoundClick(buttonClickSound); button->setEffectGrow(); button->clicked.connect(this, &KeyPadMenu::OnKeyPadButtonClick); append(button); keyText.push_back(text); keyButton.push_back(button); keyImg.push_back(image); keyImgOver.push_back(imageClick); column++; if(column >= MAX_COLS) { column = 0; row++; } } DPADButtons.setTrigger(&buttonATrigger); DPADButtons.setTrigger(&buttonBTrigger); DPADButtons.clicked.connect(this, &KeyPadMenu::OnDPADClick); append(&DPADButtons); UpdateTextFields(); }
void Game::RunOneLoop() { #ifdef SHOW_FRAME_TIME static std::string fps; static int framesThisSec = 0; framesThisSec++; static int elapsed = 0; float e = TheTimer::Instance()->GetElapsedTime(); if ((int)e != elapsed) { elapsed = (int)e; fps = ToString(framesThisSec); framesThisSec = 0; } #ifdef WIN32 unsigned long start = GetTickCount(); #else // Get time taken to update/draw/flip, giving the 'real' FPS, not fixed to screen refresh rate timeval tbefore; gettimeofday(&tbefore, 0); #endif #endif // SHOW_FRAME_TIME Update(); #ifdef SHOW_FRAME_TIME #ifdef WIN32 unsigned long mid = GetTickCount(); #else // Get time taken to update/draw/flip, giving the 'real' FPS, not fixed to screen refresh rate timeval mid; gettimeofday(&mid, 0); #endif #endif // SHOW_FRAME_TIME Draw(); #ifdef SHOW_FRAME_TIME if (m_font) { #ifdef WIN32 unsigned long draw = GetTickCount() - mid; unsigned long update = mid - start; std::string s = "Draw: " + ToString((unsigned int)draw) + " update: " + ToString((unsigned int)update); #else timeval tafter; gettimeofday(&tafter, 0); double draw = tafter.tv_sec - mid.tv_sec + (tafter.tv_usec - mid.tv_usec) * 1e-6; double update = mid.tv_sec - tbefore.tv_sec + (mid.tv_usec - tbefore.tv_usec) * 1e-6; int idraw = (int)(draw * 1000.0f); int iupdate = (int)(update * 1000.0f); std::string s = std::string("Draw: ") + std::string((idraw < 10 ? "0" : "")) + ToString(idraw) + std::string("ms update: ") + std::string((iupdate < 10 ? "0" : "")) + ToString(iupdate) + "ms"; #endif s += " fps: " + fps; // Display time per frame static GuiText t; t.SetFont(m_font); t.SetScaleX(0.7f); t.SetFgCol(Colour(1, 1, 1, 1)); t.SetLocalPos(Vec2f(-1.0f, 1.0f)); t.SetSize(Vec2f(2.0f, 0.1f)); t.SetJust(GuiText::AMJU_JUST_LEFT); t.SetText(s); AmjuGL::PushAttrib(AmjuGL::AMJU_LIGHTING | AmjuGL::AMJU_TEXTURE_2D); AmjuGL::Disable(AmjuGL::AMJU_LIGHTING); AmjuGL::Enable(AmjuGL::AMJU_TEXTURE_2D); t.Draw(); AmjuGL::PopAttrib(); } #endif // SHOW_FRAME_TIME AmjuGL::Flip(); }
void PolynomialEvolutionApp::setup() { ci::randSeed( (unsigned int)time( NULL ) ); mSuitcase = new FontSuitcase(); mSuitcase->addFamily( "Heuristica", getAssetPath( "Heuristica-Regular.otf" ).string(), getAssetPath( "Heuristica-Italic.otf" ).string(), getAssetPath( "Heuristica-Bold.otf" ).string(), getAssetPath( "Heuristica-BoldItalic.otf" ).string() ); mScene = new GuiBase(); mScene->setPosition( Vec2f( 0.0, 0.0 ) ); mScene->setRelativeDimension( Vec2f( 1.0, 1.0 ) ); mInfoLabel = new GuiText( "", "Heuristica", 14, FontStyle::BOLD, mSuitcase ); mInfoLabel->setRelativePosition( Vec2f( 0.5, 0.97 ) ); mInfoLabel->setTextColor( ColorA::white() ); mInfoLabel->setHighlightColor( ColorA( 0.0, 0.0, 0.0, 0.5 ) ); mScene->addChild( mInfoLabel ); PolynomialDataRef tFormula( new PolynomialData( -10.0, 10.0, true, true, ColorA( 0, 1, 0, 1 ) ) ); tFormula->addComponent( 1.0, 2.0 ); PolynomialDataRef tAssertFormulaA( new PolynomialData( -10.0, 10.0, true, false, ColorA( 1, 1, 0, 1 ) ) ); tAssertFormulaA->addComponent( 2.0, 1.0 ); tAssertFormulaA->addComponent( 2.0, 0.0 ); PolynomialDataRef tAssertFormulaB( new PolynomialData( -10.0, 10.0, true, false, ColorA( 1, 1, 0, 1 ) ) ); tAssertFormulaB->addComponent( 2.0, 1.0 ); tAssertFormulaB->addComponent( -2.0, 0.0 ); AssertionGroup tAssertGroup = AssertionGroup(); AssertionRef tAssertA = AssertionRef( new Assertion() ); tAssertA->setDataRhs( tAssertFormulaA ); tAssertA->setParameterRange( -10.0, 10.0 ); tAssertA->setType( IS_LESS ); tAssertA->setMode( FOR_DERIVATIVE, FOR_FUNCTION ); tAssertGroup.add( tAssertA ); AssertionRef tAssertB = AssertionRef( new Assertion() ); tAssertB->setDataRhs( tAssertFormulaB ); tAssertB->setParameterRange( -10.0, 10.0 ); tAssertB->setType( IS_GREATER ); tAssertB->setMode( FOR_DERIVATIVE, FOR_FUNCTION ); tAssertGroup.add( tAssertB ); cout << tAssertGroup.getAssertionString( tFormula ) << endl; mPopulation = new PolynomialPopulation( tAssertGroup, 1000, 500, 0.1, 1.0 ); { mPlotRef = new GuiPlot( "Heuristica", mSuitcase ); mPlotRef->addInput( tFormula ); mPlotRef->addInput( tAssertFormulaA ); mPlotRef->addInput( tAssertFormulaB ); mPlotRef->setXRange( -10.0, 10.0 ); mPlotRef->setYRange( -10.0, 10.0 ); mPlotRef->setFillColor( ColorA( 1, 0, 0, 1 ) ); mPlotRef->setStrokeColor( ColorA( 1, 1, 0, 1 ) ); mPlotRef->setStrokeWeight( 1.0 ); mPlotRef->setRelativePosition( Vec2f( 0.5, 0.5 ) ); mPlotRef->setRelativeDimension( Vec2f( 0.9, 0.9 ) ); mScene->addChild( mPlotRef ); } }
SettingsMenu::SettingsMenu(int w, int h) : GuiFrame(w, h) , categorySelectionFrame(w, h) , particleBgImage(w, h, 50) , buttonClickSound(Resources::GetSound("settings_click_2.mp3")) , quitImageData(Resources::GetImageData("quitButton.png")) , categoryImageData(Resources::GetImageData("settingsCategoryButton.png")) , categoryBgImageData(Resources::GetImageData("settingsCategoryBg.png")) , quitImage(quitImageData) , quitButton(quitImage.getWidth(), quitImage.getHeight()) , touchTrigger(GuiTrigger::CHANNEL_1, GuiTrigger::VPAD_TOUCH) , wpadTouchTrigger(GuiTrigger::CHANNEL_2 | GuiTrigger::CHANNEL_3 | GuiTrigger::CHANNEL_4 | GuiTrigger::CHANNEL_5, GuiTrigger::BUTTON_A) , buttonATrigger(GuiTrigger::CHANNEL_ALL, GuiTrigger::BUTTON_A, true) , buttonBTrigger(GuiTrigger::CHANNEL_ALL, GuiTrigger::BUTTON_B, true) , buttonLTrigger(GuiTrigger::CHANNEL_ALL, GuiTrigger::BUTTON_L, true) , buttonRTrigger(GuiTrigger::CHANNEL_ALL, GuiTrigger::BUTTON_R, true) , buttonLeftTrigger(GuiTrigger::CHANNEL_ALL, GuiTrigger::BUTTON_LEFT | GuiTrigger::STICK_L_LEFT, true) , buttonRightTrigger(GuiTrigger::CHANNEL_ALL, GuiTrigger::BUTTON_RIGHT | GuiTrigger::STICK_L_RIGHT, true) , leftArrowImageData(Resources::GetImageData("leftArrow.png")) , rightArrowImageData(Resources::GetImageData("rightArrow.png")) , leftArrowImage(leftArrowImageData) , rightArrowImage(rightArrowImageData) , leftArrowButton(leftArrowImage.getWidth(), leftArrowImage.getHeight()) , rightArrowButton(rightArrowImage.getWidth(), rightArrowImage.getHeight()) , DPADButtons(w,h) { currentPosition = 0; targetPosition = 0; selectedCategory = 0; animationSpeed = 25; bUpdatePositions = true; quitButton.setImage(&quitImage); quitButton.setAlignment(ALIGN_BOTTOM | ALIGN_LEFT); quitButton.clicked.connect(this, &SettingsMenu::OnQuitButtonClick); quitButton.setTrigger(&touchTrigger); quitButton.setTrigger(&wpadTouchTrigger); quitButton.setEffectGrow(); quitButton.setSoundClick(buttonClickSound); categorySelectionFrame.append(&quitButton); versionText.setColor(glm::vec4(0.6f, 0.6f, 0.6f, 1.0f)); versionText.setFontSize(42); versionText.setAlignment(ALIGN_TOP | ALIGN_RIGHT); versionText.setPosition(-50, -80); versionText.setText("Loadiine GX2 " LOADIINE_VERSION); categorySelectionFrame.append(&versionText); const u32 cuCategoriesCount = sizeof(stSettingsCategories) / sizeof(stSettingsCategories[0]); if(cuCategoriesCount > 0) selectedCategory = 0; for(u32 idx = 0; idx < cuCategoriesCount; idx++) { settingsCategories.resize(idx + 1); GuiSettingsCategory & category = settingsCategories[idx]; std::vector<std::string> splitDescriptions = stringSplit(stSettingsCategories[idx].descriptions, "\n"); category.categoryIconData = Resources::GetImageData(stSettingsCategories[idx].icon); category.categoryIconGlowData = Resources::GetImageData(stSettingsCategories[idx].iconGlow); category.categoryLabel = new GuiText(tr(stSettingsCategories[idx].name), 46, glm::vec4(0.8f, 0.8f, 0.8f, 1.0f)); category.categoryLabel->setPosition(0, -120); category.categoryBgImage = new GuiImage(categoryBgImageData); category.categoryImages = new GuiImage(categoryImageData); category.categoryIcon = new GuiImage(category.categoryIconData); category.categoryIconGlow = new GuiImage(category.categoryIconGlowData); category.categoryButton = new GuiButton(category.categoryImages->getWidth(), category.categoryImages->getHeight()); category.categoryIcon->setPosition(0, 40); category.categoryIconGlow->setPosition(0, 40); category.categoryButton->setLabel(category.categoryLabel); category.categoryButton->setImage(category.categoryImages); category.categoryButton->setPosition(-300, 0); category.categoryButton->setIcon(category.categoryIcon); category.categoryButton->setIconOver(category.categoryIconGlow); category.categoryButton->setTrigger(&touchTrigger); category.categoryButton->setTrigger(&wpadTouchTrigger); category.categoryButton->setSoundClick(buttonClickSound); category.categoryButton->setEffectGrow(); category.categoryButton->clicked.connect(this, &SettingsMenu::OnCategoryClick); categorySelectionFrame.append(category.categoryBgImage); categorySelectionFrame.append(category.categoryButton); category.categoryButton->setParent(category.categoryBgImage); category.categoryBgImage->setPosition(currentPosition + (category.categoryBgImage->getWidth() + 40) * idx, 0); for(u32 n = 0; n < splitDescriptions.size(); n++) { GuiText * descr = new GuiText(tr(splitDescriptions[n].c_str()), 46, glm::vec4(0.8f, 0.8f, 0.8f, 1.0f)); descr->setAlignment(ALIGN_MIDDLE | ALIGN_LEFT); descr->setPosition(category.categoryBgImage->getWidth() * 0.5f - 50.0f, category.categoryBgImage->getHeight() * 0.5f - 100.0f - n * 60.0f); categorySelectionFrame.append(descr); descr->setParent(category.categoryBgImage); category.descriptions.push_back(descr); } GuiImage *smallIconOver = new GuiImage(category.categoryIconGlowData); GuiImage *smallIcon = new GuiImage(category.categoryIconData); GuiButton *smallIconButton = new GuiButton(smallIcon->getWidth() * smallIconScale, smallIcon->getHeight() * smallIconScale); smallIcon->setScale(smallIconScale); smallIconOver->setScale(smallIconScale); smallIconButton->setImage(smallIcon); smallIconButton->setEffectGrow(); smallIconButton->setTrigger(&touchTrigger); smallIconButton->setTrigger(&wpadTouchTrigger); smallIconButton->setSoundClick(buttonClickSound); smallIconButton->clicked.connect(this, &SettingsMenu::OnSmallIconClick); categorySelectionFrame.append(smallIconButton); categorySmallImages.push_back(smallIcon); categorySmallImagesOver.push_back(smallIconOver); categorySmallButtons.push_back(smallIconButton); } leftArrowButton.setImage(&leftArrowImage); leftArrowButton.setEffectGrow(); leftArrowButton.setPosition(40, 0); leftArrowButton.setAlignment(ALIGN_LEFT | ALIGN_MIDDLE); leftArrowButton.setTrigger(&touchTrigger); leftArrowButton.setTrigger(&wpadTouchTrigger); leftArrowButton.setSoundClick(buttonClickSound); leftArrowButton.clicked.connect(this, &SettingsMenu::OnCategoryLeftClick); categorySelectionFrame.append(&leftArrowButton); rightArrowButton.setImage(&rightArrowImage); rightArrowButton.setEffectGrow(); rightArrowButton.setPosition(-40, 0); rightArrowButton.setAlignment(ALIGN_RIGHT | ALIGN_MIDDLE); rightArrowButton.setTrigger(&touchTrigger); rightArrowButton.setTrigger(&wpadTouchTrigger); rightArrowButton.setSoundClick(buttonClickSound); rightArrowButton.clicked.connect(this, &SettingsMenu::OnCategoryRightClick); categorySelectionFrame.append(&rightArrowButton); DPADButtons.setTrigger(&buttonATrigger); DPADButtons.setTrigger(&buttonBTrigger); DPADButtons.setTrigger(&buttonLTrigger); DPADButtons.setTrigger(&buttonRTrigger); DPADButtons.setTrigger(&buttonLeftTrigger); DPADButtons.setTrigger(&buttonRightTrigger); DPADButtons.clicked.connect(this, &SettingsMenu::OnDPADClick); append(&DPADButtons); categorySelectionFrame.append(&DPADButtons); setTargetPosition(0); moving = false; //! the particle BG is always appended in all sub menus append(&particleBgImage); append(&categorySelectionFrame); }
CreditsMenu::CreditsMenu(int w, int h, const std::string & title) : GuiFrame(w, h) , creditsMusic(Resources::GetSound("credits_music.ogg")) , buttonClickSound(Resources::GetSound("settings_click_2.mp3")) , backImageData(Resources::GetImageData("backButton.png")) , backImage(backImageData) , backButton(backImage.getWidth(), backImage.getHeight()) , titleImageData(Resources::GetImageData("settingsTitle.png")) , titleImage(titleImageData) , touchTrigger(GuiTrigger::CHANNEL_1, GuiTrigger::VPAD_TOUCH) { Application::instance()->getBgMusic()->Pause(); creditsMusic->SetLoop(true); creditsMusic->Play(); creditsMusic->SetVolume(50); titleText.setColor(glm::vec4(1.0f, 1.0f, 1.0f, 1.0f)); titleText.setFontSize(46); titleText.setPosition(0, 10); titleText.setBlurGlowColor(5.0f, glm::vec4(0.0, 0.0, 0.0f, 1.0f)); titleText.setText(title.c_str()); append(&titleImage); append(&titleText); titleText.setParent(&titleImage); titleImage.setAlignment(ALIGN_CENTER | ALIGN_TOP); backButton.setImage(&backImage); backButton.setAlignment(ALIGN_BOTTOM | ALIGN_LEFT); backButton.clicked.connect(this, &CreditsMenu::OnBackButtonClick); backButton.setTrigger(&touchTrigger); backButton.setSoundClick(buttonClickSound); backButton.setEffectGrow(); append(&backButton); GuiText *text = NULL; f32 positionY = 230.0f; f32 positionX = 50.0f; f32 positionX2 = 350.0f; int fontSize = 40; glm::vec4 textColor = glm::vec4(1.0f); text = new GuiText("Loadiine GX2", 56, textColor); text->setPosition(0, positionY); text->setAlignment(ALIGN_CENTER | ALIGN_MIDDLE); creditsText.push_back(text); append(text); positionY -= 100; text = new GuiText("Official Site:", fontSize, textColor); text->setPosition(positionX, positionY); text->setAlignment(ALIGN_LEFT | ALIGN_MIDDLE); creditsText.push_back(text); append(text); text = new GuiText("https://gbatemp.net/threads/413823", fontSize, textColor); text->setPosition(positionX2, positionY); text->setAlignment(ALIGN_LEFT | ALIGN_MIDDLE); creditsText.push_back(text); append(text); positionY -= 50; text = new GuiText("Coding:", fontSize, textColor); text->setPosition(positionX, positionY); text->setAlignment(ALIGN_LEFT | ALIGN_MIDDLE); creditsText.push_back(text); append(text); text = new GuiText("Dimok", fontSize, textColor); text->setPosition(positionX2, positionY); text->setAlignment(ALIGN_LEFT | ALIGN_MIDDLE); creditsText.push_back(text); append(text); positionY -= 50; text = new GuiText("Design:", fontSize, textColor); text->setPosition(positionX, positionY); text->setAlignment(ALIGN_LEFT | ALIGN_MIDDLE); creditsText.push_back(text); append(text); text = new GuiText("Some guy who doesn't want to be named.", fontSize, textColor); text->setPosition(positionX2, positionY); text->setAlignment(ALIGN_LEFT | ALIGN_MIDDLE); creditsText.push_back(text); append(text); positionY -= 50; text = new GuiText("Testing:", fontSize, textColor); text->setPosition(positionX, positionY); text->setAlignment(ALIGN_LEFT | ALIGN_MIDDLE); creditsText.push_back(text); append(text); text = new GuiText("Cyan / Maschell / n1ghty / OnionKnight and many more", fontSize, textColor); text->setPosition(positionX2, positionY); text->setAlignment(ALIGN_LEFT | ALIGN_MIDDLE); creditsText.push_back(text); append(text); positionY -= 50; text = new GuiText("Social Presence:", fontSize, textColor); text->setPosition(positionX, positionY); text->setAlignment(ALIGN_LEFT | ALIGN_MIDDLE); creditsText.push_back(text); append(text); text = new GuiText("Cyan", fontSize, textColor); text->setPosition(positionX2, positionY); text->setAlignment(ALIGN_LEFT | ALIGN_MIDDLE); creditsText.push_back(text); append(text); positionY -= 50; text = new GuiText("Based on:", fontSize, textColor); text->setPosition(positionX, positionY); text->setAlignment(ALIGN_LEFT | ALIGN_MIDDLE); creditsText.push_back(text); append(text); text = new GuiText("Loadiine v4.0 by Golden45 and Dimok", fontSize, textColor); text->setPosition(positionX2, positionY); text->setAlignment(ALIGN_LEFT | ALIGN_MIDDLE); creditsText.push_back(text); append(text); positionY -= 50; text = new GuiText("Big thanks to:", fontSize, textColor); text->setPosition(positionX, positionY); text->setAlignment(ALIGN_LEFT | ALIGN_MIDDLE); creditsText.push_back(text); append(text); text = new GuiText("lustar for GameTDB and hosting covers / disc images", fontSize, textColor); text->setPosition(positionX2, positionY); text->setAlignment(ALIGN_LEFT | ALIGN_MIDDLE); creditsText.push_back(text); append(text); positionY -= 50; text = new GuiText("Marionumber1 for his kernel exploit", fontSize, textColor); text->setPosition(positionX2, positionY); text->setAlignment(ALIGN_LEFT | ALIGN_MIDDLE); creditsText.push_back(text); append(text); positionY -= 50; text = new GuiText("The whole libwiiu team and it's contributors.", fontSize, textColor); text->setPosition(positionX2, positionY); text->setAlignment(ALIGN_LEFT | ALIGN_MIDDLE); creditsText.push_back(text); append(text); positionY -= 50; }
/**************************************************************************** * gameinfo ***************************************************************************/ static int InternalShowGameInfo(struct discHdr *header) { mainWindow->SetState(STATE_DISABLED); char ID[7]; strlcpy(ID, (char *) header->id, sizeof(ID)); char xmlpath[300]; snprintf(xmlpath, sizeof(xmlpath), "%swiitdb.xml", Settings.titlestxt_path); GameTDB XML_DB; if(!XML_DB.OpenFile(xmlpath)) { ShowError(tr("Could not open wiitdb.xml.")); return -1; } XML_DB.SetLanguageCode(Settings.db_language); GameXMLInfo GameInfo; if(!XML_DB.GetGameXMLInfo(ID, &GameInfo)) { ShowError(tr("Could not find info for this game in the wiitdb.xml.")); return -1; } XML_DB.CloseFile(); int choice = -1; int titley = 10; int marginY = titley + 40; int indexy = marginY; int wifiY = 0; int intputX = 200, inputY = -30, txtXOffset = 90; u8 nunchuk = 0, classiccontroller = 0, balanceboard = 0, dancepad = 0, guitar = 0, gamecube = 0, wheel = 0, motionplus = 0, drums = 0, microphone = 0, zapper = 0, nintendods = 0, //vitalitysensor=0, wiispeak = 0; int newline = 1; u8 page = 1; BoxCover * boxCov = NULL; GuiImageData * playersImgData = NULL; GuiImage * playersImg = NULL; GuiImageData * wifiplayersImgData = NULL; GuiImage * wifiplayersImg = NULL; GuiImage * ratingImg = NULL; GuiImage * classiccontrollerImg = NULL; GuiImage * nunchukImg = NULL; GuiImage * guitarImg = NULL; GuiImage * drumsImg = NULL; GuiImage * dancepadImg = NULL; GuiImage * motionplusImg = NULL; GuiImage * wheelImg = NULL; GuiImage * balanceboardImg = NULL; GuiImage * microphoneImg = NULL; GuiImage * zapperImg = NULL; GuiImage * nintendodsImg = NULL; GuiImage * wiispeakImg = NULL; //GuiImage * vitalitysensorImg = NULL; GuiImage * gcImg = NULL; GuiImage * dialogBoxImg1 = NULL; GuiImage * dialogBoxImg2 = NULL; GuiImage * dialogBoxImg3 = NULL; GuiImage * dialogBoxImg4 = NULL; GuiImage * dialogBoxImg11 = NULL; GuiImage * dialogBoxImg22 = NULL; GuiImage * dialogBoxImg33 = NULL; GuiImage * dialogBoxImg44 = NULL; GuiImage * coverImg = NULL; GuiImageData * classiccontrollerImgData = NULL; GuiImageData * nunchukImgData = NULL; GuiImageData * guitarImgData = NULL; GuiImageData * drumsImgData = NULL; GuiImageData * motionplusImgData = NULL; GuiImageData * wheelImgData = NULL; GuiImageData * balanceboardImgData = NULL; GuiImageData * dancepadImgData = NULL; GuiImageData * microphoneImgData = NULL; GuiImageData * zapperImgData = NULL; GuiImageData * nintendodsImgData = NULL; GuiImageData * wiispeakImgData = NULL; //GuiImageData * vitalitysensorImgData = NULL; GuiImageData * gamecubeImgData = NULL; GuiImageData * ratingImgData = NULL; GuiImageData * cover = NULL; GuiText * releasedTxt = NULL; GuiText * publisherTxt = NULL; GuiText * developerTxt = NULL; GuiText * titleTxt = NULL; Text * synopsisTxt = NULL; GuiText * genreTitleTxt = NULL; GuiText ** genreTxt = NULL; GuiText ** wifiTxt = NULL; GuiText * gametdb1Txt = NULL; GuiText * memTxt = NULL; GuiWindow gameinfoWindow(600, 308); gameinfoWindow.SetAlignment(ALIGN_CENTER, ALIGN_MIDDLE); gameinfoWindow.SetPosition(0, -50); GuiWindow InfoWindow(600, 308); InfoWindow.SetAlignment(ALIGN_LEFT, ALIGN_TOP); GuiWindow txtWindow(350, 270); txtWindow.SetAlignment(ALIGN_CENTER, ALIGN_TOP); txtWindow.SetPosition(95, 40); GuiImageData dialogBox1(Resources::GetFile("gameinfo1.png"), Resources::GetFileSize("gameinfo1.png")); GuiImageData dialogBox2(Resources::GetFile("gameinfo1a.png"), Resources::GetFileSize("gameinfo1a.png")); GuiImageData dialogBox3(Resources::GetFile("gameinfo2.png"), Resources::GetFileSize("gameinfo2.png")); GuiImageData dialogBox4(Resources::GetFile("gameinfo2a.png"), Resources::GetFileSize("gameinfo2a.png")); GuiTrigger trig1; trig1.SetButtonOnlyTrigger(-1, WPAD_BUTTON_1 | WPAD_CLASSIC_BUTTON_X, 0); GuiTrigger trigA; trigA.SetButtonOnlyTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); GuiTrigger trigB; trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B); GuiTrigger trigU; trigU.SetButtonOnlyTrigger(-1, WPAD_BUTTON_UP | WPAD_CLASSIC_BUTTON_UP, PAD_BUTTON_UP); GuiTrigger trigD; trigD.SetButtonOnlyTrigger(-1, WPAD_BUTTON_DOWN | WPAD_CLASSIC_BUTTON_DOWN, PAD_BUTTON_DOWN); GuiTrigger trigH; trigH.SetButtonOnlyTrigger(-1, WPAD_BUTTON_HOME | WPAD_CLASSIC_BUTTON_HOME, 0); //buttons for changing between synopsis and other info GuiButton backBtn(0, 0); backBtn.SetPosition(-20, -20); backBtn.SetTrigger(&trigB); gameinfoWindow.Append(&backBtn); GuiTrigger trigA_Simple; trigA_Simple.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); GuiTrigger trigLeft; trigLeft.SetButtonOnlyTrigger(-1, WPAD_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_LEFT, PAD_BUTTON_LEFT); GuiTrigger trigRight; trigRight.SetButtonOnlyTrigger(-1, WPAD_BUTTON_RIGHT | WPAD_CLASSIC_BUTTON_RIGHT, PAD_BUTTON_RIGHT); GuiButton LeftBtn(0, 0); LeftBtn.SetTrigger(&trigLeft); if(header->type != TYPE_GAME_WII_DISC && header->type != TYPE_GAME_GC_DISC) gameinfoWindow.Append(&LeftBtn); GuiButton RightBtn(0, 0); RightBtn.SetTrigger(&trigRight); if(header->type != TYPE_GAME_WII_DISC && header->type != TYPE_GAME_GC_DISC) gameinfoWindow.Append(&RightBtn); GuiButton coverBtn(180, 250); coverBtn.SetPosition(20, 20); coverBtn.SetTrigger(&trigA_Simple); gameinfoWindow.Append(&coverBtn); GuiButton nextBtn(400, 300); nextBtn.SetPosition(200, 20); nextBtn.SetTrigger(&trigA_Simple); gameinfoWindow.Append(&nextBtn); //buttons for scrolling the synopsis GuiButton upBtn(0, 0); upBtn.SetPosition(0, 0); upBtn.SetTrigger(&trigU); GuiButton dnBtn(0, 0); dnBtn.SetPosition(0, 0); dnBtn.SetTrigger(&trigD); GuiButton homeBtn(0, 0); homeBtn.SetPosition(0, 0); homeBtn.SetTrigger(&trigH); gameinfoWindow.Append(&homeBtn); char linebuf2[100] = ""; // enable icons for required accessories for (u32 i = 0; i < GameInfo.AccessoirList.size(); ++i) { if(!GameInfo.AccessoirList[i].Required) continue; if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "classiccontroller") == 0) classiccontroller = 1; if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "nunchuk") == 0) nunchuk = 1; if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "guitar") == 0) guitar = 1; if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "drums") == 0) drums = 1; if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "dancepad") == 0) dancepad = 1; if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "motionplus") == 0) motionplus = 1; if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "wheel") == 0) wheel = 1; if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "balanceboard") == 0) balanceboard = 1; if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "microphone") == 0) microphone = 1; if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "zapper") == 0) zapper = 1; if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "nintendods") == 0) nintendods = 1; if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "wiispeak") == 0) wiispeak = 1; //if (strcmp(GameInfo.AccessoirList[i].Name.c_str(),"vitalitysensor")==0) // vitalitysensor=1; if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "gamecube") == 0) gamecube = 1; } // switch icons if (nunchuk) nunchukImgData = Resources::GetImageData("nunchukR.png"); else nunchukImgData = Resources::GetImageData("nunchuk.png"); if (classiccontroller) classiccontrollerImgData = Resources::GetImageData("classiccontrollerR.png"); else classiccontrollerImgData = Resources::GetImageData("classiccontroller.png"); if (guitar) guitarImgData = Resources::GetImageData("guitarR.png"); else guitarImgData = Resources::GetImageData("guitar.png"); if (gamecube) gamecubeImgData = Resources::GetImageData("gcncontrollerR.png"); else gamecubeImgData = Resources::GetImageData("gcncontroller.png"); if (wheel) wheelImgData = Resources::GetImageData("wheelR.png"); else wheelImgData = Resources::GetImageData("wheel.png"); if (motionplus) motionplusImgData = Resources::GetImageData("motionplusR.png"); else motionplusImgData = Resources::GetImageData("motionplus.png"); if (drums) drumsImgData = Resources::GetImageData("drumsR.png"); else drumsImgData = Resources::GetImageData("drums.png"); if (microphone) microphoneImgData = Resources::GetImageData("microphoneR.png"); else microphoneImgData = Resources::GetImageData("microphone.png"); if (zapper) zapperImgData = Resources::GetImageData("zapperR.png"); else zapperImgData = Resources::GetImageData("zapper.png"); if (wiispeak) wiispeakImgData = Resources::GetImageData("wiispeakR.png"); else wiispeakImgData = Resources::GetImageData("wiispeak.png"); if (nintendods) nintendodsImgData = Resources::GetImageData("nintendodsR.png"); else nintendodsImgData = Resources::GetImageData("nintendods.png"); if (balanceboard) balanceboardImgData = Resources::GetImageData("balanceboardR.png"); else balanceboardImgData = Resources::GetImageData("balanceboard.png"); if (dancepad) dancepadImgData = Resources::GetImageData("dancepadR.png"); else dancepadImgData = Resources::GetImageData("dancepad.png"); // look for optional accessories for (u32 i = 0; i < GameInfo.AccessoirList.size(); ++i) { if(GameInfo.AccessoirList[i].Required) continue; if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "classiccontroller") == 0) classiccontroller = 1; if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "nunchuk") == 0) nunchuk = 1; if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "guitar") == 0) guitar = 1; if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "drums") == 0) drums = 1; if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "dancepad") == 0) dancepad = 1; if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "motionplus") == 0) motionplus = 1; if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "wheel") == 0) wheel = 1; if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "balanceboard") == 0) balanceboard = 1; if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "microphone") == 0) microphone = 1; if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "zapper") == 0) zapper = 1; if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "nintendods") == 0) nintendods = 1; if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "wiispeak") == 0) wiispeak = 1; //if (strcmp(GameInfo.AccessoirList[i].Name.c_str(),"vitalitysensor")==0) // vitalitysensor=1; if (strcmp(GameInfo.AccessoirList[i].Name.c_str(), "gamecube") == 0) gamecube = 1; } dialogBoxImg1 = new GuiImage(&dialogBox1); dialogBoxImg1->SetAlignment(0, 3); dialogBoxImg1->SetPosition(-9, 0); dialogBoxImg2 = new GuiImage(&dialogBox2); dialogBoxImg2->SetAlignment(0, 3); dialogBoxImg2->SetPosition(145, 0); dialogBoxImg3 = new GuiImage(&dialogBox3); dialogBoxImg3->SetAlignment(0, 3); dialogBoxImg3->SetPosition(301, 0); dialogBoxImg4 = new GuiImage(&dialogBox4); dialogBoxImg4->SetAlignment(0, 3); dialogBoxImg4->SetPosition(457, 0); gameinfoWindow.Append(dialogBoxImg1); gameinfoWindow.Append(dialogBoxImg2); gameinfoWindow.Append(dialogBoxImg3); gameinfoWindow.Append(dialogBoxImg4); bool loadFlatCover = false; bool load3DCover = false; char imgPath[150]; snprintf(imgPath, sizeof(imgPath), "%s/%s.png", Settings.coversFull_path, ID); if(!CheckFile(imgPath)) { loadFlatCover = true; snprintf(imgPath, sizeof(imgPath), "%s/%s.png", Settings.covers2d_path, ID); } if(!CheckFile(imgPath)) { loadFlatCover = false; load3DCover = true; snprintf(imgPath, sizeof(imgPath), "%s/%s.png", Settings.covers_path, ID); } cover = new GuiImageData(imgPath); //load full id image if (!cover->GetImage()) { delete cover; cover = NULL; } if(load3DCover && cover) //! No cover is always 3D box { coverImg = new GuiImage(cover); coverImg->SetWidescreen(Settings.widescreen); coverImg->SetPosition(15, 30); } else { boxCov = new BoxCover(cover, loadFlatCover); boxCov->SetPosition(-1.6f, 0.4f, -27.0f); boxCov->SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 40); if(GameInfo.CaseColor == 0xFF0000) { boxCov->SetBoxColor((GXColor) { 198, 34, 4, 255 }); } else if(GameInfo.CaseColor >= 0) { u8 * Color = (u8 *) &GameInfo.CaseColor; boxCov->SetBoxColor((GXColor) { Color[1], Color[2], Color[3], 255 }); } gameinfoWindow.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 100); } // # of players if (GameInfo.Players > 0) { if (GameInfo.Players == 1) playersImgData = Resources::GetImageData("wiimote1.png"); else if (GameInfo.Players == 2) playersImgData = Resources::GetImageData("wiimote2.png"); else if (GameInfo.Players == 3) playersImgData = Resources::GetImageData("wiimote3.png"); else if (GameInfo.Players == 4) playersImgData = Resources::GetImageData("wiimote4.png"); playersImg = new GuiImage(playersImgData); playersImg->SetWidescreen(Settings.widescreen); playersImg->SetPosition(intputX, inputY); playersImg->SetAlignment(0, 4); InfoWindow.Append(playersImg); intputX += (Settings.widescreen ? playersImg->GetWidth() * Settings.WSFactor : playersImg->GetWidth()) + 5; } //draw the input types for this game if (motionplus == 1) { motionplusImg = new GuiImage(motionplusImgData); motionplusImg->SetWidescreen(Settings.widescreen); motionplusImg->SetPosition(intputX, inputY); motionplusImg->SetAlignment(0, 4); InfoWindow.Append(motionplusImg); intputX += (Settings.widescreen ? motionplusImg->GetWidth() * Settings.WSFactor : motionplusImg->GetWidth()) + 5; } if (nunchuk == 1) { nunchukImg = new GuiImage(nunchukImgData); nunchukImg->SetWidescreen(Settings.widescreen); nunchukImg->SetPosition(intputX, inputY); nunchukImg->SetAlignment(0, 4); InfoWindow.Append(nunchukImg); intputX += (Settings.widescreen ? nunchukImg->GetWidth() * Settings.WSFactor : nunchukImg->GetWidth()) + 5; } if (classiccontroller == 1) { classiccontrollerImg = new GuiImage(classiccontrollerImgData); classiccontrollerImg->SetWidescreen(Settings.widescreen); classiccontrollerImg->SetPosition(intputX, inputY); classiccontrollerImg->SetAlignment(0, 4); InfoWindow.Append(classiccontrollerImg); intputX += (Settings.widescreen ? classiccontrollerImg->GetWidth() * Settings.WSFactor : classiccontrollerImg->GetWidth()) + 5; } if (gamecube == 1) { gcImg = new GuiImage(gamecubeImgData); gcImg->SetWidescreen(Settings.widescreen); gcImg->SetPosition(intputX, inputY); gcImg->SetAlignment(0, 4); InfoWindow.Append(gcImg); intputX += (Settings.widescreen ? gcImg->GetWidth() * Settings.WSFactor : gcImg->GetWidth()) + 5; } if (wheel == 1) { wheelImg = new GuiImage(wheelImgData); wheelImg->SetWidescreen(Settings.widescreen); wheelImg->SetPosition(intputX, inputY); wheelImg->SetAlignment(0, 4); InfoWindow.Append(wheelImg); intputX += (Settings.widescreen ? wheelImg->GetWidth() * Settings.WSFactor : wheelImg->GetWidth()) + 5; } if (guitar == 1) { guitarImg = new GuiImage(guitarImgData); guitarImg->SetWidescreen(Settings.widescreen); guitarImg->SetPosition(intputX, inputY); guitarImg->SetAlignment(0, 4); InfoWindow.Append(guitarImg); intputX += (Settings.widescreen ? guitarImg->GetWidth() * Settings.WSFactor : guitarImg->GetWidth()) + 5; } if (drums == 1) { drumsImg = new GuiImage(drumsImgData); drumsImg->SetWidescreen(Settings.widescreen); drumsImg->SetPosition(intputX, inputY); drumsImg->SetAlignment(0, 4); InfoWindow.Append(drumsImg); intputX += (Settings.widescreen ? drumsImg->GetWidth() * Settings.WSFactor : drumsImg->GetWidth()) + 5; } if (microphone == 1) { microphoneImg = new GuiImage(microphoneImgData); microphoneImg->SetWidescreen(Settings.widescreen); microphoneImg->SetPosition(intputX, inputY); microphoneImg->SetAlignment(0, 4); InfoWindow.Append(microphoneImg); intputX += (Settings.widescreen ? microphoneImg->GetWidth() * Settings.WSFactor : microphoneImg->GetWidth()) + 5; } if (zapper == 1) { zapperImg = new GuiImage(zapperImgData); zapperImg->SetWidescreen(Settings.widescreen); zapperImg->SetPosition(intputX, inputY); zapperImg->SetAlignment(0, 4); InfoWindow.Append(zapperImg); intputX += (Settings.widescreen ? zapperImg->GetWidth() * Settings.WSFactor : zapperImg->GetWidth()) + 5; } if (wiispeak == 1) { wiispeakImg = new GuiImage(wiispeakImgData); wiispeakImg->SetWidescreen(Settings.widescreen); wiispeakImg->SetPosition(intputX, inputY); wiispeakImg->SetAlignment(0, 4); InfoWindow.Append(wiispeakImg); intputX += (Settings.widescreen ? wiispeakImg->GetWidth() * Settings.WSFactor : wiispeakImg->GetWidth()) + 5; } if (nintendods == 1) { nintendodsImg = new GuiImage(nintendodsImgData); nintendodsImg->SetWidescreen(Settings.widescreen); nintendodsImg->SetPosition(intputX, inputY); nintendodsImg->SetAlignment(0, 4); InfoWindow.Append(nintendodsImg); intputX += (Settings.widescreen ? nintendodsImg->GetWidth() * Settings.WSFactor : nintendodsImg->GetWidth()) + 5; } if (dancepad == 1) { dancepadImg = new GuiImage(dancepadImgData); dancepadImg->SetWidescreen(Settings.widescreen); dancepadImg->SetPosition(intputX, inputY); dancepadImg->SetAlignment(0, 4); InfoWindow.Append(dancepadImg); intputX += (Settings.widescreen ? dancepadImg->GetWidth() * Settings.WSFactor : dancepadImg->GetWidth()) + 5; } if (balanceboard == 1) { balanceboardImg = new GuiImage(balanceboardImgData); balanceboardImg->SetWidescreen(Settings.widescreen); balanceboardImg->SetPosition(intputX, inputY); balanceboardImg->SetAlignment(0, 4); InfoWindow.Append(balanceboardImg); intputX += (Settings.widescreen ? balanceboardImg->GetWidth() * Settings.WSFactor : balanceboardImg->GetWidth()) + 5; } // # online players if (GameInfo.WifiPlayers > 0) { if(GameInfo.WifiPlayers == 1) wifiplayersImgData = Resources::GetImageData("wifi1.png"); else if(GameInfo.WifiPlayers == 2) wifiplayersImgData = Resources::GetImageData("wifi2.png"); else if(GameInfo.WifiPlayers == 4) wifiplayersImgData = Resources::GetImageData("wifi4.png"); else if(GameInfo.WifiPlayers == 6) wifiplayersImgData = Resources::GetImageData("wifi6.png"); else if(GameInfo.WifiPlayers == 10) wifiplayersImgData = Resources::GetImageData("wifi10.png"); else if(GameInfo.WifiPlayers == 8) wifiplayersImgData =Resources::GetImageData("wifi8.png"); else if(GameInfo.WifiPlayers == 12) wifiplayersImgData = Resources::GetImageData("wifi12.png"); else if(GameInfo.WifiPlayers == 16) wifiplayersImgData = Resources::GetImageData("wifi16.png"); else if(GameInfo.WifiPlayers == 32) wifiplayersImgData = Resources::GetImageData("wifi32.png"); wifiplayersImg = new GuiImage(wifiplayersImgData); wifiplayersImg->SetWidescreen(Settings.widescreen); wifiplayersImg->SetPosition(intputX, inputY); wifiplayersImg->SetAlignment(0, 4); InfoWindow.Append(wifiplayersImg); intputX += (Settings.widescreen ? wifiplayersImg->GetWidth() * Settings.WSFactor : wifiplayersImg->GetWidth()) + 5; } // ratings if (GameInfo.RatingType >= 0) { if (GameInfo.RatingType == 1) { if (strcmp(GameInfo.RatingValue.c_str(), "EC") == 0) ratingImgData = Resources::GetImageData("esrb_ec.png"); else if (strcmp(GameInfo.RatingValue.c_str(), "E") == 0) ratingImgData = Resources::GetImageData("esrb_e.png"); else if (strcmp(GameInfo.RatingValue.c_str(), "E10+") == 0) ratingImgData = Resources::GetImageData("esrb_eten.png"); else if (strcmp(GameInfo.RatingValue.c_str(), "T") == 0) ratingImgData = Resources::GetImageData("esrb_t.png"); else if (strcmp(GameInfo.RatingValue.c_str(), "M") == 0) ratingImgData = Resources::GetImageData("esrb_m.png"); else if (strcmp(GameInfo.RatingValue.c_str(), "AO") == 0) ratingImgData = Resources::GetImageData("esrb_ao.png"); else ratingImgData = Resources::GetImageData("norating.png"); } //there are 2 values here cause some countries are stupid and else if (GameInfo.RatingType == 2) //can't use the same as everybody else { if ((strcmp(GameInfo.RatingValue.c_str(), "3") == 0) || (strcmp(GameInfo.RatingValue.c_str(), "4") == 0)) ratingImgData = Resources::GetImageData("pegi_3.png"); else if ((strcmp(GameInfo.RatingValue.c_str(), "7") == 0) || (strcmp(GameInfo.RatingValue.c_str(), "7") == 0)) ratingImgData = Resources::GetImageData("pegi_7.png"); else if (strcmp(GameInfo.RatingValue.c_str(), "12") == 0) ratingImgData = Resources::GetImageData("pegi_12.png"); else if ((strcmp(GameInfo.RatingValue.c_str(), "16") == 0) || (strcmp(GameInfo.RatingValue.c_str(), "15") == 0)) ratingImgData = Resources::GetImageData("pegi_16.png"); else if (strcmp(GameInfo.RatingValue.c_str(), "18") == 0) ratingImgData = Resources::GetImageData("pegi_18.png"); else { ratingImgData = Resources::GetImageData("norating.png"); } } else if (GameInfo.RatingType == 0) { if (strcmp(GameInfo.RatingValue.c_str(), "A") == 0) ratingImgData = Resources::GetImageData("cero_a.png"); else if (strcmp(GameInfo.RatingValue.c_str(), "B") == 0) ratingImgData = Resources::GetImageData("cero_b.png"); else if (strcmp(GameInfo.RatingValue.c_str(), "C") == 0) ratingImgData = Resources::GetImageData("cero_c.png"); else if (strcmp(GameInfo.RatingValue.c_str(), "D") == 0) ratingImgData = Resources::GetImageData("cero_d.png"); else if (strcmp(GameInfo.RatingValue.c_str(), "Z") == 0) ratingImgData = Resources::GetImageData("cero_z.png"); else { ratingImgData = Resources::GetImageData("norating.png"); } } else { ratingImgData = Resources::GetImageData("norating.png"); } ratingImg = new GuiImage(ratingImgData); ratingImg->SetWidescreen(Settings.widescreen); ratingImg->SetPosition(-25, inputY); ratingImg->SetAlignment(1, 4); InfoWindow.Append(ratingImg); intputX += (Settings.widescreen ? ratingImg->GetWidth() * Settings.WSFactor : ratingImg->GetWidth()) + 5; } // title int titlefontsize = 25; if (GameInfo.Title.size() > 0) { titleTxt = new GuiText(GameInfo.Title.c_str(), titlefontsize, ( GXColor ) {0, 0, 0, 255}); titleTxt->SetMaxWidth(350, SCROLL_HORIZONTAL); titleTxt->SetAlignment(ALIGN_CENTER, ALIGN_TOP); titleTxt->SetPosition(txtXOffset, 12 + titley); InfoWindow.Append(titleTxt); } //date snprintf(linebuf2, sizeof(linebuf2), " "); if (GameInfo.PublishDate != 0) { int year = GameInfo.PublishDate >> 16; int day = GameInfo.PublishDate & 0xFF; int month = (GameInfo.PublishDate >> 8) & 0xFF; snprintf(linebuf2, sizeof(linebuf2), "%02i ", day); switch (month) { case 1: snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, tr( "Jan" )); break; case 2: snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, tr( "Feb" )); break; case 3: snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, tr( "Mar" )); break; case 4: snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, tr( "Apr" )); break; case 5: snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, tr( "May" )); break; case 6: snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, tr( "June" )); break; case 7: snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, tr( "July" )); break; case 8: snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, tr( "Aug" )); break; case 9: snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, tr( "Sept" )); break; case 10: snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, tr( "Oct" )); break; case 11: snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, tr( "Nov" )); break; case 12: snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, tr( "Dec" )); break; } char linebuf[300]; snprintf(linebuf, sizeof(linebuf), "%s : %s%i", tr( "Released" ), linebuf2, year); releasedTxt = new GuiText(linebuf, 16, ( GXColor ) {0, 0, 0, 255}); if (releasedTxt->GetTextWidth() > 300) newline = 2; releasedTxt->SetAlignment(ALIGN_RIGHT, ALIGN_TOP); releasedTxt->SetPosition(-17, 12 + indexy); indexy += (20 * newline); newline = 1; InfoWindow.Append(releasedTxt); }
void Hud::SetDepth(int depth) { GuiText* t = (GuiText*)m_gui->GetElementByName("depth-num"); Assert(t); t->SetText(ToString(depth)); }
void Hud::Draw() { float dt = TheTimer::Instance()->GetDt(); static const char* SCORE_NAME[3] = { "p1-score-text", "p2-score-text", "hi-score-text" }; static const float origSize[3] = { dynamic_cast<GuiText*>(m_gui->GetElementByName(SCORE_NAME[0]))->GetFontSize(), dynamic_cast<GuiText*>(m_gui->GetElementByName(SCORE_NAME[1]))->GetFontSize(), dynamic_cast<GuiText*>(m_gui->GetElementByName(SCORE_NAME[2]))->GetFontSize() }; for (int i = 0; i < 3; i++) { if (s_scoreExpandTimer[i] > 0) { s_scoreExpandTimer[i] -= dt; if (s_scoreExpandTimer[i] < 0) { s_scoreExpandTimer[i] = 0; } GuiText* text = dynamic_cast<GuiText*>(m_gui->GetElementByName(SCORE_NAME[i])); Assert(text); static const float EXPAND_SCALE = ROConfig()->GetFloat("hud-expand-scale"); text->SetFontSize(origSize[i] * (s_scoreExpandTimer[i] * EXPAND_SCALE + 1.0f)); std::string s = text->GetText(); text->SetText(""); text->SetText(s); // force tri list rebuild } } if (s_lifeTimer > 0) { s_lifeTimer -= dt; if (s_lifeTimer < 0) { s_lifeTimer = 0; } static const char* GUI_NAME[4] = { "heart-img1", "p1-lives-text", "heart-img2", "p2-lives-text" }; float t = s_lifeTimer * 10; bool vis = (((int)t % 2) == 0); for (int i = 0; i < 4; i++) { GuiElement* elem = m_gui->GetElementByName(GUI_NAME[i]); Assert(elem); elem->SetVisible(vis); } } m_gui->Draw(); }
void Ve1NameNode::Draw() { // Print name // TODO Do all these in one go, to minimise state changes AmjuGL::PushAttrib(AmjuGL::AMJU_BLEND | AmjuGL::AMJU_DEPTH_READ); AmjuGL::Enable(AmjuGL::AMJU_BLEND); AmjuGL::Disable(AmjuGL::AMJU_DEPTH_READ); GuiText text; text.SetTextSize(5.0f); // TODO CONFIG text.SetText(ToString(*m_obj)); static const float MAX_NAME_WIDTH = 4.0f; // minimise this to reduce overdraw - calc from text text.SetSize(Vec2f(MAX_NAME_WIDTH, 1.0f)); text.SetJust(GuiText::AMJU_JUST_CENTRE); //text.SetInverse(true); //text.SetDrawBg(true); AmjuGL::PushMatrix(); Matrix m; m.SetIdentity(); //Vec3f tr(m_local[12], m_local[13], m_local[14]); Vec3f tr(m_combined[12], m_combined[13], m_combined[14]); m.Translate(tr); AmjuGL::MultMatrix(m); static const float SCALE_FACTOR = 20.0f; float x = MAX_NAME_WIDTH * SCALE_FACTOR * -0.5f; AmjuGL::Translate(x, 60.0f, 0); // TODO CONFIG AmjuGL::Scale(SCALE_FACTOR, SCALE_FACTOR, 10); text.Draw(); AmjuGL::PopMatrix(); AmjuGL::PopAttrib(); /* AmjuGL::PushAttrib( AmjuGL::AMJU_TEXTURE_2D | AmjuGL:: AMJU_LIGHTING | AmjuGL::AMJU_BLEND | AmjuGL::AMJU_DEPTH_READ | AmjuGL::AMJU_DEPTH_WRITE); AmjuGL::Enable(AmjuGL::AMJU_TEXTURE_2D); AmjuGL::Disable(AmjuGL::AMJU_LIGHTING); AmjuGL::Enable(AmjuGL::AMJU_BLEND); AmjuGL::Disable(AmjuGL::AMJU_DEPTH_READ); AmjuGL::Disable(AmjuGL::AMJU_DEPTH_WRITE); AmjuGL::PushMatrix(); AmjuGL::SetIdentity(); AmjuGL::SetMatrixMode(AmjuGL::AMJU_PROJECTION_MATRIX); AmjuGL::PushMatrix(); AmjuGL::SetIdentity(); MultColour(Colour(0, 0, 1, 1)); GuiText text; text.SetTextSize(0.5f); std::string s = "Object " + ToString(m_obj->GetId()) + " " + m_obj->GetTypeName(); text.SetText(s); text.SizeToText(); text.SetJust(GuiText::AMJU_JUST_LEFT); text.SetLocalPos(screenpos); text.Draw(); AmjuGL::PopMatrix(); AmjuGL::SetMatrixMode(AmjuGL::AMJU_MODELVIEW_MATRIX); AmjuGL::PopMatrix(); AmjuGL::PopAttrib(); */ }