2011-06-01 19:44:07 +02:00
|
|
|
/*
|
2013-02-24 18:40:43 +01:00
|
|
|
Minetest
|
2013-02-24 19:38:45 +01:00
|
|
|
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
|
|
|
|
Copyright (C) 2013 Ciaran Gultnieks <ciaran@ciarang.com>
|
|
|
|
Copyright (C) 2013 teddydestodes <derkomtur@schattengang.net>
|
2011-06-01 19:44:07 +02:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
2012-06-05 16:56:56 +02:00
|
|
|
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
|
2011-06-01 19:44:07 +02:00
|
|
|
(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
|
2012-06-05 16:56:56 +02:00
|
|
|
GNU Lesser General Public License for more details.
|
2011-06-01 19:44:07 +02:00
|
|
|
|
2012-06-05 16:56:56 +02:00
|
|
|
You should have received a copy of the GNU Lesser General Public License along
|
2011-06-01 19:44:07 +02:00
|
|
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
2017-08-17 22:19:39 +02:00
|
|
|
#pragma once
|
2011-06-01 19:44:07 +02:00
|
|
|
|
2012-06-17 03:00:31 +02:00
|
|
|
#include "irrlichttypes_extrabloated.h"
|
2011-06-01 19:44:07 +02:00
|
|
|
#include "modalMenu.h"
|
2011-07-30 11:43:20 +02:00
|
|
|
#include "gettext.h"
|
2018-11-28 20:01:49 +01:00
|
|
|
#include "client/keycode.h"
|
2011-06-01 19:44:07 +02:00
|
|
|
#include <string>
|
2012-07-26 09:49:00 +02:00
|
|
|
#include <vector>
|
|
|
|
|
2020-04-11 22:39:30 +02:00
|
|
|
class ISimpleTextureSource;
|
|
|
|
|
2017-04-23 09:52:40 +02:00
|
|
|
struct key_setting
|
|
|
|
{
|
2012-07-26 09:49:00 +02:00
|
|
|
int id;
|
2023-03-03 01:18:38 +01:00
|
|
|
std::wstring button_name;
|
2012-07-26 09:49:00 +02:00
|
|
|
KeyPress key;
|
|
|
|
std::string setting_name;
|
|
|
|
gui::IGUIButton *button;
|
2015-02-01 23:59:23 +01:00
|
|
|
};
|
2012-07-26 09:49:00 +02:00
|
|
|
|
2017-04-23 09:52:40 +02:00
|
|
|
class GUIKeyChangeMenu : public GUIModalMenu
|
2011-06-01 19:44:07 +02:00
|
|
|
{
|
|
|
|
public:
|
2017-04-23 09:52:40 +02:00
|
|
|
GUIKeyChangeMenu(gui::IGUIEnvironment *env, gui::IGUIElement *parent, s32 id,
|
2020-04-11 22:39:30 +02:00
|
|
|
IMenuManager *menumgr, ISimpleTextureSource *tsrc);
|
2011-06-01 19:44:07 +02:00
|
|
|
~GUIKeyChangeMenu();
|
|
|
|
|
|
|
|
/*
|
|
|
|
Remove and re-add (or reposition) stuff
|
|
|
|
*/
|
|
|
|
void regenerateGui(v2u32 screensize);
|
|
|
|
|
|
|
|
void drawMenu();
|
|
|
|
|
|
|
|
bool acceptInput();
|
|
|
|
|
2017-04-23 09:52:40 +02:00
|
|
|
bool OnEvent(const SEvent &event);
|
2011-06-01 19:44:07 +02:00
|
|
|
|
2017-08-07 14:53:58 +02:00
|
|
|
bool pausesGame() { return true; }
|
|
|
|
|
2018-06-24 21:50:57 +02:00
|
|
|
protected:
|
|
|
|
std::wstring getLabelByID(s32 id) { return L""; }
|
|
|
|
std::string getNameByID(s32 id) { return ""; }
|
|
|
|
|
2011-06-01 19:44:07 +02:00
|
|
|
private:
|
|
|
|
void init_keys();
|
|
|
|
|
|
|
|
bool resetMenu();
|
|
|
|
|
2023-03-03 01:18:38 +01:00
|
|
|
void add_key(int id, std::wstring button_name, const std::string &setting_name);
|
2011-06-01 19:44:07 +02:00
|
|
|
|
2017-06-17 19:11:28 +02:00
|
|
|
bool shift_down = false;
|
2017-04-23 09:52:40 +02:00
|
|
|
|
2020-02-14 20:36:58 +01:00
|
|
|
key_setting *active_key = nullptr;
|
2017-06-17 19:11:28 +02:00
|
|
|
gui::IGUIStaticText *key_used_text = nullptr;
|
2012-07-26 09:49:00 +02:00
|
|
|
std::vector<key_setting *> key_settings;
|
2020-04-11 22:39:30 +02:00
|
|
|
ISimpleTextureSource *m_tsrc;
|
2011-06-01 19:44:07 +02:00
|
|
|
};
|