1604.00
[voxelands.git] / src / character_creator.h
blobb5b9ded0b77c4c9a292d0f459afbfe861c3c42de
1 /************************************************************************
2 * character_creator.h
3 * voxelands - 3d voxel world sandbox game
4 * Copyright (C) Lisa 'darkrose' Milne 2013-2014 <lisa@ltmnet.com>
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 * See the GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>
19 * License updated from GPLv2 or later to GPLv3 or later by Lisa Milne
20 * for Voxelands.
21 ************************************************************************/
23 #include "common_irrlicht.h"
24 #include "modalMenu.h"
25 #include "utility.h"
26 #include <string>
27 #include <map>
28 #include "main.h"
29 #include "mesh.h"
30 // For IGameCallback
31 #include "guiPauseMenu.h"
32 #include "player.h"
34 using namespace irr;
36 enum {
37 GUI_ID_CD_QUIT_BUTTON = 101,
38 GUI_ID_CD_SAVE_BUTTON,
39 GUI_ID_CD_MALE_BUTTON,
40 GUI_ID_CD_FEMALE_BUTTON,
41 GUI_ID_CD_TALLER_BUTTON,
42 GUI_ID_CD_SHORTER_BUTTON,
43 GUI_ID_CD_WIDER_BUTTON,
44 GUI_ID_CD_THINNER_BUTTON,
45 GUI_ID_CD_SKINTONE_PREV_BUTTON,
46 GUI_ID_CD_SKINTONE_NEXT_BUTTON,
47 GUI_ID_CD_FACE_PREV_BUTTON,
48 GUI_ID_CD_FACE_NEXT_BUTTON,
49 GUI_ID_CD_HAIRTONE_PREV_BUTTON,
50 GUI_ID_CD_HAIRTONE_NEXT_BUTTON,
51 GUI_ID_CD_HAIR_PREV_BUTTON,
52 GUI_ID_CD_HAIR_NEXT_BUTTON,
53 GUI_ID_CD_EYES_PREV_BUTTON,
54 GUI_ID_CD_EYES_NEXT_BUTTON,
55 GUI_ID_CD_SHIRT_PREV_BUTTON,
56 GUI_ID_CD_SHIRT_NEXT_BUTTON,
57 GUI_ID_CD_PANTS_PREV_BUTTON,
58 GUI_ID_CD_PANTS_NEXT_BUTTON,
59 GUI_ID_CD_SHOES_PREV_BUTTON,
60 GUI_ID_CD_SHOES_NEXT_BUTTON,
63 class GUICharDefMenu : public GUIModalMenu
65 public:
66 GUICharDefMenu(
67 IrrlichtDevice* device,
68 gui::IGUIEnvironment* env,
69 gui::IGUIElement* parent, s32 id,
70 IMenuManager *menumgr
72 ~GUICharDefMenu();
74 void removeChildren();
76 Remove and re-add (or reposition) stuff
78 void regenerateGui(v2u32 screensize);
80 void drawMenu();
82 void acceptInput();
84 bool getStatus()
86 return m_accepted;
89 bool OnEvent(const SEvent& event);
91 std::string getPlayerSkin();
92 video::ITexture* getPlayerTexture()
94 std::string tex = getPlayerSkin();
95 return g_texturesource->getTextureRaw(tex);
97 void fetchPlayerSkin();
98 void savePlayerSkin();
100 void printCharDef()
102 std::string chardef = m_parts["gender"];
103 chardef += std::string(":")+m_parts["Yscale"];
104 chardef += std::string(":")+m_parts["XZscale"];
105 chardef += std::string(":")+m_parts["skintone"];
106 chardef += std::string(":")+m_parts["eyes"];
107 chardef += std::string(":")+m_parts["hairtone"];
108 chardef += std::string(":")+m_parts["hair"];
109 chardef += std::string(":")+m_parts["face"];
112 private:
113 bool m_accepted;
115 gui::IGUIEnvironment* env;
116 gui::IGUIElement* parent;
117 s32 id;
118 IMenuManager *menumgr;
119 v2u32 m_screensize;
121 scene::IAnimatedMeshSceneNode *m_model;
122 scene::ICameraSceneNode* m_cameranode;
123 f32 m_model_rotation;
125 std::map<std::string,std::string> m_parts;
126 f32 m_y_scale;
127 f32 m_xz_scale;
129 std::map<std::string,std::wstring> m_skintone_types;
130 std::map<std::string,std::wstring> m_face_types;
131 std::map<std::string,std::wstring> m_hairtone_types;
132 std::map<std::string,std::wstring> m_hair_types;
133 std::map<std::string,std::wstring> m_eyes_types;
135 std::map<std::string,std::wstring> m_shirt_types;
136 std::map<std::string,std::wstring> m_pants_types;
137 std::map<std::string,std::wstring> m_shoes_types;