@@ -40,6 +40,19 @@ namespace fs = ghc::filesystem;
40
40
WorldSelectionState::WorldSelectionState (TitleScreenState *titleScreen)
41
41
: InterfaceState(titleScreen), m_titleScreen(titleScreen)
42
42
{
43
+ m_title.setScale (Config::guiScale, Config::guiScale);
44
+ m_title.setString (" Select or create a world" );
45
+ m_title.updateVertexBuffer ();
46
+
47
+ m_background.setScale (Config::guiScale * 2 , Config::guiScale * 2 );
48
+ m_background.setPosRect (0 , 0 , Config::screenWidth / m_background.getScale ().x , Config::screenHeight / m_background.getScale ().y );
49
+ m_background.setClipRect (0 , 0 , Config::screenWidth / m_background.getScale ().x , Config::screenHeight / m_background.getScale ().y );
50
+
51
+ m_filter1.setSize (Config::screenWidth, Config::screenHeight);
52
+ m_filter1.setFillColor (gk::Color (0 , 0 , 0 , 128 ));
53
+
54
+ m_filter2.setFillColor (gk::Color (0 , 0 , 0 , 192 ));
55
+
43
56
m_menuWidget.setScale (Config::guiScale, Config::guiScale);
44
57
m_menuWidget.addButton (" New world" , [this ](TextButton &) {
45
58
m_stateStack->push <WorldCreationState>(m_titleScreen);
@@ -74,7 +87,19 @@ void WorldSelectionState::update() {
74
87
}
75
88
76
89
void WorldSelectionState::updateWidgetPosition () {
77
- m_cancelButton.setPosition (Config::screenWidth / 2 .0f - m_cancelButton.getGlobalBounds ().sizeX / 2 .0f , Config::screenHeight * 0.85 );
90
+ const int borderSize = 25 * Config::guiScale;
91
+ m_filter2.setSize (Config::screenWidth, Config::screenHeight - borderSize * 2 );
92
+ m_filter2.setPosition (0 , borderSize);
93
+
94
+ m_cancelButton.setPosition (
95
+ Config::screenWidth / 2 .0f - m_cancelButton.getGlobalBounds ().sizeX / 2 .0f ,
96
+ Config::screenHeight - borderSize / 2 - m_cancelButton.getGlobalBounds ().sizeY / 2 .0f
97
+ );
98
+
99
+ m_title.setPosition (
100
+ Config::screenWidth / 2 .0f - m_title.getSize ().x * Config::guiScale / 2 .0f ,
101
+ borderSize / 2 - m_title.getSize ().y * Config::guiScale / 2 .0f
102
+ );
78
103
}
79
104
80
105
void WorldSelectionState::loadSaveList () {
@@ -105,12 +130,15 @@ void WorldSelectionState::loadSaveList() {
105
130
}
106
131
107
132
void WorldSelectionState::draw (gk::RenderTarget &target, gk::RenderStates states) const {
108
- if (m_parent)
109
- target.draw (*m_parent, states);
110
-
111
133
if (&m_stateStack->top () == this ) {
112
134
prepareDraw (target, states);
113
135
136
+ target.draw (m_background, states);
137
+ target.draw (m_filter1, states);
138
+ target.draw (m_filter2, states);
139
+
140
+ target.draw (m_title, states);
141
+
114
142
target.draw (m_menuWidget, states);
115
143
target.draw (m_cancelButton, states);
116
144
}
0 commit comments