|
@@ -23,6 +23,7 @@
|
23
|
23
|
Menu::Menu() {
|
24
|
24
|
mVisible = false;
|
25
|
25
|
mCursor = 0;
|
|
26
|
+ mMin = 0;
|
26
|
27
|
|
27
|
28
|
mainText.text = bufferString(VERSION);
|
28
|
29
|
mainText.color[0] = 0xFF;
|
|
@@ -89,15 +90,17 @@ void Menu::displayMapList() {
|
89
|
90
|
while ((max - min) < items) {
|
90
|
91
|
if (min > 0)
|
91
|
92
|
min--;
|
92
|
|
- else if (max < (gOpenRaider->mMapList.size()))
|
|
93
|
+ else if (max < ((int)gOpenRaider->mMapList.size()))
|
93
|
94
|
max++;
|
94
|
95
|
else
|
95
|
96
|
break;
|
96
|
97
|
}
|
97
|
98
|
|
|
99
|
+ mMin = min;
|
|
100
|
+
|
98
|
101
|
for (int i = 0; i < (max - min); i++) {
|
99
|
102
|
char *map = gOpenRaider->mMapList[i + min];
|
100
|
|
- if ((i + min) == mCursor) {
|
|
103
|
+ if ((i + min) == (int)mCursor) {
|
101
|
104
|
// Less greem & red --> highlight in red
|
102
|
105
|
tempText.color[1] = 0x42;
|
103
|
106
|
tempText.color[2] = 0x42;
|
|
@@ -126,7 +129,24 @@ void Menu::display() {
|
126
|
129
|
if (!gOpenRaider->mMapListFilled) {
|
127
|
130
|
drawText(25, (window->mHeight / 2) - 20, 0.75f, "Generating map list...");
|
128
|
131
|
} else {
|
129
|
|
- displayMapList();
|
|
132
|
+ if (gOpenRaider->mMapList.size() == 0) {
|
|
133
|
+ drawText(25, (window->mHeight / 2) - 20, 0.75f, "No maps found! See README.md");
|
|
134
|
+ } else {
|
|
135
|
+ // draw *play button* above list
|
|
136
|
+ glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
|
137
|
+ glDisable(GL_TEXTURE_2D);
|
|
138
|
+ glRecti(25, 25, 100, 75);
|
|
139
|
+ glEnable(GL_TEXTURE_2D);
|
|
140
|
+ tempText.color[0] = 0x00;
|
|
141
|
+ tempText.color[1] = 0x00;
|
|
142
|
+ tempText.color[2] = 0x00;
|
|
143
|
+ drawText(40, 35, 0.75f, "Play");
|
|
144
|
+ tempText.color[0] = 0xFF;
|
|
145
|
+ tempText.color[1] = 0xFF;
|
|
146
|
+ tempText.color[2] = 0xFF;
|
|
147
|
+
|
|
148
|
+ displayMapList();
|
|
149
|
+ }
|
130
|
150
|
}
|
131
|
151
|
}
|
132
|
152
|
}
|
|
@@ -162,3 +182,18 @@ void Menu::handleKeyboard(KeyboardButton key, bool pressed) {
|
162
|
182
|
}
|
163
|
183
|
}
|
164
|
184
|
|
|
185
|
+void Menu::handleMouseClick(unsigned int x, unsigned int y, MouseButton button, bool released) {
|
|
186
|
+ int items = (gOpenRaider->mWindow->mHeight - 110) / 25;
|
|
187
|
+
|
|
188
|
+ if ((!released) || (button != leftButton))
|
|
189
|
+ return;
|
|
190
|
+
|
|
191
|
+ if ((y >= 100) && (y <= (100 + (25 * items)))) {
|
|
192
|
+ y -= 100;
|
|
193
|
+ mCursor = mMin + (y / 25);
|
|
194
|
+ } else if ((y >= 25) && (y <= 100) && (x >= 25) && (x <= 125)) {
|
|
195
|
+ // Play button
|
|
196
|
+ mCursor = 0;
|
|
197
|
+ }
|
|
198
|
+}
|
|
199
|
+
|