-#include <vector>
-#include <string>
-#include "gamegl.h"
-
-#include "Menu.h"
-using namespace Menu;
+/*
+Copyright (C) 2003, 2010 - Wolfire Games
+Copyright (C) 2010-2016 - Lugaru contributors (see AUTHORS file)
-extern float multiplier;
+This file is part of Lugaru.
-struct MenuItem {
- enum MenuItemType {NONE, LABEL, BUTTON, IMAGE, IMAGEBUTTON, MAPMARKER, MAPLINE, MAPLABEL} type;
- int id;
- string text;
- Texture texture;
- int x, y, w, h;
- float r, g, b;
- float effectfade;
+Lugaru is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
- float linestartsize;
- float lineendsize;
+Lugaru is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
- void init(MenuItemType _type, int _id, const string& _text, Texture _texture,
- int _x, int _y, int _w, int _h, float _r, float _g, float _b,
- float _linestartsize = 1, float _lineendsize = 1) {
- type = _type;
- id = _id;
- text = _text;
- texture = _texture;
- x = _x;
- y = _y;
- w = _w;
- h = _h;
- r = _r;
- g = _g;
- b = _b;
- effectfade = 0;
- linestartsize = _linestartsize;
- lineendsize = _lineendsize;
- if (type == MenuItem::BUTTON) {
- if (w == -1)
- w = text.length() * 10;
- if (h == -1)
- h = 20;
- }
- }
-};
+You should have received a copy of the GNU General Public License
+along with Lugaru. If not, see <http://www.gnu.org/licenses/>.
+*/
-vector<MenuItem> items;
+#include <vector>
+#include <string>
+#include "gamegl.h"
+#include "Menu.h"
+extern float multiplier;
+std::vector<MenuItem> Menu::items;
void Menu::clearMenu()
{
return -1;
}
-void GUITick()
+void Menu::handleFadeEffect()
{
for (vector<MenuItem>::iterator it = items.begin(); it != items.end(); it++) {
if (it->id == Game::selected) {
void Menu::drawItems()
{
- GUITick();
+ handleFadeEffect();
glEnable(GL_TEXTURE_2D);
glEnable(GL_ALPHA_TEST);
glEnable(GL_BLEND);
glEnable(GL_TEXTURE_2D);
}
break;
+ default:
+ case MenuItem::NONE:
+ break;
}
}
}