2011-01-23 10:29:15 -05:00
|
|
|
/*
|
2013-02-24 12:40:43 -05:00
|
|
|
Minetest
|
2013-02-24 13:38:45 -05:00
|
|
|
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
|
2011-01-23 10:29:15 -05:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
2012-06-05 10:56:56 -04:00
|
|
|
it under the terms of the GNU Lesser General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2.1 of the License, or
|
2011-01-23 10:29:15 -05:00
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program 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
|
2012-06-05 10:56:56 -04:00
|
|
|
GNU Lesser General Public License for more details.
|
2011-01-23 10:29:15 -05:00
|
|
|
|
2012-06-05 10:56:56 -04:00
|
|
|
You should have received a copy of the GNU Lesser General Public License along
|
2011-01-23 10:29:15 -05:00
|
|
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GUIMAINMENU_HEADER
|
|
|
|
#define GUIMAINMENU_HEADER
|
|
|
|
|
2012-06-16 21:00:31 -04:00
|
|
|
#include "irrlichttypes_extrabloated.h"
|
2011-01-23 10:29:15 -05:00
|
|
|
#include "modalMenu.h"
|
|
|
|
#include <string>
|
2012-03-11 14:45:14 -04:00
|
|
|
#include <list>
|
2012-03-12 18:06:37 -04:00
|
|
|
#include "subgame.h"
|
2012-12-25 06:20:51 -05:00
|
|
|
#include "serverlist.h"
|
|
|
|
|
2012-03-12 18:06:37 -04:00
|
|
|
class IGameCallback;
|
2011-06-01 13:44:07 -04:00
|
|
|
|
2011-01-23 10:29:15 -05:00
|
|
|
struct MainMenuData
|
|
|
|
{
|
|
|
|
// These are in the native format of the gui elements
|
2012-03-15 08:17:05 -04:00
|
|
|
// Generic
|
|
|
|
int selected_tab;
|
2011-04-24 08:37:41 -04:00
|
|
|
// Client options
|
2012-12-25 06:20:51 -05:00
|
|
|
std::string servername;
|
|
|
|
std::string serverdescription;
|
2011-01-23 10:29:15 -05:00
|
|
|
std::wstring address;
|
|
|
|
std::wstring port;
|
|
|
|
std::wstring name;
|
2011-05-20 15:28:03 -04:00
|
|
|
std::wstring password;
|
2011-04-24 08:37:41 -04:00
|
|
|
bool fancy_trees;
|
|
|
|
bool smooth_lighting;
|
2011-11-02 06:50:21 -04:00
|
|
|
bool clouds_3d;
|
2011-11-03 17:06:57 -04:00
|
|
|
bool opaque_water;
|
2012-11-04 10:51:40 -05:00
|
|
|
bool mip_map;
|
|
|
|
bool anisotropic_filter;
|
|
|
|
bool bilinear_filter;
|
|
|
|
bool trilinear_filter;
|
2012-12-01 17:08:35 -05:00
|
|
|
int enable_shaders;
|
|
|
|
bool preload_item_visuals;
|
2012-12-31 13:33:36 -05:00
|
|
|
bool enable_particles;
|
2013-03-23 09:37:50 -04:00
|
|
|
bool liquid_finite;
|
2011-04-24 08:37:41 -04:00
|
|
|
// Server options
|
2011-01-23 10:29:15 -05:00
|
|
|
bool creative_mode;
|
2011-04-23 17:11:23 -04:00
|
|
|
bool enable_damage;
|
2013-02-21 17:00:44 -05:00
|
|
|
bool enable_public;
|
2012-03-11 14:45:14 -04:00
|
|
|
int selected_world;
|
2012-03-15 09:20:20 -04:00
|
|
|
bool simple_singleplayer_mode;
|
2012-03-12 18:06:37 -04:00
|
|
|
// Actions
|
|
|
|
std::wstring create_world_name;
|
|
|
|
std::string create_world_gameid;
|
2012-03-25 19:19:41 -04:00
|
|
|
bool only_refresh;
|
2012-03-11 14:45:14 -04:00
|
|
|
|
2012-12-25 06:20:51 -05:00
|
|
|
bool serverlist_show_available; // if false show local favorites only
|
|
|
|
|
2012-03-12 18:48:02 -04:00
|
|
|
std::vector<WorldSpec> worlds;
|
2012-03-12 18:06:37 -04:00
|
|
|
std::vector<SubgameSpec> games;
|
2012-12-25 06:20:51 -05:00
|
|
|
std::vector<ServerListSpec> servers;
|
2012-03-12 18:06:37 -04:00
|
|
|
|
|
|
|
MainMenuData():
|
2012-03-15 08:17:05 -04:00
|
|
|
// Generic
|
2013-03-23 09:37:50 -04:00
|
|
|
selected_tab(
|
|
|
|
#if USE_CURL
|
|
|
|
1
|
|
|
|
#else
|
|
|
|
0
|
|
|
|
#endif
|
|
|
|
),
|
2012-03-12 18:06:37 -04:00
|
|
|
// Client opts
|
|
|
|
fancy_trees(false),
|
|
|
|
smooth_lighting(false),
|
|
|
|
// Server opts
|
|
|
|
creative_mode(false),
|
|
|
|
enable_damage(false),
|
2013-02-21 17:00:44 -05:00
|
|
|
enable_public(false),
|
2012-03-15 09:20:20 -04:00
|
|
|
selected_world(0),
|
2012-03-25 19:19:41 -04:00
|
|
|
simple_singleplayer_mode(false),
|
|
|
|
// Actions
|
2012-12-25 06:20:51 -05:00
|
|
|
only_refresh(false),
|
|
|
|
|
2013-03-23 09:37:50 -04:00
|
|
|
serverlist_show_available(
|
|
|
|
#if USE_CURL
|
|
|
|
true
|
|
|
|
#else
|
|
|
|
false
|
|
|
|
#endif
|
|
|
|
)
|
2012-03-12 18:06:37 -04:00
|
|
|
{}
|
2011-01-23 10:29:15 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
class GUIMainMenu : public GUIModalMenu
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
GUIMainMenu(gui::IGUIEnvironment* env,
|
|
|
|
gui::IGUIElement* parent, s32 id,
|
|
|
|
IMenuManager *menumgr,
|
|
|
|
MainMenuData *data,
|
|
|
|
IGameCallback *gamecallback);
|
|
|
|
~GUIMainMenu();
|
|
|
|
|
|
|
|
void removeChildren();
|
2012-03-12 18:06:37 -04:00
|
|
|
// Remove and re-add (or reposition) stuff
|
2011-01-23 10:29:15 -05:00
|
|
|
void regenerateGui(v2u32 screensize);
|
|
|
|
void drawMenu();
|
2012-03-11 15:12:27 -04:00
|
|
|
void readInput(MainMenuData *dst);
|
2011-01-23 10:29:15 -05:00
|
|
|
void acceptInput();
|
|
|
|
bool getStatus()
|
2012-03-12 18:06:37 -04:00
|
|
|
{ return m_accepted; }
|
2011-01-23 10:29:15 -05:00
|
|
|
bool OnEvent(const SEvent& event);
|
2012-03-12 18:06:37 -04:00
|
|
|
void createNewWorld(std::wstring name, std::string gameid);
|
2012-03-25 19:19:41 -04:00
|
|
|
void deleteWorld(const std::vector<std::string> &paths);
|
2012-03-13 02:50:03 -04:00
|
|
|
int getTab();
|
2012-09-02 16:51:17 -04:00
|
|
|
void displayMessageMenu(std::wstring msg);
|
2011-01-23 10:29:15 -05:00
|
|
|
|
|
|
|
private:
|
|
|
|
MainMenuData *m_data;
|
|
|
|
bool m_accepted;
|
|
|
|
IGameCallback *m_gamecallback;
|
2011-06-26 06:24:32 -04:00
|
|
|
|
|
|
|
gui::IGUIEnvironment* env;
|
|
|
|
gui::IGUIElement* parent;
|
|
|
|
s32 id;
|
|
|
|
IMenuManager *menumgr;
|
2012-12-25 06:20:51 -05:00
|
|
|
|
2012-03-13 02:50:03 -04:00
|
|
|
bool m_is_regenerating;
|
2012-03-15 07:59:48 -04:00
|
|
|
v2s32 m_topleft_client;
|
|
|
|
v2s32 m_size_client;
|
|
|
|
v2s32 m_topleft_server;
|
|
|
|
v2s32 m_size_server;
|
2012-12-25 06:20:51 -05:00
|
|
|
void updateGuiServerList();
|
|
|
|
void serverListOnSelected();
|
|
|
|
ServerListSpec getServerListSpec(std::string address, std::string port);
|
2011-01-23 10:29:15 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|