MCPcopy Create free account
hub / github.com/android/ndk-samples / RenderMenu

Method RenderMenu

endless-tunnel/app/src/main/cpp/play_scene.cpp:658–683  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

656}
657
658void PlayScene::RenderMenu() {
659 float aspect = SceneManager::GetInstance()->GetScreenAspect();
660 glm::mat4 modelMat;
661 glm::mat4 mat;
662
663 glDisable(GL_DEPTH_TEST);
664
665 RenderBackgroundAnimation(mShapeRenderer);
666
667 float scaleFactor =
668 SineWave(1.0f, MENUITEM_PULSE_AMOUNT, MENUITEM_PULSE_PERIOD, 0.0f);
669
670 int i;
671 for (i = 0; i < mMenuItemCount; i++) {
672 float thisFactor = (mMenuSel == i) ? scaleFactor : 1.0f;
673 float y = 1.0f - (i + 1) / ((float)mMenuItemCount + 1);
674 float x = aspect * 0.5f;
675 mTextRenderer->SetFontScale(thisFactor * MENUITEM_FONT_SCALE);
676 mTextRenderer->SetColor(mMenuSel == i ? MENUITEM_SEL_COLOR
677 : MENUITEM_COLOR);
678 mTextRenderer->RenderText(mMenuItemText[mMenuItems[i]], x, y);
679 }
680 mTextRenderer->ResetColor();
681
682 glEnable(GL_DEPTH_TEST);
683}
684
685void PlayScene::DetectCollisions(float previousY) {
686 Obstacle* o = GetObstacleAt(0);

Callers

nothing calls this directly

Calls 7

SineWaveFunction · 0.85
GetScreenAspectMethod · 0.80
RenderTextMethod · 0.80
ResetColorMethod · 0.80
SetFontScaleMethod · 0.45
SetColorMethod · 0.45

Tested by

no test coverage detected