Debian Codegraph @

source/tools/atlas/AtlasUI/ScenarioEditor/Tools/Common/Brushes.h

raw
1 /* Copyright (C) 2025 Wildfire Games.
2 * This file is part of 0 A.D.
3 *
4 * 0 A.D. is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * 0 A.D. is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 #ifndef INCLUDED_BRUSHES
19 #define INCLUDED_BRUSHES
20
21 #include <vector>
22
23 class wxSizer;
24 class wxWindow;
25
26 class Brush
27 {
28 friend class BrushShapeCtrl;
29 friend class BrushSizeCtrl;
30 friend class BrushStrengthCtrl;
31 public:
32 Brush();
33 ~Brush();
34
35 static const float STRENGTH_MULTIPLIER;
36
37 int GetWidth() const;
38 int GetHeight() const;
39 std::vector<float> GetData() const;
40
41 void SetCircle(int size);
42 void SetSquare(int size);
43
44 float GetStrength() const;
45 void SetStrength(float strength);
46
47 void CreateUI(wxWindow* parent, wxSizer* sizer);
48
49 // Set this brush to be active - sends SetBrush message now, and also
50 // whenever the brush is altered (until a different one is activated).
51 void MakeActive();
52
53 private:
54 // If active, send SetBrush message to the game
55 void Send();
56
57 enum BrushShape { CIRCLE = 0, SQUARE};
58 BrushShape m_Shape;
59 int m_Size;
60 float m_Strength;
61 bool m_IsActive;
62 };
63
64 extern Brush g_Brush_Elevation;
65
66 #endif // INCLUDED_BRUSHES