summaryrefslogtreecommitdiff
path: root/src/client/gameui.h
diff options
context:
space:
mode:
authorLoic Blot <loic.blot@unix-experience.fr>2018-01-04 23:58:46 +0100
committerLoïc Blot <nerzhul@users.noreply.github.com>2018-01-05 20:59:30 +0100
commitf40f4143dfbbaadaabcdbd5243412d389a9d29fb (patch)
tree40008c66ba49779cfddabc3c7a16e58c0e801f09 /src/client/gameui.h
parent02f82eca0b20a4e998e1541413e64766db5d12b0 (diff)
downloadminetest-f40f4143dfbbaadaabcdbd5243412d389a9d29fb.tar.gz
minetest-f40f4143dfbbaadaabcdbd5243412d389a9d29fb.tar.bz2
minetest-f40f4143dfbbaadaabcdbd5243412d389a9d29fb.zip
GameUI refactor (part 7/7): Finish to include profiler things to GameUI
Other changes: * Add GameUI clarification comment * Move force_fog_off & disable_camera_update flags from GameUI to Game, it's not UI related * Properly init GameUI::Flags * Move toggleChat toggleHud & toggleProfiler to GameUI * Add gameui.cpp to LINT whitelist
Diffstat (limited to 'src/client/gameui.h')
-rw-r--r--src/client/gameui.h34
1 files changed, 23 insertions, 11 deletions
diff --git a/src/client/gameui.h b/src/client/gameui.h
index b090f5cb0..ebb7842c4 100644
--- a/src/client/gameui.h
+++ b/src/client/gameui.h
@@ -29,6 +29,14 @@ using namespace irr;
class Client;
struct MapDrawControl;
+/*
+ * This object intend to contain the core UI elements
+ * It includes:
+ * - status texts
+ * - debug texts
+ * - chat texts
+ * - hud flags
+ */
class GameUI
{
// Temporary between coding time to move things here
@@ -44,13 +52,11 @@ public:
// Flags that can, or may, change during main game loop
struct Flags
{
- bool show_chat;
- bool show_hud;
- bool show_minimap;
- bool force_fog_off;
- bool show_debug;
- bool show_profiler_graph;
- bool disable_camera_update;
+ bool show_chat = true;
+ bool show_hud = true;
+ bool show_minimap = true;
+ bool show_debug = true;
+ bool show_profiler_graph = true;
};
void init();
@@ -74,15 +80,18 @@ public:
void showTranslatedStatusText(const char *str);
inline void clearStatusText() { m_statustext.clear(); }
- void setChatText(const EnrichedString &chat_text, u32 recent_chat_count,
- u32 profiler_current_page);
+ void setChatText(const EnrichedString &chat_text, u32 recent_chat_count);
+
+ void updateProfiler();
- void updateProfiler(u32 profiler_current_page, u32 profiler_max_page);
+ void toggleChat();
+ void toggleHud();
+ void toggleProfiler();
private:
Flags m_flags;
- gui::IGUIStaticText *m_guitext = nullptr; // First line of debug text
+ gui::IGUIStaticText *m_guitext = nullptr; // First line of debug text
gui::IGUIStaticText *m_guitext2 = nullptr; // Second line of debug text
gui::IGUIStaticText *m_guitext_info = nullptr; // At the middle of the screen
@@ -93,5 +102,8 @@ private:
float m_statustext_time = 0.0f;
gui::IGUIStaticText *m_guitext_chat; // Chat text
+
gui::IGUIStaticText *m_guitext_profiler; // Profiler text
+ u8 m_profiler_current_page = 0;
+ const u8 m_profiler_max_page = 3;
};