]> git.lizzy.rs Git - dragonfireclient.git/blob - src/gui/cheatMenu.h
ec0c81659056c29a6d73f40bd7e999877ff477a7
[dragonfireclient.git] / src / gui / cheatMenu.h
1 /*
2 Dragonfire
3 Copyright (C) 2020 Elias Fleckenstein <eliasfleckenstein@web.de>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser 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 #pragma once
21
22 #include "irrlichttypes_extrabloated.h"
23 #include <string>
24
25 #define CHEAT_MENU_GET_SCRIPTPTR ClientScripting *script = m_client->getScript(); if (! script || ! script->m_cheats_loaded) return;
26
27 class Client;
28
29 typedef enum
30 {
31         CHEAT_MENU_ENTRY_TYPE_HEAD,
32         CHEAT_MENU_ENTRY_TYPE_CATEGORY,
33         CHEAT_MENU_ENTRY_TYPE_ENTRY,
34 }
35 CheatMenuEntryType;
36
37 class CheatMenu
38 {
39 public:
40         CheatMenu(Client* client);
41         
42         virtual void draw(video::IVideoDriver* driver, bool show_debug);
43                                 
44         void drawEntry(video::IVideoDriver* driver, std::string name, int number, bool selected, bool active, CheatMenuEntryType entry_type = CHEAT_MENU_ENTRY_TYPE_ENTRY);
45         
46         void selectUp();
47         void selectDown();
48         void selectLeft();
49         void selectRight();
50         void selectConfirm();
51         
52 private:
53         bool m_cheat_layer = false;
54         int m_selected_cheat = 0;
55         int m_selected_category = 0;
56         
57         int m_head_height = 50;
58         int m_entry_height = 40;
59         int m_entry_width = 200;
60         int m_gap = 2;
61         
62         video::SColor m_bg_color = video::SColor(192, 255, 175, 191);
63         video::SColor m_active_bg_color = video::SColor(192, 255, 32, 76);
64         video::SColor m_font_color = video::SColor(255, 89, 0, 65);
65         video::SColor m_selected_font_color = video::SColor(255, 87, 0, 242); 
66         
67         Client *m_client;
68         
69         gui::IGUIFont *m_font = nullptr;
70         v2u32 m_fontsize;
71 };