Luanti 5.10.0-dev
 
Loading...
Searching...
No Matches
guiKeyChangeMenu.h
Go to the documentation of this file.
1// Luanti
2// SPDX-License-Identifier: LGPL-2.1-or-later
3// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
4// Copyright (C) 2013 Ciaran Gultnieks <ciaran@ciarang.com>
5// Copyright (C) 2013 teddydestodes <derkomtur@schattengang.net>
6
7#pragma once
8
10#include "modalMenu.h"
11#include "gettext.h"
12#include "client/keycode.h"
13#include <string>
14#include <vector>
15
17
19{
20 int id;
21 std::wstring button_name;
23 std::string setting_name;
24 gui::IGUIButton *button;
25};
26
28{
29public:
30 GUIKeyChangeMenu(gui::IGUIEnvironment *env, gui::IGUIElement *parent, s32 id,
31 IMenuManager *menumgr, ISimpleTextureSource *tsrc);
33
34 /*
35 Remove and re-add (or reposition) stuff
36 */
37 void regenerateGui(v2u32 screensize);
38
39 void drawMenu();
40
41 bool acceptInput();
42
43 bool OnEvent(const SEvent &event);
44
45 bool pausesGame() { return true; }
46
47protected:
48 std::wstring getLabelByID(s32 id) { return L""; }
49 std::string getNameByID(s32 id) { return ""; }
50
51private:
52 void init_keys();
53
54 bool resetMenu();
55
56 void add_key(int id, std::wstring button_name, const std::string &setting_name);
57
58 bool shift_down = false;
59
61 gui::IGUIStaticText *key_used_text = nullptr;
62 std::vector<key_setting *> key_settings;
64};
Definition guiKeyChangeMenu.h:28
void add_key(int id, std::wstring button_name, const std::string &setting_name)
Definition guiKeyChangeMenu.cpp:355
std::string getNameByID(s32 id)
Definition guiKeyChangeMenu.h:49
bool resetMenu()
Definition guiKeyChangeMenu.cpp:242
bool acceptInput()
Definition guiKeyChangeMenu.cpp:207
void regenerateGui(v2u32 screensize)
Definition guiKeyChangeMenu.cpp:91
ISimpleTextureSource * m_tsrc
Definition guiKeyChangeMenu.h:63
GUIKeyChangeMenu(gui::IGUIEnvironment *env, gui::IGUIElement *parent, s32 id, IMenuManager *menumgr, ISimpleTextureSource *tsrc)
Definition guiKeyChangeMenu.cpp:71
bool pausesGame()
Definition guiKeyChangeMenu.h:45
key_setting * active_key
Definition guiKeyChangeMenu.h:60
~GUIKeyChangeMenu()
Definition guiKeyChangeMenu.cpp:80
bool OnEvent(const SEvent &event)
Definition guiKeyChangeMenu.cpp:251
gui::IGUIStaticText * key_used_text
Definition guiKeyChangeMenu.h:61
bool shift_down
Definition guiKeyChangeMenu.h:58
std::vector< key_setting * > key_settings
Definition guiKeyChangeMenu.h:62
void drawMenu()
Definition guiKeyChangeMenu.cpp:194
std::wstring getLabelByID(s32 id)
Definition guiKeyChangeMenu.h:48
void init_keys()
Definition guiKeyChangeMenu.cpp:367
Definition modalMenu.h:36
Definition modalMenu.h:25
Definition texturesource.h:25
Definition keycode.h:24
core::vector2d< u32 > v2u32
Definition irr_v2d.h:14
Definition guiKeyChangeMenu.h:19
std::string setting_name
Definition guiKeyChangeMenu.h:23
std::wstring button_name
Definition guiKeyChangeMenu.h:21
int id
Definition guiKeyChangeMenu.h:20
gui::IGUIButton * button
Definition guiKeyChangeMenu.h:24
KeyPress key
Definition guiKeyChangeMenu.h:22