Polyphase Game Engine
Loading...
Searching...
No Matches
ProgressBar.h
Go to the documentation of this file.
1#pragma once
2
4
5class Texture;
6class Quad;
7class Text;
8
10{
11public:
12
14
15 virtual void Create() override;
16 virtual void GatherProperties(std::vector<Property>& props) override;
17 virtual void EditorTick(float deltaTime) override;
18 virtual void PreRender() override;
19
20 // Value
21 void SetValue(float value);
22 float GetValue() const;
23 void SetMinValue(float min);
24 float GetMinValue() const;
25 void SetMaxValue(float max);
26 float GetMaxValue() const;
27 float GetRatio() const;
28
29 // Display
30 void SetShowPercentage(bool show);
31 bool IsShowingPercentage() const;
32
33 // Visual
34 void SetBackgroundColor(glm::vec4 color);
35 glm::vec4 GetBackgroundColor();
36 void SetFillColor(glm::vec4 color);
37 glm::vec4 GetFillColor();
38 void SetTextColor(glm::vec4 color);
39 glm::vec4 GetTextColor();
40
41 // Children
42 Quad* GetBackgroundQuad();
43 Quad* GetFillQuad();
44 Text* GetTextWidget();
45
46protected:
47
48 static bool HandlePropChange(Datum* datum, uint32_t index, const void* newValue);
49
50 void UpdateAppearance();
51
52 // Value
53 float mValue = 0.5f;
54 float mMinValue = 0.0f;
55 float mMaxValue = 1.0f;
56
57 // Display
58 bool mShowPercentage = true;
59
60 // Visual
63 glm::vec4 mBackgroundColor = { 0.2f, 0.2f, 0.2f, 1.0f };
64 glm::vec4 mFillColor = { 0.3f, 0.6f, 0.9f, 1.0f };
65 glm::vec4 mTextColor = { 1.0f, 1.0f, 1.0f, 1.0f };
66 float mPadding = 2.0f;
67
68 // Children
69 Quad* mBackground = nullptr;
70 Quad* mFill = nullptr;
71 Text* mText = nullptr;
72};
#define POLYPHASE_API
Definition PolyphaseAPI.h:31
Definition AssetRef.h:18
Definition Datum.h:164
virtual void EditorTick(float deltaTime)
Definition Node.cpp:563
virtual void Create()
Definition Node.cpp:220
Definition ProgressBar.h:10
TextureRef mFillTexture
Definition ProgressBar.h:62
TextureRef mBackgroundTexture
Definition ProgressBar.h:61
DECLARE_NODE(ProgressBar, Widget)
Definition Quad.h:20
Definition Text.h:24
Definition Texture.h:10
Definition Widget.h:53
static bool HandlePropChange(Datum *datum, uint32_t index, const void *newValue)
Definition Widget.cpp:45
virtual void GatherProperties(std::vector< Property > &outProps) override
Definition Widget.cpp:115
virtual void PreRender()
Definition Widget.cpp:226