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/>.
21 #include "Menu/Menu.hpp"
23 #include "Audio/openal_wrapper.hpp"
24 #include "Graphic/gamegl.hpp"
25 #include "Level/Campaign.hpp"
26 #include "User/Settings.hpp"
27 #include "Utils/Input.hpp"
29 // Should not be needed, Menu should call methods from other classes to launch maps and challenges and so on
30 #include "Level/Awards.hpp"
38 extern float multiplier;
39 extern std::set<std::pair<int,int>> resolutions;
41 extern std::vector<CampaignLevel> campaignlevels;
42 extern float musicvolume[4];
43 extern float oldmusicvolume[4];
44 extern bool stillloading;
45 extern bool visibleloading;
46 extern int whichchoice;
47 extern int leveltheme;
49 extern void toggleFullscreen();
53 std::vector<MenuItem> Menu::items;
55 MenuItem::MenuItem(MenuItemType _type, int _id, const string& _text, Texture _texture,
56 int _x, int _y, int _w, int _h, float _r, float _g, float _b,
57 float _linestartsize, float _lineendsize):
70 linestartsize(_linestartsize),
71 lineendsize(_lineendsize)
73 if (type == MenuItem::BUTTON) {
75 w = text.length() * 10;
83 void Menu::clearMenu()
88 void Menu::addLabel(int id, const string& text, int x, int y, float r, float g, float b)
90 items.emplace_back(MenuItem::LABEL, id, text, Texture(), x, y, -1, -1, r, g, b);
92 void Menu::addButton(int id, const string& text, int x, int y, float r, float g, float b)
94 items.emplace_back(MenuItem::BUTTON, id, text, Texture(), x, y, -1, -1, r, g, b);
96 void Menu::addImage(int id, Texture texture, int x, int y, int w, int h, float r, float g, float b)
98 items.emplace_back(MenuItem::IMAGE, id, "", texture, x, y, w, h, r, g, b);
100 void Menu::addButtonImage(int id, Texture texture, int x, int y, int w, int h, float r, float g, float b)
102 items.emplace_back(MenuItem::IMAGEBUTTON, id, "", texture, x, y, w, h, r, g, b);
104 void Menu::addMapLine(int x, int y, int w, int h, float startsize, float endsize, float r, float g, float b)
106 items.emplace_back(MenuItem::MAPLINE, -1, "", Texture(), x, y, w, h, r, g, b, startsize, endsize);
108 void Menu::addMapMarker(int id, Texture texture, int x, int y, int w, int h, float r, float g, float b)
110 items.emplace_back(MenuItem::MAPMARKER, id, "", texture, x, y, w, h, r, g, b);
112 void Menu::addMapLabel(int id, const string& text, int x, int y, float r, float g, float b)
114 items.emplace_back(MenuItem::MAPLABEL, id, text, Texture(), x, y, -1, -1, r, g, b);
117 void Menu::setText(int id, const string& text)
119 for (vector<MenuItem>::iterator it = items.begin(); it != items.end(); it++)
122 it->w = it->text.length() * 10;
127 void Menu::setText(int id, const string& text, int x, int y, int w, int h)
129 for (vector<MenuItem>::iterator it = items.begin(); it != items.end(); it++)
135 it->w = it->text.length() * 10;
142 int Menu::getSelected(int mousex, int mousey)
144 for (vector<MenuItem>::iterator it = items.begin(); it != items.end(); it++)
145 if (it->type == MenuItem::BUTTON || it->type == MenuItem::IMAGEBUTTON || it->type == MenuItem::MAPMARKER) {
148 if (it->type == MenuItem::MAPMARKER) {
152 if (mx >= it->x && mx < it->x + it->w && my >= it->y && my < it->y + it->h)
158 void Menu::handleFadeEffect()
160 for (vector<MenuItem>::iterator it = items.begin(); it != items.end(); it++) {
161 if (it->id == Game::selected) {
162 it->effectfade += multiplier * 5;
163 if (it->effectfade > 1)
166 it->effectfade -= multiplier * 5;
167 if (it->effectfade < 0)
173 void Menu::drawItems()
176 glEnable(GL_TEXTURE_2D);
177 glEnable(GL_ALPHA_TEST);
179 for (vector<MenuItem>::iterator it = items.begin(); it != items.end(); it++) {
181 case MenuItem::IMAGE:
182 case MenuItem::IMAGEBUTTON:
183 case MenuItem::MAPMARKER:
184 glColor4f(it->r, it->g, it->b, 1);
186 if (it->type == MenuItem::MAPMARKER) {
187 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
188 glTranslatef(2.5, -4.5, 0); //from old code
190 glBlendFunc(GL_SRC_ALPHA, GL_ONE);
193 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
194 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
197 glVertex3f(it->x, it->y, 0);
199 glVertex3f(it->x + it->w, it->y, 0);
201 glVertex3f(it->x + it->w, it->y + it->h, 0);
203 glVertex3f(it->x, it->y + it->h, 0);
205 if (it->type != MenuItem::IMAGE) {
206 //mouseover highlight
207 for (int i = 0; i < 10; i++) {
208 if (1 - ((float)i) / 10 - (1 - it->effectfade) > 0) {
209 glColor4f(it->r, it->g, it->b, (1 - ((float)i) / 10 - (1 - it->effectfade))*.25);
212 glVertex3f(it->x - ((float)i) * 1 / 2, it->y - ((float)i) * 1 / 2, 0);
214 glVertex3f(it->x + it->w + ((float)i) * 1 / 2, it->y - ((float)i) * 1 / 2, 0);
216 glVertex3f(it->x + it->w + ((float)i) * 1 / 2, it->y + it->h + ((float)i) * 1 / 2, 0);
218 glVertex3f(it->x - ((float)i) * 1 / 2, it->y + it->h + ((float)i) * 1 / 2, 0);
225 case MenuItem::LABEL:
226 case MenuItem::BUTTON:
227 glColor4f(it->r, it->g, it->b, 1);
228 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
229 Game::text->glPrint(it->x, it->y, it->text.c_str(), 0, 1, 640, 480);
230 if (it->type != MenuItem::LABEL) {
231 //mouseover highlight
232 glBlendFunc(GL_SRC_ALPHA, GL_ONE);
233 for (int i = 0; i < 15; i++) {
234 if (1 - ((float)i) / 15 - (1 - it->effectfade) > 0) {
235 glColor4f(it->r, it->g, it->b, (1 - ((float)i) / 10 - (1 - it->effectfade))*.25);
236 Game::text->glPrint(it->x - ((float)i), it->y, it->text.c_str(), 0, 1 + ((float)i) / 70, 640, 480);
241 case MenuItem::MAPLABEL:
242 Game::text->glPrintOutlined(0.9, 0, 0, it->x, it->y, it->text.c_str(), 0, 0.6, 640, 480);
244 case MenuItem::MAPLINE: {
250 lineend.x = it->x + it->w;
251 lineend.y = it->y + it->h;
253 XYZ offset = lineend - linestart;
256 offset = DoRotation(offset, 0, 0, 90);
259 linestart += fac * 4 * it->linestartsize;
260 lineend -= fac * 4 * it->lineendsize;
262 glDisable(GL_TEXTURE_2D);
263 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
264 glColor4f(it->r, it->g, it->b, 1);
266 glTranslatef(2, -5, 0); //from old code
268 glVertex3f(linestart.x - offset.x * it->linestartsize, linestart.y - offset.y * it->linestartsize, 0.0f);
269 glVertex3f(linestart.x + offset.x * it->linestartsize, linestart.y + offset.y * it->linestartsize, 0.0f);
270 glVertex3f(lineend.x + offset.x * it->lineendsize, lineend.y + offset.y * it->lineendsize, 0.0f);
271 glVertex3f(lineend.x - offset.x * it->lineendsize, lineend.y - offset.y * it->lineendsize, 0.0f);
274 glEnable(GL_TEXTURE_2D);
284 void Menu::updateSettingsMenu()
286 std::string sbuf = std::string("Resolution: ") + to_string(newscreenwidth) + "*" + to_string(newscreenheight);
287 if (((float)newscreenwidth <= (float)newscreenheight * 1.61) && ((float)newscreenwidth >= (float)newscreenheight * 1.59)) {
288 sbuf += " (widescreen)";
291 setText(14, fullscreen ? "Fullscreen: On" : "Fullscreen: Off");
292 if (newdetail == 0) setText(1, "Detail: Low");
293 if (newdetail == 1) setText(1, "Detail: Medium");
294 if (newdetail == 2) setText(1, "Detail: High");
295 if (bloodtoggle == 0) setText(2, "Blood: Off");
296 if (bloodtoggle == 1) setText(2, "Blood: On, low detail");
297 if (bloodtoggle == 2) setText(2, "Blood: On, high detail (slower)");
298 setText(4, ismotionblur ? "Blur Effects: Enabled (less compatible)" : "Blur Effects: Disabled (more compatible)");
299 setText(5, decals ? "Decals: Enabled (slower)" : "Decals: Disabled");
300 setText(6, musictoggle ? "Music: Enabled" : "Music: Disabled");
301 setText(9, invertmouse ? "Invert mouse: Yes" : "Invert mouse: No");
302 setText(10, std::string("Mouse Speed: ") + to_string(int(usermousesensitivity * 5)));
303 setText(11, std::string("Volume: ") + to_string(int(volume * 100)) + "%");
304 setText(13, showdamagebar ? "Damage Bar: On" : "Damage Bar: Off");
305 if ((newdetail == detail) && (newscreenheight == (int)screenheight) && (newscreenwidth == (int)screenwidth)) {
308 setText(8, "Back (some changes take effect next time Lugaru is opened)");
312 void Menu::updateStereoConfigMenu()
314 setText(0, std::string("Stereo mode: ") + StereoModeName(newstereomode));
315 setText(1, std::string("Stereo separation: ") + to_string(stereoseparation));
316 setText(2, std::string("Reverse stereo: ") + (stereoreverse ? "Yes" : "No"));
319 void Menu::updateControlsMenu()
321 setText(0, (string)"Forwards: " + (keyselect == 0 ? "_" : Input::keyToChar(forwardkey)));
322 setText(1, (string)"Back: " + (keyselect == 1 ? "_" : Input::keyToChar(backkey)));
323 setText(2, (string)"Left: " + (keyselect == 2 ? "_" : Input::keyToChar(leftkey)));
324 setText(3, (string)"Right: " + (keyselect == 3 ? "_" : Input::keyToChar(rightkey)));
325 setText(4, (string)"Crouch: " + (keyselect == 4 ? "_" : Input::keyToChar(crouchkey)));
326 setText(5, (string)"Jump: " + (keyselect == 5 ? "_" : Input::keyToChar(jumpkey)));
327 setText(6, (string)"Draw: " + (keyselect == 6 ? "_" : Input::keyToChar(drawkey)));
328 setText(7, (string)"Throw: " + (keyselect == 7 ? "_" : Input::keyToChar(throwkey)));
329 setText(8, (string)"Attack: " + (keyselect == 8 ? "_" : Input::keyToChar(attackkey)));
331 setText(9, (string)"Console: " + (keyselect == 9 ? "_" : Input::keyToChar(consolekey)));
338 2 Menu pause (resume/end game)
340 4 Controls configuration menu
341 5 Main game menu (choose level or challenge)
343 7 User managment menu (select/add)
344 8 Choose difficulty menu
345 9 Challenge level selection menu
346 10 End of the campaign congratulation (is that really a menu?)
347 11 Same that 9 ??? => unused
348 18 stereo configuration
357 addImage(0, Mainmenuitems[0], 150, 480 - 128, 256, 128);
358 addButtonImage(1, Mainmenuitems[mainmenu == 1 ? 1 : 5], 18, 480 - 152 - 32, 128, 32);
359 addButtonImage(2, Mainmenuitems[2], 18, 480 - 228 - 32, 112, 32);
360 addButtonImage(3, Mainmenuitems[mainmenu == 1 ? 3 : 6], 18, 480 - 306 - 32, mainmenu == 1 ? 68 : 132, 32);
363 addButton( 0, "", 10 + 20, 440);
364 addButton(14, "", 10 + 400, 440);
365 addButton( 1, "", 10 + 60, 405);
366 addButton( 2, "", 10 + 70, 370);
367 addButton( 4, "", 10 , 335);
368 addButton( 5, "", 10 + 60, 300);
369 addButton( 6, "", 10 + 70, 265);
370 addButton( 9, "", 10 , 230);
371 addButton(10, "", 20 , 195);
372 addButton(11, "", 10 + 60, 160);
373 addButton(13, "", 30 , 125);
374 addButton( 7, "-Configure Controls-", 10 + 15, 90);
375 addButton(12, "-Configure Stereo -", 10 + 15, 55);
376 addButton(8, "Back", 10, 10);
377 updateSettingsMenu();
380 addButton(0, "", 10 , 400);
381 addButton(1, "", 10 + 40, 360);
382 addButton(2, "", 10 + 40, 320);
383 addButton(3, "", 10 + 30, 280);
384 addButton(4, "", 10 + 20, 240);
385 addButton(5, "", 10 + 40, 200);
386 addButton(6, "", 10 + 40, 160);
387 addButton(7, "", 10 + 30, 120);
388 addButton(8, "", 10 + 20, 80);
390 addButton(9, "", 10 + 10, 40);
392 addButton(devtools ? 10 : 9, "Back", 10, 10);
393 updateControlsMenu();
397 addLabel(-1, Account::active().getName(), 5, 400);
398 addButton(1, "Tutorial", 5, 300);
399 addButton(2, "Challenge", 5, 240);
400 addButton(3, "Delete User", 400, 10);
401 addButton(4, "Main Menu", 5, 10);
402 addButton(5, "Change User", 5, 180);
403 addButton(6, "Campaign : " + Account::active().getCurrentCampaign(), 200, 420);
406 //with (2,-5) offset from old code
407 addImage(-1, Mainmenuitems[7], 150 + 2, 60 - 5, 400, 400);
409 int numlevels = Account::active().getCampaignChoicesMade();
410 numlevels += numlevels > 0 ? campaignlevels[numlevels - 1].nextlevel.size() : 1;
411 for (int i = 0; i < numlevels; i++) {
412 XYZ midpoint = campaignlevels[i].getCenter();
413 float itemsize = campaignlevels[i].getWidth();
414 const bool active = (i >= Account::active().getCampaignChoicesMade());
420 XYZ start = campaignlevels[i - 1].getCenter();
421 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);
423 addMapMarker(NB_CAMPAIGN_MENU_ITEM + i, Mapcircletexture,
424 midpoint.x - itemsize / 2, midpoint.y - itemsize / 2, itemsize, itemsize, active ? 1 : 0.5, 0, 0);
427 addMapLabel(-2, campaignlevels[i].description,
428 campaignlevels[i].getStartX() + 10,
429 campaignlevels[i].getStartY() - 4);
435 addLabel(-1, "Are you sure you want to delete this user?", 10, 400);
436 addButton(1, "Yes", 10, 360);
437 addButton(2, "No", 10, 320);
440 if (Account::getNbAccounts() < 8)
441 addButton(0, "New User", 10, 400);
443 addLabel(0, "No More Users", 10, 400);
444 addLabel(-2, "", 20, 400);
445 addButton(Account::getNbAccounts() + 1, "Back", 10, 10);
446 for (int i = 0; i < Account::getNbAccounts(); i++) {
447 addButton(i + 1, Account::get(i).getName(), 10, 340 - 20 * (i + 1));
451 addButton(0, "Easier", 10, 400);
452 addButton(1, "Difficult", 10, 360);
453 addButton(2, "Insane", 10, 320);
456 for (int i = 0; i < numchallengelevels; i++) {
457 string name = "Level ";
458 name += to_string(i + 1);
459 if (name.size() < 17) {
460 name.append((17 - name.size()), ' ');
462 name += to_string(int(Account::active().getHighScore(i)));
463 if (name.size() < 32) {
464 name.append((32 - name.size()), ' ');
466 int fasttime = (int)round(Account::active().getFastTime(i));
467 name += to_string(int((fasttime - fasttime % 60) / 60));
469 if (fasttime % 60 < 10)
471 name += to_string(fasttime % 60);
473 addButton(i, name, 10, 400 - i * 25, i > Account::active().getProgress() ? 0.5 : 1, 0, 0);
476 addButton(-1, " High Score Best Time", 10, 440);
477 addButton(numchallengelevels, "Back", 10, 10);
480 addLabel(0, "Congratulations!", 220, 330);
481 addLabel(1, "You have avenged your family and", 140, 300);
482 addLabel(2, "restored peace to the island of Lugaru.", 110, 270);
483 addButton(3, "Back", 10, 10);
484 addLabel(4, string("Your score: ") + to_string((int)Account::active().getCampaignScore()), 190, 200);
485 addLabel(5, string("Highest score: ") + to_string((int)Account::active().getCampaignHighScore()), 190, 180);
489 addButton(0, "", 70, 400);
490 addButton(1, "", 10, 360);
491 addButton(2, "", 40, 320);
492 addButton(3, "Back", 10, 10);
493 updateStereoConfigMenu();
501 if (Input::isKeyPressed(SDL_SCANCODE_ESCAPE) &&
502 (mainmenu >= 3) && (mainmenu != 8) && !((mainmenu == 7) && entername)) {
504 //finished with settings menu
509 if (mainmenu >= 3 && mainmenu != 8) {
517 mainmenu = gameon ? 2 : 1;
533 selected = getSelected(mousecoordh * 640 / screenwidth, 480 - mousecoordv * 480 / screenheight);
535 // some specific case where we do something even if the left mouse button is not pressed.
536 if ((mainmenu == 5) && (endgame == 2)) {
537 Account::active().endGame();
542 if (mainmenu == 18 && Input::isKeyPressed(MOUSEBUTTON2) && selected == 1) {
543 stereoseparation -= 0.001;
544 updateStereoConfigMenu();
547 static int oldmainmenu = mainmenu;
549 if (Input::MouseClicked() && (selected >= 0)) { // handling of the left mouse clic in menus
550 set<pair<int,int>>::iterator newscreenresolution;
556 if (gameon) { //resume
558 pause_sound(stream_menutheme);
559 resume_stream(leveltheme);
561 fireSound(firestartsound);
563 mainmenu = (Account::hasActive() ? 5 : 7);
575 if (newscreenwidth > 3000)
576 newscreenwidth = screenwidth;
577 if (newscreenwidth < 0)
578 newscreenwidth = screenwidth;
579 if (newscreenheight > 3000)
580 newscreenheight = screenheight;
581 if (newscreenheight < 0)
582 newscreenheight = screenheight;
587 if (gameon) { //end game
592 pause_sound(stream_menutheme);
601 newscreenresolution = resolutions.find(make_pair(newscreenwidth, newscreenheight));
602 /* Next one (end() + 1 is also end() so the ++ is safe even if it was not found) */
603 newscreenresolution++;
604 if (newscreenresolution == resolutions.end()) {
605 /* It was the last one (or not found), go back to the beginning */
606 newscreenresolution = resolutions.begin();
608 newscreenwidth = newscreenresolution->first;
609 newscreenheight = newscreenresolution->second;
622 ismotionblur = !ismotionblur;
628 musictoggle = !musictoggle;
630 emit_stream_np(stream_menutheme);
632 pause_sound(leveltheme);
633 pause_sound(stream_fighttheme);
634 pause_sound(stream_menutheme);
636 for (int i = 0; i < 4; i++) {
637 oldmusicvolume[i] = 0;
651 mainmenu = gameon ? 2 : 1;
654 invertmouse = !invertmouse;
657 usermousesensitivity += .2;
658 if (usermousesensitivity > 2)
659 usermousesensitivity = .2;
663 if (volume > 1.0001f)
665 OPENAL_SetSFXMasterVolume((int)(volume * 255));
669 newstereomode = stereomode;
674 showdamagebar = !showdamagebar;
680 updateSettingsMenu();
685 if (selected < (devtools ? 10 : 9) && keyselect == -1)
686 keyselect = selected;
689 if (selected == (devtools ? 10 : 9)) {
694 updateControlsMenu();
699 if ((selected - NB_CAMPAIGN_MENU_ITEM >= Account::active().getCampaignChoicesMade())) {
709 whichchoice = selected - NB_CAMPAIGN_MENU_ITEM - Account::active().getCampaignChoicesMade();
710 actuallevel = (Account::active().getCampaignChoicesMade() > 0 ? campaignlevels[Account::active().getCampaignChoicesMade() - 1].nextlevel[whichchoice] : 0);
713 Loadlevel(campaignlevels[actuallevel].mapname.c_str());
717 pause_sound(stream_menutheme);
734 pause_sound(stream_menutheme);
743 mainmenu = (gameon ? 2 : 1);
749 vector<string> campaigns = ListCampaigns();
750 vector<string>::iterator c;
751 if ((c = find(campaigns.begin(), campaigns.end(), Account::active().getCurrentCampaign())) == campaigns.end()) {
752 if (!campaigns.empty())
753 Account::active().setCurrentCampaign(campaigns.front());
756 if (c == campaigns.end())
757 c = campaigns.begin();
758 Account::active().setCurrentCampaign(*c);
768 Account::destroyActive();
770 } else if (selected == 2) {
777 if (selected == 0 && Account::getNbAccounts() < 8) {
779 } else if (selected < Account::getNbAccounts() + 1) {
782 Account::setActive(selected - 1);
783 } else if (selected == Account::getNbAccounts() + 1) {
785 if (Account::hasActive()) {
790 displaytext[0].clear();
799 Account::active().setDifficulty(selected);
803 if (selected < numchallengelevels && selected <= Account::active().getProgress()) {
811 targetlevel = selected;
821 pause_sound(stream_menutheme);
823 if (selected == numchallengelevels) {
838 stereoseparation += 0.001;
842 newstereomode = (StereoMode)(newstereomode + 1);
843 while (!CanInitStereo(newstereomode)) {
844 printf("Failed to initialize mode %s (%i)\n", StereoModeName(newstereomode).c_str(), newstereomode);
845 newstereomode = (StereoMode)(newstereomode + 1);
846 if (newstereomode >= stereoCount)
847 newstereomode = stereoNone;
849 } else if (selected == 2) {
850 stereoreverse = !stereoreverse;
851 } else if (selected == 3) {
855 stereomode = newstereomode;
856 InitStereo(stereomode);
859 updateStereoConfigMenu();
864 OPENAL_SetFrequency(channels[stream_menutheme]);
867 inputText(displaytext[0], &displayselected);
868 if (!waiting) { // the input as finished
869 if (!displaytext[0].empty()) { // with enter
870 Account::add(string(displaytext[0]));
876 fireSound(firestartsound);
878 displaytext[0].clear();
886 displayblinkdelay -= multiplier;
887 if (displayblinkdelay <= 0) {
888 displayblinkdelay = .3;
889 displayblink = !displayblink;
894 setText(0, displaytext[0], 20, 400, -1, -1);
895 setText(-2, displayblink ? "_" : "", 20 + displayselected * 10, 400, -1, -1);
898 if (oldmainmenu != mainmenu)
900 oldmainmenu = mainmenu;
904 int setKeySelected_thread(void* data)
906 using namespace Game;
909 while (scancode == -1) {
910 SDL_WaitEvent(&evenement);
911 switch (evenement.type) {
913 scancode = evenement.key.keysym.scancode;
915 case SDL_MOUSEBUTTONDOWN:
916 scancode = SDL_NUM_SCANCODES + evenement.button.button;
922 if (scancode != SDL_SCANCODE_ESCAPE) {
926 forwardkey = scancode;
938 crouchkey = scancode;
950 attackkey = scancode;
953 consolekey = scancode;
965 void Menu::setKeySelected()
968 printf("launch thread\n");
969 SDL_Thread* thread = SDL_CreateThread(setKeySelected_thread, NULL, NULL);
970 if ( thread == NULL ) {
971 fprintf(stderr, "Unable to create thread: %s\n", SDL_GetError());