Etterna 0.74.4
Loading...
Searching...
No Matches
NoteSkinManager.h
1#ifndef NOTE_SKIN_MANAGER_H
2#define NOTE_SKIN_MANAGER_H
3
4#include "Etterna/Actor/Base/Actor.h"
5#include "Etterna/Models/Misc/GameInput.h"
6#include "Etterna/Models/Misc/PlayerNumber.h"
7
8#include <utility>
9
10struct Game;
11struct NoteSkinData;
12
15{
16 public:
19
20 void RefreshNoteSkinData(const Game* game);
21 void GetNoteSkinNames(const Game* game, std::vector<std::string>& AddTo);
22 void GetNoteSkinNames(std::vector<std::string>&
23 AddTo); // looks up current const Game* in GAMESTATE
24 auto NoteSkinNameInList(const std::string& name,
25 const std::vector<std::string>& name_list) -> bool;
26 auto DoesNoteSkinExist(const std::string& sNoteSkin)
27 -> bool; // looks up current const Game* in GAMESTATE
28 auto DoNoteSkinsExistForGame(const Game* pGame) -> bool;
29 auto GetDefaultNoteSkinName()
30 -> std::string; // looks up current const Game* in GAMESTATE
31
32 void ValidateNoteSkinName(std::string& name);
33
34 auto GetFirstWorkingNoteSkin() -> std::string;
35
36 void SetCurrentNoteSkin(const std::string& sNoteSkin)
37 {
38 m_sCurrentNoteSkin = sNoteSkin;
39 }
40 [[nodiscard]] auto GetCurrentNoteSkin() const -> const std::string&
41 {
42 return m_sCurrentNoteSkin;
43 }
44
45 void SetLastSeenColor(std::string Color) { LastColor = std::move(Color); }
46 [[nodiscard]] auto GetLastSeenColor() const -> const std::string&
47 {
48 return LastColor;
49 }
50
51 void SetPlayerNumber(PlayerNumber pn) { m_PlayerNumber = pn; }
52 void SetGameController(GameController gc) { m_GameController = gc; }
53 auto GetPath(const std::string& sButtonName, const std::string& sElement)
54 -> std::string;
55 auto PushActorTemplate(Lua* L,
56 const std::string& sButton,
57 const std::string& sElement,
58 bool bSpriteOnly,
59 std::string Color) -> bool;
60 auto LoadActor(const std::string& sButton,
61 const std::string& sElement,
62 Actor* pParent = nullptr,
63 bool bSpriteOnly = false,
64 std::string Color = "4th") -> Actor*;
65
66 auto GetMetric(const std::string& sButtonName, const std::string& sValue)
67 -> std::string;
68 auto GetMetric(const std::string& sButtonName,
69 const std::string& sValue,
70 const std::string& sFallbackValue) -> std::string;
71 auto GetMetricI(const std::string& sButtonName,
72 const std::string& sValueName) -> int;
73 auto GetMetricI(const std::string& sButtonName,
74 const std::string& sValueName,
75 const std::string& sDefaultValue) -> int;
76 auto GetMetricF(const std::string& sButtonName,
77 const std::string& sValueName) -> float;
78 auto GetMetricF(const std::string& sButtonName,
79 const std::string& sValueName,
80 const std::string& sDefaultValue) -> float;
81 auto GetMetricB(const std::string& sButtonName,
82 const std::string& sValueName) -> bool;
83 auto GetMetricB(const std::string& sButtonName,
84 const std::string& sValueName,
85 const std::string& sDefaultValue) -> bool;
86 auto GetMetricA(const std::string& sButtonName,
87 const std::string& sValueName) -> apActorCommands;
88
89 // Lua
90 void PushSelf(lua_State* L);
91
92 protected:
93 auto GetPathFromDirAndFile(const std::string& sDir,
94 const std::string& sFileName) -> std::string;
95 void GetAllNoteSkinNamesForGame(const Game* pGame,
96 std::vector<std::string>& AddTo);
97
98 auto LoadNoteSkinData(const std::string& sNoteSkinName,
99 NoteSkinData& data_out) -> bool;
100 auto LoadNoteSkinDataRecursive(const std::string& sNoteSkinName,
101 NoteSkinData& data_out) -> bool;
102 std::string m_sCurrentNoteSkin;
103 const Game* m_pCurGame;
104 std::string LastColor;
105
106 // xxx: is this the best way to implement this? -freem
107 PlayerNumber m_PlayerNumber;
108 GameController m_GameController;
109};
110
111extern NoteSkinManager*
112 NOTESKIN; // global and accessible from anywhere in our program
113
115{
116 public:
117 LockNoteSkin(const std::string& sNoteSkin)
118 {
119 NOTESKIN->SetCurrentNoteSkin(sNoteSkin);
120 }
121 ~LockNoteSkin() { NOTESKIN->SetCurrentNoteSkin(""); }
122};
123
124#endif
Base class for all objects that appear on the screen.
Definition Actor.h:77
Definition NoteSkinManager.h:115
Loads note skins.
Definition NoteSkinManager.h:15
Holds information about a particular style of a game (e.g. "single", "double").
Definition Game.h:33
Definition NoteSkinManager.cpp:38