GigaPasjans
Loading...
Searching...
No Matches
SettingComponent.h
1// Plik utworzony przez Piotra ChudziƄskiego w dniu 11.04.2025
2#pragma once
3#include <andromenda/Component.h>
4#include <phosphorus/GameObject.h>
5#include <phosphorus/Languages.h>
6
7namespace Game
8{
9 using namespace Andromenda;
10
15 class SettingComponent : public Component
16 {
17 private:
19 Int2 getSize() override = 0;
20
21 protected:
22 WideString RedactSettingName()
23 {
24 if (Parameter->GetDisplayName() == Parameter->GetName())
25 return StringUtil::GetUTF16String(Parameter->GetName());
26 else
27 return _TW(Parameter->GetDisplayName());
28 }
29
30 public:
36
37 explicit SettingComponent(Phosphorus::IBaseParameter *parameter) : Parameter(parameter) {}
38
40 void ProvideActions(ActionRegistry &registry) override = 0;
41
43 void Draw(DrawContext &context) override = 0;
44
49 template<typename T>
50 T *As()
51 {
52 return dynamic_cast<T *>(Parameter);
53 }
54
56 bool IsSelectable() const override { return true; }
57 };
58} // namespace Game
Represent registry of Action objects.
Definition ActionRegistry.h:74
Represents a renderable identified object.
Definition Component.h:23
void Draw(DrawContext &context) override=0
Draws self.
Phosphorus::IBaseParameter * Parameter
Edited parameter.
Definition SettingComponent.h:35
bool IsSelectable() const override
Returns value indicating, whether component is selectable.
Definition SettingComponent.h:56
void ProvideActions(ActionRegistry &registry) override=0
Provides own actions to the ActionRegistry.
T * As()
Returns casted parameter to T.
Definition SettingComponent.h:50
Represents parameter which can be serializable. Used by IParameter.
Definition GameObject.h:69
static WideString GetUTF16String(const String &other)
Returns UTF-16 string converted from UTF-8 string.
Definition Strings.cpp:133
Represents a mutable sequence of utf-16 characters, providing various member functions for string man...
Definition WideString.h:14
A utility which contains all essential class instances and functions for rendering objects.
Definition DrawContext.h:14
Represents a two component vector. Components are 32-bit and they are signed.
Definition Int2.h:11