aboutsummaryrefslogtreecommitdiff
path: root/src/gui/cheatMenu.h
diff options
context:
space:
mode:
authorElias Fleckenstein <eliasfleckenstein@web.de>2020-07-28 13:51:32 +0200
committerElias Fleckenstein <eliasfleckenstein@web.de>2020-07-28 13:51:32 +0200
commitf7a042223f9c82c7764c0df3a3531bda04e9ad64 (patch)
tree1d227816dc680ea883ba16a385c2151714e65961 /src/gui/cheatMenu.h
parent344fddc1727f637b3c4e2a9b88844d952b91fe4f (diff)
downloaddragonfireclient-f7a042223f9c82c7764c0df3a3531bda04e9ad64.tar.xz
Added cheat Menu
Diffstat (limited to 'src/gui/cheatMenu.h')
-rw-r--r--src/gui/cheatMenu.h71
1 files changed, 71 insertions, 0 deletions
diff --git a/src/gui/cheatMenu.h b/src/gui/cheatMenu.h
new file mode 100644
index 000000000..ec0c81659
--- /dev/null
+++ b/src/gui/cheatMenu.h
@@ -0,0 +1,71 @@
+/*
+Dragonfire
+Copyright (C) 2020 Elias Fleckenstein <eliasfleckenstein@web.de>
+
+This program is free software; you can redistribute it and/or modify
+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
+(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
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+
+#pragma once
+
+#include "irrlichttypes_extrabloated.h"
+#include <string>
+
+#define CHEAT_MENU_GET_SCRIPTPTR ClientScripting *script = m_client->getScript(); if (! script || ! script->m_cheats_loaded) return;
+
+class Client;
+
+typedef enum
+{
+ CHEAT_MENU_ENTRY_TYPE_HEAD,
+ CHEAT_MENU_ENTRY_TYPE_CATEGORY,
+ CHEAT_MENU_ENTRY_TYPE_ENTRY,
+}
+CheatMenuEntryType;
+
+class CheatMenu
+{
+public:
+ CheatMenu(Client* client);
+
+ virtual void draw(video::IVideoDriver* driver, bool show_debug);
+
+ void drawEntry(video::IVideoDriver* driver, std::string name, int number, bool selected, bool active, CheatMenuEntryType entry_type = CHEAT_MENU_ENTRY_TYPE_ENTRY);
+
+ void selectUp();
+ void selectDown();
+ void selectLeft();
+ void selectRight();
+ void selectConfirm();
+
+private:
+ bool m_cheat_layer = false;
+ int m_selected_cheat = 0;
+ int m_selected_category = 0;
+
+ int m_head_height = 50;
+ int m_entry_height = 40;
+ int m_entry_width = 200;
+ int m_gap = 2;
+
+ video::SColor m_bg_color = video::SColor(192, 255, 175, 191);
+ video::SColor m_active_bg_color = video::SColor(192, 255, 32, 76);
+ video::SColor m_font_color = video::SColor(255, 89, 0, 65);
+ video::SColor m_selected_font_color = video::SColor(255, 87, 0, 242);
+
+ Client *m_client;
+
+ gui::IGUIFont *m_font = nullptr;
+ v2u32 m_fontsize;
+};