| 246 | // |
| 247 | |
| 248 | void IMainMenuScreen::Render() |
| 249 | { |
| 250 | mpContext->ClearBackground(); |
| 251 | |
| 252 | |
| 253 | c32 valid_colour( mpContext->GetDefaultTextColour() ); |
| 254 | c32 invalid_colour( 200, 200, 200 ); |
| 255 | |
| 256 | f32 min_scale( 0.60f ); |
| 257 | f32 max_scale( 1.0f ); |
| 258 | |
| 259 | s32 SCREEN_LEFT = 20; |
| 260 | s32 SCREEN_RIGHT = SCREEN_WIDTH - 20; |
| 261 | |
| 262 | mpContext->SetFontStyle( CUIContext::FS_HEADING ); |
| 263 | |
| 264 | s32 y( MENU_TOP + mpContext->GetFontHeight() ); |
| 265 | |
| 266 | for( s32 i = -2; i <= 2; ++i ) |
| 267 | { |
| 268 | EMenuOption option( AsMenuOption( mCurrentOption + i ) ); |
| 269 | c32 text_col( IsOptionValid( option ) ? valid_colour : invalid_colour ); |
| 270 | const char * option_text( gMenuOptionNames[ option ] ); |
| 271 | u32 text_width( mpContext->GetTextWidth( option_text ) ); |
| 272 | |
| 273 | f32 diff( f32( mCurrentOption + i ) - mCurrentDisplayOption ); |
| 274 | f32 dist( fabsf( diff ) ); |
| 275 | |
| 276 | s32 centre( ( SCREEN_WIDTH - text_width ) / 2 ); |
| 277 | s32 extreme( diff < 0 ? SCREEN_LEFT : s32( SCREEN_RIGHT - (text_width * min_scale) ) ); |
| 278 | |
| 279 | // Interpolate between central and extreme position and centre |
| 280 | f32 scale( max_scale + (min_scale - max_scale) * dist ); |
| 281 | s32 x( s32( centre + (extreme - centre) * dist ) ); |
| 282 | |
| 283 | mpContext->DrawTextScale( x, y, scale, option_text, text_col ); |
| 284 | } |
| 285 | |
| 286 | mpContext->SetFontStyle( CUIContext::FS_REGULAR ); |
| 287 | |
| 288 | mOptionComponents[ GetCurrentOption() ]->Render(); |
| 289 | } |
| 290 | |
| 291 | |
| 292 | // |
nothing calls this directly
no test coverage detected