]> git.lizzy.rs Git - minetest.git/blob - src/guiMainMenu.h
Fix addon and configuration file paths
[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 enum
31 {
32         GUI_ID_QUIT_BUTTON = 101,
33         GUI_ID_NAME_INPUT,
34         GUI_ID_ADDRESS_INPUT,
35         GUI_ID_PORT_INPUT,
36         GUI_ID_FANCYTREE_CB,
37         GUI_ID_SMOOTH_LIGHTING_CB,
38         GUI_ID_3D_CLOUDS_CB,
39         GUI_ID_OPAQUE_WATER_CB,
40         GUI_ID_DAMAGE_CB,
41         GUI_ID_CREATIVE_CB,
42         GUI_ID_JOIN_GAME_BUTTON,
43         GUI_ID_CHANGE_KEYS_BUTTON,
44         GUI_ID_DELETE_MAP_BUTTON
45 };
46
47 struct MainMenuData
48 {
49         MainMenuData():
50                 // Client opts
51                 fancy_trees(false),
52                 smooth_lighting(false),
53                 // Server opts
54                 creative_mode(false),
55                 enable_damage(false),
56                 // Actions
57                 delete_map(false)
58         {}
59
60         // These are in the native format of the gui elements
61         
62         // Client options
63         std::wstring address;
64         std::wstring port;
65         std::wstring name;
66         std::wstring password;
67         bool fancy_trees;
68         bool smooth_lighting;
69         bool clouds_3d;
70         bool opaque_water;
71         // Server options
72         bool creative_mode;
73         bool enable_damage;
74         // If map deletion is requested, this is set to true
75         bool delete_map;
76 };
77
78 class GUIMainMenu : public GUIModalMenu
79 {
80 public:
81         GUIMainMenu(gui::IGUIEnvironment* env,
82                         gui::IGUIElement* parent, s32 id,
83                         IMenuManager *menumgr,
84                         MainMenuData *data,
85                         IGameCallback *gamecallback);
86         ~GUIMainMenu();
87         
88         void removeChildren();
89         /*
90                 Remove and re-add (or reposition) stuff
91         */
92         void regenerateGui(v2u32 screensize);
93
94         void drawMenu();
95
96         void acceptInput();
97
98         bool getStatus()
99         {
100                 return m_accepted;
101         }
102
103         bool OnEvent(const SEvent& event);
104         
105 private:
106         MainMenuData *m_data;
107         bool m_accepted;
108         IGameCallback *m_gamecallback;
109
110         gui::IGUIEnvironment* env;
111         gui::IGUIElement* parent;
112         s32 id;
113         IMenuManager *menumgr;
114 };
115
116 #endif
117