Etterna 0.74.4
Loading...
Searching...
No Matches
WheelItemBase.h
1#ifndef WHEEL_ITEM_BASE_H
2#define WHEEL_ITEM_BASE_H
3
4#include "Etterna/Actor/Base/ActorFrame.h"
5#include "Etterna/Actor/Base/BitmapText.h"
6#include "Etterna/Models/Misc/GameConstantsAndTypes.h"
7#include "Etterna/Models/Misc/ThemeMetric.h"
8
9#include <cassert>
10
13enum WheelItemDataType
14{
15 WheelItemDataType_Generic,
16 WheelItemDataType_Section,
17 WheelItemDataType_Song,
18 WheelItemDataType_Roulette,
19 WheelItemDataType_Random,
20 WheelItemDataType_Portal,
21 WheelItemDataType_Course,
22 WheelItemDataType_Sort,
23 WheelItemDataType_Custom,
24 NUM_WheelItemDataType,
25 WheelItemDataType_Invalid
26};
27LuaDeclareType(WheelItemDataType);
28
30{
31 WheelItemBaseData() = default;
32 WheelItemBaseData(WheelItemDataType type,
33 const std::string& sText,
34 const RageColor& color);
35 virtual ~WheelItemBaseData() = default;
36 WheelItemDataType m_Type;
37 std::string m_sText;
38 RageColor m_color; // either text color or section background color
39};
42{
43 public:
44 WheelItemBase(const std::string& sType);
45 WheelItemBase(const WheelItemBase& cpy);
46 void DrawPrimitives() override;
47 [[nodiscard]] auto Copy() const -> WheelItemBase* override
48 {
49 return new WheelItemBase(*this);
50 }
51
52 void Load();
53 void DrawGrayBar(Actor& bar);
54 void SetExpanded(bool bExpanded) { m_bExpanded = bExpanded; }
55
56 virtual void LoadFromWheelItemData(const WheelItemBaseData* pWID,
57 int iIndex,
58 bool bHasFocus,
59 int iDrawIndex);
60
61 RageColor m_colorLocked;
62
63 auto GetText() -> const std::string
64 {
65 assert(m_pData != nullptr);
66 return m_pData->m_sText;
67 }
68 auto GetColor() -> const RageColor
69 {
70 assert(m_pData != nullptr);
71 return m_pData->m_color;
72 }
73 auto GetType() -> WheelItemDataType
74 {
75 assert(m_pData != nullptr);
76 return m_pData->m_Type;
77 }
78 auto IsLoaded() -> bool { return m_pData != nullptr; }
79
80 // Lua
81 void PushSelf(lua_State* L) override;
82
83 protected:
84 void SetGrayBar(Actor* pBar) { m_pGrayBar = pBar; }
85
86 const WheelItemBaseData* m_pData;
87 bool m_bExpanded; // if TYPE_SECTION whether this section is expanded
88
89 Actor* m_pGrayBar;
90};
91
92#endif
A container for other Actors.
Definition ActorFrame.h:8
Base class for all objects that appear on the screen.
Definition Actor.h:77
An item on the wheel.
Definition WheelItemBase.h:42
void DrawPrimitives() override
Draw the primitives of the Actor.
Definition WheelItemBase.cpp:80
Definition RageTypes.h:332
Definition WheelItemBase.h:30