Etterna 0.74.4
Loading...
Searching...
No Matches
RoomWheel.h
1/* RoomWheel - A wheel containing data about rooms. */
2
3#ifndef ROOM_WHEEL_H
4#define ROOM_WHEEL_H
5
6#include "Etterna/Actor/Menus/WheelBase.h"
7#include "Etterna/Actor/Menus/WheelItemBase.h"
8
10{
11 public:
12 void SetName(const std::string& name) { m_name = name; }
13 void SetDescription(const std::string& desc) { m_description = desc; }
14 void SetState(unsigned int state) { m_state = state; }
15 void SetFlags(unsigned int iFlags) { m_iFlags = iFlags; }
16 void SetHasPassword(bool pass) { hasPassword = pass; }
17 [[nodiscard]] std::string Name() const { return m_name; }
18 [[nodiscard]] std::string Description() const { return m_description; }
19 [[nodiscard]] unsigned int State() const { return m_state; }
20 [[nodiscard]] bool HasPassword() const { return hasPassword; }
21 [[nodiscard]] unsigned int GetFlags() const { return m_iFlags; }
22 RoomData()
23 {
24 m_name = "";
25 m_description = "";
26 m_state = 0;
27 m_iFlags = 0;
28 }
29 std::vector<std::string> players;
30
31 private:
32 std::string m_name;
33 std::string m_description;
34 unsigned int m_state;
35 unsigned int m_iFlags;
36 bool hasPassword{ false };
37};
38
40{
41 RoomWheelItemData() = default;
42 RoomWheelItemData(WheelItemDataType type,
43 const std::string& sTitle,
44 const std::string& sDesc,
45 const RageColor& color,
46 const bool hasPass = false)
47 : WheelItemBaseData(type, sTitle, color)
48 , m_sDesc(sDesc)
49 , hasPassword(hasPass){};
50
51 std::string m_sDesc;
52 unsigned int m_iFlags{ 0 };
53 bool hasPassword{ false };
54};
55
57{
58 public:
59 RoomWheelItem(const std::string& sType = "RoomWheelItem");
60 RoomWheelItem(const RoomWheelItem& cpy);
61
62 void LoadFromWheelItemData(const WheelItemBaseData* pWID,
63 int iIndex,
64 bool bHasFocus,
65 int iDrawIndex) override;
66 [[nodiscard]] RoomWheelItem* Copy() const override
67 {
68 return new RoomWheelItem(*this);
69 }
70 void Load(const std::string& sType);
71
72 private:
73 AutoActor m_sprNormalPart;
74 AutoActor m_sprColorPart;
75 AutoActor m_sprOverPart;
76 BitmapText m_text;
77 BitmapText m_Desc;
78};
79
81{
82 std::string songTitle;
83 std::string songSubTitle;
84 std::string songArtist;
85 int numPlayers;
86 int maxPlayers;
87 std::vector<std::string> players;
88};
89
91{
92 std::string title;
93 std::string desc;
94 bool ingame;
95 bool password;
96 bool open;
98 {
99 ingame = password = open = true;
100 title = desc = "";
101 }
102};
103
104class RoomWheel : public WheelBase
105{
106 public:
107 ~RoomWheel() override;
108 void Load(const std::string& sType) override;
109 virtual void BuildWheelItemsData(
110 std::vector<WheelItemBaseData*>& arrayWheelItemDatas);
111 unsigned int GetNumItems() const override;
112 bool Select() override;
113 void Move(int n) override;
114
115 RoomWheelItemData* GetItem(unsigned int i)
116 {
117 return dynamic_cast<RoomWheelItemData*>(
118 WheelBase::GetItem(i + m_offset));
119 }
120 void AddPermanentItem(RoomWheelItemData* itemdata);
121 int GetCurrentIndex() const { return m_iSelection; }
122 int GetPerminateOffset() const { return m_offset; }
123 void AddItem(WheelItemBaseData* itemdata);
124 void RemoveItem(int index);
125
126 void StopSearch();
127 void Search(RoomSearch findme);
128
129 void BuildFromRoomDatas();
130 void UpdateRoomsList(std::vector<RoomData>* m_Roomsptr);
131 void FilterBySearch();
132
133 // Lua
134 void PushSelf(lua_State* L) override;
135
136 std::vector<RoomData>* allRooms;
137 std::vector<RoomData> roomsInWheel;
138
139 private:
140 WheelItemBase* MakeItem() override;
141 int m_offset;
142
143 RoomSearch currentSearch;
144 bool searching;
145};
146
147#endif
A smart pointer for Actor.
Definition AutoActor.h:13
An actor that holds a Font and draws text to the screen.
Definition BitmapText.h:11
Definition RoomWheel.h:10
Definition RoomWheel.h:57
Definition RoomWheel.h:105
A wheel with data elements.
Definition WheelBase.h:35
An item on the wheel.
Definition WheelItemBase.h:42
Definition RageTypes.h:332
Definition RoomWheel.h:81
Definition RoomWheel.h:91
Definition RoomWheel.h:40
Definition WheelItemBase.h:30