3#include <game/InteractionManager.h>
4#include <game/Solitaire.h>
5#include <phosphorus/Languages.h>
6#include "../SettingComponent.h"
10 using namespace Andromenda;
12#define REGISTER_EASY_STATE(keycode, text, state) \
13 registry.Register(keycode, text, \
16 param->SetValue(state); \
17 Phosphorus::GetGameAs<Game::Solitaire>()->PlayOneShot("game_enter.wav"); \
26 class BooleanComponent :
public SettingComponent
33 explicit BooleanComponent(Phosphorus::BoolParameter *parameter) : SettingComponent(parameter) {}
42 return FORMAT(
"{}: {}", RedactSettingName(),
43 param->GetValue() ? _T(
"settings.true") : _T(
"settings.false"));
50 registry.
Register(Keycode::Enter, _TW(
"settings.switch"),
53 param->SetValue(!param->GetValue());
54 Phosphorus::GetGameAs<Game::Solitaire>()->PlayOneShot(
"game_enter.wav");
59 REGISTER_EASY_STATE(Keycode::T, _TW(
"settings.set_true"),
true);
60 REGISTER_EASY_STATE(Keycode::N, _TW(
"settings.set_false"),
false);
Represent registry of Action objects.
Definition ActionRegistry.h:74
void Register(const Keycode &keycode, const WideString &actionText, const Callback &callback, MouseButton button=MouseButton::None)
Registers given text and callback to given key.
Definition ActionRegistry.cpp:18
bool m_IsActive
A value indicating, whether object is being pointed by pointer.
Definition Component.h:32
Box GetBounds()
Returns Component bounds. Position is already aligned.
Definition Components.cpp:27
void markAsDirty()
Sets m_Dirty to true.
Definition Components.cpp:32
void Pop()
Pops style at the top.
Definition TerminalBase.cpp:45
void Push(const TerminalStyle &style)
Pushes given style to the top.
Definition TerminalBase.cpp:43
String GetText()
Returns text that should be drawed on screen.
Definition BooleanComponent.h:39
void ProvideActions(ActionRegistry ®istry) override
Provides own actions to the ActionRegistry.
Definition BooleanComponent.h:47
void Draw(DrawContext &context) override
Draws self.
Definition BooleanComponent.h:64
T * As()
Returns casted parameter to T.
Definition SettingComponent.h:50
Represents a mutable sequence of characters, providing various member functions for string manipulati...
Definition String.h:16
A utility which contains all essential class instances and functions for rendering objects.
Definition DrawContext.h:14
void Put(const String &text, Int2 position)
Puts a UTF-8 text at given position and with given text.
Definition DrawContext.cpp:7
StyleStack StyleStack
Style stack.
Definition DrawContext.h:31
Represents terminal text style, described by background and foreground color.
Definition Terminal.h:20
Represents a two component vector. Components are 32-bit and they are signed.
Definition Int2.h:11