Etterna 0.74.4
Loading...
Searching...
No Matches
BackgroundUtil.h
1#ifndef BackgroundUtil_H
2#define BackgroundUtil_H
3
4#include <string>
5#include <vector>
6
7class Song;
8class XNode;
9
10extern const std::string RANDOM_BACKGROUND_FILE;
11extern const std::string NO_SONG_BG_FILE;
12extern const std::string SONG_BACKGROUND_FILE;
13
14extern const std::string SBE_UpperLeft;
15extern const std::string SBE_Centered;
16extern const std::string SBE_StretchNormal;
17extern const std::string SBE_StretchNoLoop;
18extern const std::string SBE_StretchRewind;
19extern const std::string SBT_CrossFade;
20
22{
23 bool operator<(const BackgroundDef& other) const;
24 bool operator==(const BackgroundDef& other) const;
25 [[nodiscard]] bool IsEmpty() const { return m_sFile1.empty() && m_sFile2.empty(); }
26 std::string m_sEffect; // "" == automatically choose
27 std::string m_sFile1; // must not be ""
28 std::string m_sFile2; // may be ""
29 std::string m_sColor1; // "" == use default
30 std::string m_sColor2; // "" == use default
31
32 [[nodiscard]] XNode* CreateNode() const;
33
36 : m_sEffect("")
37 , m_sFile1("")
38 , m_sFile2("")
39 , m_sColor1("")
40 , m_sColor2("")
41 {
42 }
43
49 BackgroundDef(const std::string& effect,
50 const std::string& f1,
51 const std::string& f2)
52 : m_sEffect(effect)
53 , m_sFile1(f1)
54 , m_sFile2(f2)
55 , m_sColor1("")
56 , m_sColor2("")
57 {
58 }
59};
60
62{
64 : m_def()
65 , m_sTransition("")
66 {
67 }
68
69 BackgroundChange(float s,
70 std::string f1,
71 std::string f2 = std::string(),
72 float r = 1.f,
73 std::string e = SBE_Centered,
74 std::string t = std::string())
75 : m_def(e, f1, f2)
76 , m_fStartBeat(s)
77 , m_fRate(r)
78 , m_sTransition(t)
79 {
80 }
81
82 BackgroundDef m_def;
83 float m_fStartBeat{ -1 };
84 float m_fRate{ 1 };
85 std::string m_sTransition;
86
87 [[nodiscard]] std::string GetTextDescription() const;
88
92 [[nodiscard]] std::string ToString() const;
93};
95namespace BackgroundUtil {
96void
97AddBackgroundChange(std::vector<BackgroundChange>& vBackgroundChanges,
98 const BackgroundChange& seg);
99void
100SortBackgroundChangesArray(std::vector<BackgroundChange>& vBackgroundChanges);
101
102void
103GetBackgroundEffects(const std::string& sName,
104 std::vector<std::string>& vsPathsOut,
105 std::vector<std::string>& vsNamesOut);
106void
107GetBackgroundTransitions(const std::string& sName,
108 std::vector<std::string>& vsPathsOut,
109 std::vector<std::string>& vsNamesOut);
110
111void
112GetSongBGAnimations(const Song* pSong,
113 const std::string& sMatch,
114 std::vector<std::string>& vsPathsOut,
115 std::vector<std::string>& vsNamesOut);
116void
117GetSongMovies(const Song* pSong,
118 const std::string& sMatch,
119 std::vector<std::string>& vsPathsOut,
120 std::vector<std::string>& vsNamesOut);
121void
122GetSongBitmaps(const Song* pSong,
123 const std::string& sMatch,
124 std::vector<std::string>& vsPathsOut,
125 std::vector<std::string>& vsNamesOut);
126void
127GetGlobalBGAnimations(const Song* pSong,
128 const std::string& sMatch,
129 std::vector<std::string>& vsPathsOut,
130 std::vector<std::string>& vsNamesOut);
131void
132BakeAllBackgroundChanges(Song* pSong);
133};
134
135#endif
Holds all music metadata and steps for one song.
Definition Song.h:65
Definition XmlFile.h:95
Shared background-related routines.
Definition BackgroundUtil.h:95
Definition BackgroundUtil.h:62
std::string ToString() const
Get the string representation of the change.
Definition BackgroundUtil.cpp:83
Definition BackgroundUtil.h:22
BackgroundDef()
Set up the BackgroundDef with default values.
Definition BackgroundUtil.h:35
BackgroundDef(const std::string &effect, const std::string &f1, const std::string &f2)
Set up the BackgroundDef with some defined values.
Definition BackgroundUtil.h:49