2 Copyright (C) 2003, 2010 - Wolfire Games
3 Copyright (C) 2010-2016 - Lugaru contributors (see AUTHORS file)
5 This file is part of Lugaru.
7 Lugaru is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 Lugaru is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with Lugaru. If not, see <http://www.gnu.org/licenses/>.
31 // Should not be needed, Menu should call methods from other classes to launch maps and challenges and so on
33 #include "openal_wrapper.h"
37 extern float multiplier;
38 extern std::set<std::pair<int,int>> resolutions;
40 extern std::vector<CampaignLevel> campaignlevels;
41 extern float musicvolume[4];
42 extern float oldmusicvolume[4];
43 extern bool stillloading;
44 extern bool visibleloading;
45 extern int whichchoice;
46 extern int leveltheme;
48 extern void toggleFullscreen();
52 std::vector<MenuItem> Menu::items;
54 MenuItem::MenuItem(MenuItemType _type, int _id, const string& _text, Texture _texture,
55 int _x, int _y, int _w, int _h, float _r, float _g, float _b,
56 float _linestartsize, float _lineendsize):
69 linestartsize(_linestartsize),
70 lineendsize(_lineendsize)
72 if (type == MenuItem::BUTTON) {
74 w = text.length() * 10;
82 void Menu::clearMenu()
87 void Menu::addLabel(int id, const string& text, int x, int y, float r, float g, float b)
89 items.emplace_back(MenuItem::LABEL, id, text, Texture(), x, y, -1, -1, r, g, b);
91 void Menu::addButton(int id, const string& text, int x, int y, float r, float g, float b)
93 items.emplace_back(MenuItem::BUTTON, id, text, Texture(), x, y, -1, -1, r, g, b);
95 void Menu::addImage(int id, Texture texture, int x, int y, int w, int h, float r, float g, float b)
97 items.emplace_back(MenuItem::IMAGE, id, "", texture, x, y, w, h, r, g, b);
99 void Menu::addButtonImage(int id, Texture texture, int x, int y, int w, int h, float r, float g, float b)
101 items.emplace_back(MenuItem::IMAGEBUTTON, id, "", texture, x, y, w, h, r, g, b);
103 void Menu::addMapLine(int x, int y, int w, int h, float startsize, float endsize, float r, float g, float b)
105 items.emplace_back(MenuItem::MAPLINE, -1, "", Texture(), x, y, w, h, r, g, b, startsize, endsize);
107 void Menu::addMapMarker(int id, Texture texture, int x, int y, int w, int h, float r, float g, float b)
109 items.emplace_back(MenuItem::MAPMARKER, id, "", texture, x, y, w, h, r, g, b);
111 void Menu::addMapLabel(int id, const string& text, int x, int y, float r, float g, float b)
113 items.emplace_back(MenuItem::MAPLABEL, id, text, Texture(), x, y, -1, -1, r, g, b);
116 void Menu::setText(int id, const string& text)
118 for (vector<MenuItem>::iterator it = items.begin(); it != items.end(); it++)
121 it->w = it->text.length() * 10;
126 void Menu::setText(int id, const string& text, int x, int y, int w, int h)
128 for (vector<MenuItem>::iterator it = items.begin(); it != items.end(); it++)
134 it->w = it->text.length() * 10;
141 int Menu::getSelected(int mousex, int mousey)
143 for (vector<MenuItem>::iterator it = items.begin(); it != items.end(); it++)
144 if (it->type == MenuItem::BUTTON || it->type == MenuItem::IMAGEBUTTON || it->type == MenuItem::MAPMARKER) {
147 if (it->type == MenuItem::MAPMARKER) {
151 if (mx >= it->x && mx < it->x + it->w && my >= it->y && my < it->y + it->h)
157 void Menu::handleFadeEffect()
159 for (vector<MenuItem>::iterator it = items.begin(); it != items.end(); it++) {
160 if (it->id == Game::selected) {
161 it->effectfade += multiplier * 5;
162 if (it->effectfade > 1)
165 it->effectfade -= multiplier * 5;
166 if (it->effectfade < 0)
172 void Menu::drawItems()
175 glEnable(GL_TEXTURE_2D);
176 glEnable(GL_ALPHA_TEST);
178 for (vector<MenuItem>::iterator it = items.begin(); it != items.end(); it++) {
180 case MenuItem::IMAGE:
181 case MenuItem::IMAGEBUTTON:
182 case MenuItem::MAPMARKER:
183 glColor4f(it->r, it->g, it->b, 1);
185 if (it->type == MenuItem::MAPMARKER) {
186 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
187 glTranslatef(2.5, -4.5, 0); //from old code
189 glBlendFunc(GL_SRC_ALPHA, GL_ONE);
192 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
193 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
196 glVertex3f(it->x, it->y, 0);
198 glVertex3f(it->x + it->w, it->y, 0);
200 glVertex3f(it->x + it->w, it->y + it->h, 0);
202 glVertex3f(it->x, it->y + it->h, 0);
204 if (it->type != MenuItem::IMAGE) {
205 //mouseover highlight
206 for (int i = 0; i < 10; i++) {
207 if (1 - ((float)i) / 10 - (1 - it->effectfade) > 0) {
208 glColor4f(it->r, it->g, it->b, (1 - ((float)i) / 10 - (1 - it->effectfade))*.25);
211 glVertex3f(it->x - ((float)i) * 1 / 2, it->y - ((float)i) * 1 / 2, 0);
213 glVertex3f(it->x + it->w + ((float)i) * 1 / 2, it->y - ((float)i) * 1 / 2, 0);
215 glVertex3f(it->x + it->w + ((float)i) * 1 / 2, it->y + it->h + ((float)i) * 1 / 2, 0);
217 glVertex3f(it->x - ((float)i) * 1 / 2, it->y + it->h + ((float)i) * 1 / 2, 0);
224 case MenuItem::LABEL:
225 case MenuItem::BUTTON:
226 glColor4f(it->r, it->g, it->b, 1);
227 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
228 Game::text->glPrint(it->x, it->y, it->text.c_str(), 0, 1, 640, 480);
229 if (it->type != MenuItem::LABEL) {
230 //mouseover highlight
231 glBlendFunc(GL_SRC_ALPHA, GL_ONE);
232 for (int i = 0; i < 15; i++) {
233 if (1 - ((float)i) / 15 - (1 - it->effectfade) > 0) {
234 glColor4f(it->r, it->g, it->b, (1 - ((float)i) / 10 - (1 - it->effectfade))*.25);
235 Game::text->glPrint(it->x - ((float)i), it->y, it->text.c_str(), 0, 1 + ((float)i) / 70, 640, 480);
240 case MenuItem::MAPLABEL:
241 Game::text->glPrintOutlined(0.9, 0, 0, it->x, it->y, it->text.c_str(), 0, 0.6, 640, 480);
243 case MenuItem::MAPLINE: {
249 lineend.x = it->x + it->w;
250 lineend.y = it->y + it->h;
252 XYZ offset = lineend - linestart;
255 offset = DoRotation(offset, 0, 0, 90);
258 linestart += fac * 4 * it->linestartsize;
259 lineend -= fac * 4 * it->lineendsize;
261 glDisable(GL_TEXTURE_2D);
262 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
263 glColor4f(it->r, it->g, it->b, 1);
265 glTranslatef(2, -5, 0); //from old code
267 glVertex3f(linestart.x - offset.x * it->linestartsize, linestart.y - offset.y * it->linestartsize, 0.0f);
268 glVertex3f(linestart.x + offset.x * it->linestartsize, linestart.y + offset.y * it->linestartsize, 0.0f);
269 glVertex3f(lineend.x + offset.x * it->lineendsize, lineend.y + offset.y * it->lineendsize, 0.0f);
270 glVertex3f(lineend.x - offset.x * it->lineendsize, lineend.y - offset.y * it->lineendsize, 0.0f);
273 glEnable(GL_TEXTURE_2D);
283 void Menu::updateSettingsMenu()
285 std::string sbuf = std::string("Resolution: ") + to_string(newscreenwidth) + "*" + to_string(newscreenheight);
286 if (((float)newscreenwidth <= (float)newscreenheight * 1.61) && ((float)newscreenwidth >= (float)newscreenheight * 1.59)) {
287 sbuf += " (widescreen)";
290 setText(14, fullscreen ? "Fullscreen: On" : "Fullscreen: Off");
291 if (newdetail == 0) setText(1, "Detail: Low");
292 if (newdetail == 1) setText(1, "Detail: Medium");
293 if (newdetail == 2) setText(1, "Detail: High");
294 if (bloodtoggle == 0) setText(2, "Blood: Off");
295 if (bloodtoggle == 1) setText(2, "Blood: On, low detail");
296 if (bloodtoggle == 2) setText(2, "Blood: On, high detail (slower)");
297 if (difficulty == 0) setText(3, "Difficulty: Easier");
298 if (difficulty == 1) setText(3, "Difficulty: Difficult");
299 if (difficulty == 2) setText(3, "Difficulty: Insane");
300 setText(4, ismotionblur ? "Blur Effects: Enabled (less compatible)" : "Blur Effects: Disabled (more compatible)");
301 setText(5, decals ? "Decals: Enabled (slower)" : "Decals: Disabled");
302 setText(6, musictoggle ? "Music: Enabled" : "Music: Disabled");
303 setText(9, invertmouse ? "Invert mouse: Yes" : "Invert mouse: No");
304 setText(10, std::string("Mouse Speed: ") + to_string(int(usermousesensitivity * 5)));
305 setText(11, std::string("Volume: ") + to_string(int(volume * 100)) + "%");
306 setText(13, showdamagebar ? "Damage Bar: On" : "Damage Bar: Off");
307 if ((newdetail == detail) && (newscreenheight == (int)screenheight) && (newscreenwidth == (int)screenwidth)) {
310 setText(8, "Back (some changes take effect next time Lugaru is opened)");
314 void Menu::updateStereoConfigMenu()
316 setText(0, std::string("Stereo mode: ") + StereoModeName(newstereomode));
317 setText(1, std::string("Stereo separation: ") + to_string(stereoseparation));
318 setText(2, std::string("Reverse stereo: ") + (stereoreverse ? "Yes" : "No"));
321 void Menu::updateControlsMenu()
323 setText(0, (string)"Forwards: " + (keyselect == 0 ? "_" : Input::keyToChar(forwardkey)));
324 setText(1, (string)"Back: " + (keyselect == 1 ? "_" : Input::keyToChar(backkey)));
325 setText(2, (string)"Left: " + (keyselect == 2 ? "_" : Input::keyToChar(leftkey)));
326 setText(3, (string)"Right: " + (keyselect == 3 ? "_" : Input::keyToChar(rightkey)));
327 setText(4, (string)"Crouch: " + (keyselect == 4 ? "_" : Input::keyToChar(crouchkey)));
328 setText(5, (string)"Jump: " + (keyselect == 5 ? "_" : Input::keyToChar(jumpkey)));
329 setText(6, (string)"Draw: " + (keyselect == 6 ? "_" : Input::keyToChar(drawkey)));
330 setText(7, (string)"Throw: " + (keyselect == 7 ? "_" : Input::keyToChar(throwkey)));
331 setText(8, (string)"Attack: " + (keyselect == 8 ? "_" : Input::keyToChar(attackkey)));
333 setText(9, (string)"Console: " + (keyselect == 9 ? "_" : Input::keyToChar(consolekey)));
340 2 Menu pause (resume/end game)
342 4 Controls configuration menu
343 5 Main game menu (choose level or challenge)
345 7 User managment menu (select/add)
346 8 Choose difficulty menu
347 9 Challenge level selection menu
348 10 End of the campaign congratulation (is that really a menu?)
349 11 Same that 9 ??? => unused
350 18 stereo configuration
359 addImage(0, Mainmenuitems[0], 150, 480 - 128, 256, 128);
360 addButtonImage(1, Mainmenuitems[mainmenu == 1 ? 1 : 5], 18, 480 - 152 - 32, 128, 32);
361 addButtonImage(2, Mainmenuitems[2], 18, 480 - 228 - 32, 112, 32);
362 addButtonImage(3, Mainmenuitems[mainmenu == 1 ? 3 : 6], 18, 480 - 306 - 32, mainmenu == 1 ? 68 : 132, 32);
365 addButton( 0, "", 10 + 20, 440);
366 addButton(14, "", 10 + 400, 440);
367 addButton( 1, "", 10 + 60, 405);
368 addButton( 2, "", 10 + 70, 370);
369 addButton( 3, "", 10 + 20 - 1000, 335 - 1000);
370 addButton( 4, "", 10 , 335);
371 addButton( 5, "", 10 + 60, 300);
372 addButton( 6, "", 10 + 70, 265);
373 addButton( 9, "", 10 , 230);
374 addButton(10, "", 20 , 195);
375 addButton(11, "", 10 + 60, 160);
376 addButton(13, "", 30 , 125);
377 addButton( 7, "-Configure Controls-", 10 + 15, 90);
378 addButton(12, "-Configure Stereo -", 10 + 15, 55);
379 addButton(8, "Back", 10, 10);
380 updateSettingsMenu();
383 addButton(0, "", 10 , 400);
384 addButton(1, "", 10 + 40, 360);
385 addButton(2, "", 10 + 40, 320);
386 addButton(3, "", 10 + 30, 280);
387 addButton(4, "", 10 + 20, 240);
388 addButton(5, "", 10 + 40, 200);
389 addButton(6, "", 10 + 40, 160);
390 addButton(7, "", 10 + 30, 120);
391 addButton(8, "", 10 + 20, 80);
393 addButton(9, "", 10 + 10, 40);
395 addButton(devtools ? 10 : 9, "Back", 10, 10);
396 updateControlsMenu();
400 addLabel(-1, Account::active().getName(), 5, 400);
401 addButton(1, "Tutorial", 5, 300);
402 addButton(2, "Challenge", 5, 240);
403 addButton(3, "Delete User", 400, 10);
404 addButton(4, "Main Menu", 5, 10);
405 addButton(5, "Change User", 5, 180);
406 addButton(6, "Campaign : " + Account::active().getCurrentCampaign(), 200, 420);
409 //with (2,-5) offset from old code
410 addImage(-1, Mainmenuitems[7], 150 + 2, 60 - 5, 400, 400);
412 int numlevels = Account::active().getCampaignChoicesMade();
413 numlevels += numlevels > 0 ? campaignlevels[numlevels - 1].nextlevel.size() : 1;
414 for (int i = 0; i < numlevels; i++) {
415 XYZ midpoint = campaignlevels[i].getCenter();
416 float itemsize = campaignlevels[i].getWidth();
417 const bool active = (i >= Account::active().getCampaignChoicesMade());
423 XYZ start = campaignlevels[i - 1].getCenter();
424 addMapLine(start.x, start.y, midpoint.x - start.x, midpoint.y - start.y, 0.5, active ? 1 : 0.5, active ? 1 : 0.5, 0, 0);
426 addMapMarker(NB_CAMPAIGN_MENU_ITEM + i, Mapcircletexture,
427 midpoint.x - itemsize / 2, midpoint.y - itemsize / 2, itemsize, itemsize, active ? 1 : 0.5, 0, 0);
430 addMapLabel(-2, campaignlevels[i].description,
431 campaignlevels[i].getStartX() + 10,
432 campaignlevels[i].getStartY() - 4);
438 addLabel(-1, "Are you sure you want to delete this user?", 10, 400);
439 addButton(1, "Yes", 10, 360);
440 addButton(2, "No", 10, 320);
443 if (Account::getNbAccounts() < 8)
444 addButton(0, "New User", 10, 400);
446 addLabel(0, "No More Users", 10, 400);
447 addLabel(-2, "", 20, 400);
448 addButton(Account::getNbAccounts() + 1, "Back", 10, 10);
449 for (int i = 0; i < Account::getNbAccounts(); i++) {
450 addButton(i + 1, Account::get(i)->getName(), 10, 340 - 20 * (i + 1));
454 addButton(0, "Easier", 10, 400);
455 addButton(1, "Difficult", 10, 360);
456 addButton(2, "Insane", 10, 320);
459 for (int i = 0; i < numchallengelevels; i++) {
460 string name = "Level ";
461 name += to_string(i + 1);
462 if (name.size() < 17) {
463 name.append((17 - name.size()), ' ');
465 name += to_string(int(Account::active().getHighScore(i)));
466 if (name.size() < 32) {
467 name.append((32 - name.size()), ' ');
469 int fasttime = (int)round(Account::active().getFastTime(i));
470 name += to_string(int((fasttime - fasttime % 60) / 60));
472 if (fasttime % 60 < 10)
474 name += to_string(fasttime % 60);
476 addButton(i, name, 10, 400 - i * 25, i > Account::active().getProgress() ? 0.5 : 1, 0, 0);
479 addButton(-1, " High Score Best Time", 10, 440);
480 addButton(numchallengelevels, "Back", 10, 10);
483 addLabel(0, "Congratulations!", 220, 330);
484 addLabel(1, "You have avenged your family and", 140, 300);
485 addLabel(2, "restored peace to the island of Lugaru.", 110, 270);
486 addButton(3, "Back", 10, 10);
487 addLabel(4, string("Your score: ") + to_string((int)Account::active().getCampaignScore()), 190, 200);
488 addLabel(5, string("Highest score: ") + to_string((int)Account::active().getCampaignHighScore()), 190, 180);
492 addButton(0, "", 70, 400);
493 addButton(1, "", 10, 360);
494 addButton(2, "", 40, 320);
495 addButton(3, "Back", 10, 10);
496 updateStereoConfigMenu();
504 if (Input::isKeyPressed(SDL_SCANCODE_ESCAPE) &&
505 (mainmenu >= 3) && (mainmenu != 8) && !((mainmenu == 7) && entername)) {
507 //finished with settings menu
512 if (mainmenu >= 3 && mainmenu != 8) {
520 mainmenu = gameon ? 2 : 1;
536 selected = getSelected(mousecoordh * 640 / screenwidth, 480 - mousecoordv * 480 / screenheight);
538 // some specific case where we do something even if the left mouse button is not pressed.
539 if ((mainmenu == 5) && (endgame == 2)) {
540 Account::active().endGame();
545 if (mainmenu == 18 && Input::isKeyPressed(MOUSEBUTTON2) && selected == 1) {
546 stereoseparation -= 0.001;
547 updateStereoConfigMenu();
550 static int oldmainmenu = mainmenu;
552 if (Input::MouseClicked() && (selected >= 0)) { // handling of the left mouse clic in menus
553 set<pair<int,int>>::iterator newscreenresolution;
559 if (gameon) { //resume
561 pause_sound(stream_menutheme);
562 resume_stream(leveltheme);
564 fireSound(firestartsound);
566 mainmenu = (Account::hasActive() ? 5 : 7);
578 if (newscreenwidth > 3000)
579 newscreenwidth = screenwidth;
580 if (newscreenwidth < 0)
581 newscreenwidth = screenwidth;
582 if (newscreenheight > 3000)
583 newscreenheight = screenheight;
584 if (newscreenheight < 0)
585 newscreenheight = screenheight;
590 if (gameon) { //end game
595 pause_sound(stream_menutheme);
604 newscreenresolution = resolutions.find(make_pair(newscreenwidth, newscreenheight));
605 /* Next one (end() + 1 is also end() so the ++ is safe even if it was not found) */
606 newscreenresolution++;
607 if (newscreenresolution == resolutions.end()) {
608 /* It was the last one (or not found), go back to the beginning */
609 newscreenresolution = resolutions.begin();
611 newscreenwidth = newscreenresolution->first;
612 newscreenheight = newscreenresolution->second;
630 ismotionblur = !ismotionblur;
636 musictoggle = !musictoggle;
638 emit_stream_np(stream_menutheme);
640 pause_sound(leveltheme);
641 pause_sound(stream_fighttheme);
642 pause_sound(stream_menutheme);
644 for (int i = 0; i < 4; i++) {
645 oldmusicvolume[i] = 0;
659 mainmenu = gameon ? 2 : 1;
662 invertmouse = !invertmouse;
665 usermousesensitivity += .2;
666 if (usermousesensitivity > 2)
667 usermousesensitivity = .2;
671 if (volume > 1.0001f)
673 OPENAL_SetSFXMasterVolume((int)(volume * 255));
677 newstereomode = stereomode;
682 showdamagebar = !showdamagebar;
688 updateSettingsMenu();
693 if (selected < (devtools ? 10 : 9) && keyselect == -1)
694 keyselect = selected;
697 if (selected == (devtools ? 10 : 9)) {
702 updateControlsMenu();
707 if ((selected - NB_CAMPAIGN_MENU_ITEM >= Account::active().getCampaignChoicesMade())) {
717 whichchoice = selected - NB_CAMPAIGN_MENU_ITEM - Account::active().getCampaignChoicesMade();
718 actuallevel = (Account::active().getCampaignChoicesMade() > 0 ? campaignlevels[Account::active().getCampaignChoicesMade() - 1].nextlevel[whichchoice] : 0);
721 Loadlevel(campaignlevels[actuallevel].mapname.c_str());
725 pause_sound(stream_menutheme);
742 pause_sound(stream_menutheme);
751 mainmenu = (gameon ? 2 : 1);
757 vector<string> campaigns = ListCampaigns();
758 vector<string>::iterator c;
759 if ((c = find(campaigns.begin(), campaigns.end(), Account::active().getCurrentCampaign())) == campaigns.end()) {
760 if (!campaigns.empty())
761 Account::active().setCurrentCampaign(campaigns.front());
764 if (c == campaigns.end())
765 c = campaigns.begin();
766 Account::active().setCurrentCampaign(*c);
776 Account::destroyActive();
778 } else if (selected == 2) {
785 if (selected == 0 && Account::getNbAccounts() < 8) {
787 } else if (selected < Account::getNbAccounts() + 1) {
790 Account::setActive(selected - 1);
791 } else if (selected == Account::getNbAccounts() + 1) {
793 if (Account::hasActive()) {
798 displaytext[0].clear();
807 Account::active().setDifficulty(selected);
811 if (selected < numchallengelevels && selected <= Account::active().getProgress()) {
819 targetlevel = selected;
829 pause_sound(stream_menutheme);
831 if (selected == numchallengelevels) {
846 stereoseparation += 0.001;
850 newstereomode = (StereoMode)(newstereomode + 1);
851 while (!CanInitStereo(newstereomode)) {
852 printf("Failed to initialize mode %s (%i)\n", StereoModeName(newstereomode).c_str(), newstereomode);
853 newstereomode = (StereoMode)(newstereomode + 1);
854 if (newstereomode >= stereoCount)
855 newstereomode = stereoNone;
857 } else if (selected == 2) {
858 stereoreverse = !stereoreverse;
859 } else if (selected == 3) {
863 stereomode = newstereomode;
864 InitStereo(stereomode);
867 updateStereoConfigMenu();
872 OPENAL_SetFrequency(channels[stream_menutheme]);
875 inputText(displaytext[0], &displayselected);
876 if (!waiting) { // the input as finished
877 if (!displaytext[0].empty()) { // with enter
878 Account::add(string(displaytext[0]));
884 fireSound(firestartsound);
886 displaytext[0].clear();
894 displayblinkdelay -= multiplier;
895 if (displayblinkdelay <= 0) {
896 displayblinkdelay = .3;
897 displayblink = !displayblink;
902 setText(0, displaytext[0], 20, 400, -1, -1);
903 setText(-2, displayblink ? "_" : "", 20 + displayselected * 10, 400, -1, -1);
906 if (oldmainmenu != mainmenu)
908 oldmainmenu = mainmenu;
912 int setKeySelected_thread(void* data)
914 using namespace Game;
917 while (scancode == -1) {
918 SDL_WaitEvent(&evenement);
919 switch (evenement.type) {
921 scancode = evenement.key.keysym.scancode;
923 case SDL_MOUSEBUTTONDOWN:
924 scancode = SDL_NUM_SCANCODES + evenement.button.button;
930 if (scancode != SDL_SCANCODE_ESCAPE) {
934 forwardkey = scancode;
946 crouchkey = scancode;
958 attackkey = scancode;
961 consolekey = scancode;
973 void Menu::setKeySelected()
976 printf("launch thread\n");
977 SDL_Thread* thread = SDL_CreateThread(setKeySelected_thread, NULL, NULL);
978 if ( thread == NULL ) {
979 fprintf(stderr, "Unable to create thread: %s\n", SDL_GetError());