2
2
3
3
#include " ../States/GameState.h"
4
4
5
- GameViewContainer::GameViewContainer (GameState& gameState) :
6
- UIContainer{{&mFileIoDialog }},
7
- mFileIoDialog {gameState.fileLoadDelegate (), gameState.fileSaveDelegate ()}
5
+ GameViewContainer::GameViewContainer (GameState& gameState) :
6
+ UIContainer{{&mFileIoDialog , &mGameOptionsDialog , &mGameOptionsButton }},
7
+ mFileIoDialog {gameState.fileLoadDelegate (), gameState.fileSaveDelegate ()},
8
+ mGameOptionsButton {" Menu" , {this , &GameViewContainer::onGameOptionsButton}}
8
9
{
9
10
mGameOptionsDialog .hide ();
10
11
@@ -17,6 +18,13 @@ GameViewContainer::GameViewContainer(GameState& gameState) :
17
18
const auto rendererCenter = NAS2D::Utility<NAS2D::Renderer>::get ().center ().to <int >();
18
19
const auto centerPosition = [&rendererCenter](const Control& control) { return (rendererCenter - control.size () / 2 ); };
19
20
mFileIoDialog .position (NAS2D::Point {centerPosition (mFileIoDialog ).x , centerPosition (mFileIoDialog ).y });
21
+
22
+ constexpr auto hudHeight = constants::ResourceIconSize + constants::MarginTight * 2 ;
23
+ const auto rendererSize = NAS2D::Utility<NAS2D::Renderer>::get ().size ();
24
+ const auto gameOptionsButtonSize = getDefaultFont ().size (mGameOptionsButton .text ());
25
+
26
+ mGameOptionsButton .size ({gameOptionsButtonSize.x + constants::Margin, hudHeight});
27
+ mGameOptionsButton .position ({rendererSize.x - mGameOptionsButton .size ().x , constants::MarginTight / 2 });
20
28
}
21
29
22
30
0 commit comments