| 109 | } |
| 110 | |
| 111 | void UiScene::DoFrame() { |
| 112 | SceneManager* mgr = SceneManager::GetInstance(); |
| 113 | |
| 114 | // clear screen |
| 115 | glClearColor(0.0f, 0.0f, 0.0f, 1.0f); |
| 116 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); |
| 117 | glDisable(GL_DEPTH_TEST); |
| 118 | |
| 119 | // render background |
| 120 | RenderBackground(); |
| 121 | |
| 122 | // if we're in wait screen mode, render the "Please Wait" sign and do nothing |
| 123 | // else |
| 124 | if (mWaitScreen) { |
| 125 | mTextRenderer->SetFontScale(WAIT_SIGN_SCALE); |
| 126 | mTextRenderer->SetColor(1.0f, 1.0f, 1.0f); |
| 127 | mTextRenderer->RenderText(S_PLEASE_WAIT, mgr->GetScreenAspect() * 0.5f, |
| 128 | 0.5f); |
| 129 | glEnable(GL_DEPTH_TEST); |
| 130 | return; |
| 131 | } |
| 132 | |
| 133 | // if the currently focused widget is not a clickable button, get out of focus |
| 134 | // mode |
| 135 | if (mFocusWidget >= 0 && !mWidgets[mFocusWidget]->IsClickableButton()) { |
| 136 | mFocusWidget = -1; |
| 137 | } |
| 138 | |
| 139 | // calculate transition factor, which is 0 when we're starting the transition |
| 140 | // and 1 when we've finished the transition |
| 141 | float tf = |
| 142 | Clamp((Clock() - mTransitionStart) / TRANSITION_DURATION, 0.0f, 1.0f); |
| 143 | |
| 144 | // render ALL the widgets! |
| 145 | int i; |
| 146 | for (i = 0; i < mWidgetCount; ++i) { |
| 147 | mWidgets[i]->Render(mTrivialShader, mTextRenderer, mShapeRenderer, |
| 148 | (mFocusWidget < 0) ? UiWidget::FOCUS_NOT_APPLICABLE |
| 149 | : (mFocusWidget == i) ? UiWidget::FOCUS_YES |
| 150 | : UiWidget::FOCUS_NO, |
| 151 | tf); |
| 152 | } |
| 153 | |
| 154 | glEnable(GL_DEPTH_TEST); |
| 155 | } |
| 156 | |
| 157 | void UiScene::RenderBackground() { |
| 158 | // base classes override this to draw background |
nothing calls this directly
no test coverage detected