along with Lugaru. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <vector>
-#include <string>
-#include <set>
+#include "Menu/Menu.hpp"
-#include "Graphic/gamegl.h"
-#include "Level/Campaign.h"
-#include "Menu/Menu.h"
-#include "User/Settings.h"
-#include "Utils/Input.h"
+#include "Audio/openal_wrapper.hpp"
+#include "Graphic/gamegl.hpp"
+#include "Level/Campaign.hpp"
+#include "User/Settings.hpp"
+#include "Utils/Input.hpp"
// Should not be needed, Menu should call methods from other classes to launch maps and challenges and so on
-#include "Level/Awards.h"
-#include "Audio/openal_wrapper.h"
+#include "Level/Awards.hpp"
+
+#include <set>
+#include <string>
+#include <vector>
using namespace Game;
extern void toggleFullscreen();
int entername = 0;
+std::string newusername = "";
+unsigned newuserselected = 0;
+float newuserblinkdelay = 0;
+bool newuserblink = false;
std::vector<MenuItem> Menu::items;
int Menu::getSelected(int mousex, int mousey)
{
- for (vector<MenuItem>::iterator it = items.begin(); it != items.end(); it++)
+ for (vector<MenuItem>::reverse_iterator it = items.rbegin(); it != items.rend(); it++)
if (it->type == MenuItem::BUTTON || it->type == MenuItem::IMAGEBUTTON || it->type == MenuItem::MAPMARKER) {
int mx = mousex;
int my = mousey;
}
break;
case MenuItem::MAPLABEL:
- Game::text->glPrintOutlined(0.9, 0, 0, it->x, it->y, it->text.c_str(), 0, 0.6, 640, 480);
+ Game::text->glPrintOutlined(0.9, 0, 0, 1, it->x, it->y, it->text.c_str(), 0, 0.6, 640, 480);
break;
case MenuItem::MAPLINE: {
XYZ linestart;
}
if (mainmenu == 10)
endgame = 2;
- if (mainmenu == 18 && Input::isKeyPressed(MOUSEBUTTON2) && selected == 1) {
+ if (mainmenu == 18 && Input::isKeyPressed(MOUSEBUTTON_RIGHT) && selected == 1) {
stereoseparation -= 0.001;
updateStereoConfigMenu();
}
LoadStuff();
whichchoice = selected - NB_CAMPAIGN_MENU_ITEM - Account::active().getCampaignChoicesMade();
actuallevel = (Account::active().getCampaignChoicesMade() > 0 ? campaignlevels[Account::active().getCampaignChoicesMade() - 1].nextlevel[whichchoice] : 0);
- visibleloading = 1;
+ visibleloading = true;
stillloading = 1;
Loadlevel(campaignlevels[actuallevel].mapname.c_str());
campaign = 1;
} else {
mainmenu = 1;
}
- displaytext[0].clear();
- displayselected = 0;
+ newusername.clear();
+ newuserselected = 0;
entername = 0;
}
break;
OPENAL_SetFrequency(channels[stream_menutheme]);
if (entername) {
- inputText(displaytext[0], &displayselected);
+ inputText(newusername, &newuserselected);
if (!waiting) { // the input as finished
- if (!displaytext[0].empty()) { // with enter
- Account::add(string(displaytext[0]));
+ if (!newusername.empty()) { // with enter
+ Account::add(string(newusername));
mainmenu = 8;
fireSound(firestartsound);
- displaytext[0].clear();
+ newusername.clear();
- displayselected = 0;
+ newuserselected = 0;
}
entername = 0;
Load();
}
- displayblinkdelay -= multiplier;
- if (displayblinkdelay <= 0) {
- displayblinkdelay = .3;
- displayblink = !displayblink;
+ newuserblinkdelay -= multiplier;
+ if (newuserblinkdelay <= 0) {
+ newuserblinkdelay = .3;
+ newuserblink = !newuserblink;
}
}
if (entername) {
- setText(0, displaytext[0], 20, 400, -1, -1);
- setText(-2, displayblink ? "_" : "", 20 + displayselected * 10, 400, -1, -1);
+ setText(0, newusername, 20, 400, -1, -1);
+ setText(-2, newuserblink ? "_" : "", 20 + newuserselected * 10, 400, -1, -1);
}
if (oldmainmenu != mainmenu)