2020-06-23 18:07:00 +00:00
|
|
|
//
|
|
|
|
// GuiInputConfig.h
|
|
|
|
//
|
|
|
|
// Input device configuration GUI (for keyboards, joysticks and gamepads).
|
|
|
|
//
|
|
|
|
|
2014-03-01 00:52:32 +00:00
|
|
|
#pragma once
|
2017-10-31 17:12:50 +00:00
|
|
|
#ifndef ES_CORE_GUIS_GUI_INPUT_CONFIG_H
|
|
|
|
#define ES_CORE_GUIS_GUI_INPUT_CONFIG_H
|
2012-07-22 21:15:55 +00:00
|
|
|
|
2015-04-19 09:57:10 +00:00
|
|
|
#include "components/BusyComponent.h"
|
2017-11-01 22:21:10 +00:00
|
|
|
#include "components/ComponentGrid.h"
|
|
|
|
#include "components/NinePatchComponent.h"
|
|
|
|
#include "GuiComponent.h"
|
2014-03-22 01:12:57 +00:00
|
|
|
|
2017-11-01 22:21:10 +00:00
|
|
|
class ComponentList;
|
2014-03-22 01:12:57 +00:00
|
|
|
class TextComponent;
|
2012-07-22 21:15:55 +00:00
|
|
|
|
2013-06-02 15:08:32 +00:00
|
|
|
class GuiInputConfig : public GuiComponent
|
2013-04-08 16:52:40 +00:00
|
|
|
{
|
2012-07-22 21:15:55 +00:00
|
|
|
public:
|
2020-06-23 18:07:00 +00:00
|
|
|
GuiInputConfig(Window* window, InputConfig* target, bool reconfigureAll,
|
|
|
|
const std::function<void()>& okCallback);
|
2014-04-13 02:09:54 +00:00
|
|
|
|
2020-06-23 18:07:00 +00:00
|
|
|
void update(int deltaTime) override;
|
|
|
|
void onSizeChanged() override;
|
2013-04-09 18:13:47 +00:00
|
|
|
|
2012-07-22 21:15:55 +00:00
|
|
|
private:
|
2020-06-23 18:07:00 +00:00
|
|
|
// Set text to "msg" + not greyed out.
|
|
|
|
void error(const std::shared_ptr<TextComponent>& text, const std::string& msg);
|
2014-04-13 02:09:54 +00:00
|
|
|
|
2020-06-23 18:07:00 +00:00
|
|
|
// Set text to "PRESS ANYTHING" + not greyed out.
|
|
|
|
void setPress(const std::shared_ptr<TextComponent>& text);
|
|
|
|
// Set text to -NOT DEFINED- + greyed out.
|
|
|
|
void setNotDefined(const std::shared_ptr<TextComponent>& text);
|
|
|
|
// Set text to "BUTTON 2"/"AXIS 2+", etc.
|
|
|
|
void setAssignedTo(const std::shared_ptr<TextComponent>& text, Input input);
|
2014-04-13 02:09:54 +00:00
|
|
|
|
2020-06-23 18:07:00 +00:00
|
|
|
bool assign(Input input, int inputId);
|
|
|
|
void clearAssignment(int inputId);
|
|
|
|
bool filterTrigger(Input input, InputConfig* config, int inputId);
|
2014-04-13 02:09:54 +00:00
|
|
|
|
2020-06-23 18:07:00 +00:00
|
|
|
void rowDone();
|
2014-03-22 01:12:57 +00:00
|
|
|
|
2020-06-23 18:07:00 +00:00
|
|
|
NinePatchComponent mBackground;
|
|
|
|
ComponentGrid mGrid;
|
2014-03-22 01:12:57 +00:00
|
|
|
|
2020-06-23 18:07:00 +00:00
|
|
|
std::shared_ptr<TextComponent> mTitle;
|
|
|
|
std::shared_ptr<TextComponent> mSubtitle1;
|
|
|
|
std::shared_ptr<TextComponent> mSubtitle2;
|
|
|
|
std::shared_ptr<ComponentList> mList;
|
2020-08-03 10:13:28 +00:00
|
|
|
std::vector<std::shared_ptr<TextComponent>> mMappings;
|
2020-06-23 18:07:00 +00:00
|
|
|
std::shared_ptr<ComponentGrid> mButtonGrid;
|
2014-03-22 01:12:57 +00:00
|
|
|
|
2020-06-23 18:07:00 +00:00
|
|
|
InputConfig* mTargetConfig;
|
|
|
|
// Next input captured by mList will be interpretted as a remap.
|
|
|
|
bool mConfiguringRow;
|
|
|
|
// Move the cursor down after configuring a row and start configuring
|
|
|
|
// the next row until we reach the bottom.
|
|
|
|
bool mConfiguringAll;
|
2014-04-13 02:09:54 +00:00
|
|
|
|
2020-06-23 18:07:00 +00:00
|
|
|
bool mHoldingInput;
|
|
|
|
Input mHeldInput;
|
|
|
|
int mHeldTime;
|
|
|
|
int mHeldInputId;
|
|
|
|
bool mSkipAxis;
|
2015-04-19 09:57:10 +00:00
|
|
|
|
2020-06-23 18:07:00 +00:00
|
|
|
BusyComponent mBusyAnim;
|
2012-07-22 21:15:55 +00:00
|
|
|
};
|
2017-10-31 17:12:50 +00:00
|
|
|
|
|
|
|
#endif // ES_CORE_GUIS_GUI_INPUT_CONFIG_H
|