@@ -57,7 +57,7 @@ class Algorithm
57
57
};
58
58
59
59
public:
60
- explicit Algorithm (String name);
60
+ explicit Algorithm (std::string name);
61
61
62
62
virtual ~Algorithm () = default ;
63
63
@@ -79,11 +79,11 @@ class Algorithm
79
79
void Resize (size_t size);
80
80
void SoftResize (size_t size);
81
81
82
- void SetImage (const String & filepath);
82
+ void SetImage (const std::string & filepath);
83
83
84
84
void Shuffle (Random::Engine generator);
85
85
86
- auto Name () const -> const String &;
86
+ auto Name () const -> const std::string &;
87
87
88
88
void SetSleepDelay (sf::Time delay);
89
89
void SetVisType (VisType visType);
@@ -93,9 +93,9 @@ class Algorithm
93
93
void SetPalette (Palette palette);
94
94
auto PaletteImage () -> const sf::Image&;
95
95
96
- auto Elements () -> List <Element>&;
97
- auto RestartElements () -> List <Element>&;
98
- auto ResetElements () -> List <Element>&;
96
+ auto Elements () -> std::vector <Element>&;
97
+ auto RestartElements () -> std::vector <Element>&;
98
+ auto ResetElements () -> std::vector <Element>&;
99
99
100
100
protected:
101
101
virtual void Sort () = 0;
@@ -115,7 +115,7 @@ class Algorithm
115
115
void SleepDelay ();
116
116
117
117
private:
118
- auto Generator () -> Function <long(size_t )>;
118
+ auto Generator () -> std::function <long(size_t )>;
119
119
auto HighestElementValue () -> long;
120
120
121
121
auto PixelCoord (size_t index) const -> sf::Vector2u;
@@ -141,11 +141,11 @@ class Algorithm
141
141
auto VerifyElements () -> bool;
142
142
143
143
protected:
144
- String _name;
144
+ std::string _name;
145
145
146
- Thread _sorter;
146
+ std::thread _sorter;
147
147
148
- Shared <sf::Image> _image;
148
+ std::shared_ptr <sf::Image> _image;
149
149
sf::RenderTexture _imageRenderTexture;
150
150
151
151
sf::Time _sleepDelay;
@@ -155,35 +155,35 @@ class Algorithm
155
155
State _state;
156
156
bool _isActive;
157
157
158
- Shared <sf::Font> _nameTextFont;
158
+ std::shared_ptr <sf::Font> _nameTextFont;
159
159
sf::Text _nameText;
160
160
VisType _visType;
161
161
162
162
private:
163
163
static constexpr int MaxElements = 10000 ;
164
164
static constexpr int PaletteWidth = 2048 ;
165
165
166
- List <Element> _elements;
167
- List <Element> _elementsRestart;
168
- List <Element> _elementsReset;
166
+ std::vector <Element> _elements;
167
+ std::vector <Element> _elementsRestart;
168
+ std::vector <Element> _elementsReset;
169
169
170
170
NumberGeneratorType _numberGeneratorType = NumberGeneratorType::Linear;
171
171
172
172
// Shapes cache
173
173
sf::VertexArray _barsVA;
174
- List <sf::CircleShape> _hoopsShapes;
174
+ std::vector <sf::CircleShape> _hoopsShapes;
175
175
sf::VertexArray _numberLineVA;
176
- List <sf::Text> _numberLineTextList;
176
+ std::vector <sf::Text> _numberLineTextList;
177
177
178
178
// Palette
179
179
sf::Texture _paletteTexture;
180
180
Palette _desiredPalette = Palette::Rainbow;
181
181
sf::Image _currentPalette;
182
- Array <TransitionColor, PaletteWidth> _colorsStart;
183
- Array <TransitionColor, PaletteWidth> _colorsCurrent;
182
+ std::array <TransitionColor, PaletteWidth> _colorsStart;
183
+ std::array <TransitionColor, PaletteWidth> _colorsCurrent;
184
184
float _colorTransitionTimer;
185
185
float _colorTransitionDuration;
186
- List<Shared <sf::Image>> _palettes;
186
+ std::vector<std::shared_ptr <sf::Image>> _palettes;
187
187
bool _usePalette = false ;
188
188
};
189
189
}
0 commit comments