MCPcopy Create free account
hub / github.com/Panzerschrek/Chasm-Reverse / Draw

Method Draw

PanzerChasm/menu.cpp:110–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108{}
109
110void NewGameMenu::Draw( IMenuDrawer& menu_drawer, ITextDrawer& text_draw )
111{
112 const Size2 pic_size= menu_drawer.GetPictureSize( IMenuDrawer::MenuPicture::New );
113 const Size2 viewport_size= menu_drawer.GetViewportSize();
114
115 const int scale= int( menu_drawer.GetMenuScale() );
116 const int x= int(viewport_size.xy[0] >> 1u) - int( ( scale * pic_size.xy[0] ) >> 1 );
117 const int y= int(viewport_size.xy[1] >> 1u) - int( ( scale * pic_size.xy[1] ) >> 1 );
118
119 menu_drawer.DrawMenuBackground(
120 x, y,
121 pic_size.xy[0] * scale, pic_size.xy[1] * scale );
122
123 IMenuDrawer::PictureColor colors[3]=
124 {
125 IMenuDrawer::PictureColor::Unactive,
126 IMenuDrawer::PictureColor::Unactive,
127 IMenuDrawer::PictureColor::Unactive,
128 };
129 colors[ current_row_ ]= IMenuDrawer::PictureColor::Active;
130
131 text_draw.Print(
132 int( viewport_size.xy[0] >> 1u ),
133 y - int( ( g_menu_caption_offset + text_draw.GetLineHeight() ) * scale ),
134 "Difficulty",
135 scale,
136 ITextDrawer::FontColor::White, ITextDrawer::Alignment::Center );
137
138 menu_drawer.DrawMenuPicture(
139 x, y,
140 IMenuDrawer::MenuPicture::New, colors );
141}
142
143MenuBase* NewGameMenu::ProcessEvent( const SystemEvent& event )
144{

Callers 1

LoopMethod · 0.45

Calls 15

GetKeyNameFunction · 0.85
GetOrSetIntMethod · 0.80
GetOrSetBoolMethod · 0.80
GetIntMethod · 0.80
GetBoolMethod · 0.80
WidthMethod · 0.80
HeightMethod · 0.80
SaveAvailableMethod · 0.80
GetPictureSizeMethod · 0.45
GetViewportSizeMethod · 0.45
GetMenuScaleMethod · 0.45
DrawMenuBackgroundMethod · 0.45

Tested by

no test coverage detected