MCPcopy Create free account
hub / github.com/DaedalusX64/daedalus / Render

Method Render

Source/SysPSP/UI/MainMenuScreen.cpp:248–289  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

246//
247
248void 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//

Callers

nothing calls this directly

Calls 6

GetDefaultTextColourMethod · 0.80
SetFontStyleMethod · 0.80
ClearBackgroundMethod · 0.45
GetFontHeightMethod · 0.45
GetTextWidthMethod · 0.45
DrawTextScaleMethod · 0.45

Tested by

no test coverage detected