updated menu a bit, and some other small fixes
[oweals/minetest.git] / src / guiMainMenu.h
1 /*
2 Minetest-c55
3 Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #ifndef GUIMAINMENU_HEADER
21 #define GUIMAINMENU_HEADER
22
23 #include "common_irrlicht.h"
24 #include "modalMenu.h"
25 #include "utility.h"
26 #include <string>
27 // For IGameCallback
28 #include "guiPauseMenu.h"
29
30 struct MainMenuData
31 {
32         MainMenuData():
33                 // Client opts
34                 fancy_trees(false),
35                 smooth_lighting(false),
36                 // Server opts
37                 creative_mode(false),
38                 enable_damage(false),
39                 // Actions
40                 delete_map(false)
41         {}
42
43         // These are in the native format of the gui elements
44         
45         // Client options
46         std::wstring address;
47         std::wstring port;
48         std::wstring name;
49         bool fancy_trees;
50         bool smooth_lighting;
51         // Server options
52         bool creative_mode;
53         bool enable_damage;
54         // If map deletion is requested, this is set to true
55         bool delete_map;
56 };
57
58 class GUIMainMenu : public GUIModalMenu
59 {
60 public:
61         GUIMainMenu(gui::IGUIEnvironment* env,
62                         gui::IGUIElement* parent, s32 id,
63                         IMenuManager *menumgr,
64                         MainMenuData *data,
65                         IGameCallback *gamecallback);
66         ~GUIMainMenu();
67         
68         void removeChildren();
69         /*
70                 Remove and re-add (or reposition) stuff
71         */
72         void regenerateGui(v2u32 screensize);
73
74         void drawMenu();
75
76         void acceptInput();
77
78         bool getStatus()
79         {
80                 return m_accepted;
81         }
82
83         bool OnEvent(const SEvent& event);
84         
85 private:
86         MainMenuData *m_data;
87         bool m_accepted;
88         IGameCallback *m_gamecallback;
89 };
90
91 #endif
92