File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change 1
- // Copyright 2012-2024 Jan Niklas Hasse <[email protected] >
1
+ // Copyright 2012-2025 Jan Niklas Hasse <[email protected] >
2
2
// For conditions of distribution and use, see copyright notice in LICENSE.txt
3
3
4
4
#include " Drawable.hpp"
@@ -13,6 +13,10 @@ Drawable::Drawable() = default;
13
13
14
14
Drawable::~Drawable () = default ;
15
15
16
+ Vec2 Drawable::getPos () const {
17
+ return { getX (), getY () };
18
+ }
19
+
16
20
void Drawable::setPos (const double x, const double y) {
17
21
setX (x);
18
22
setY (y);
Original file line number Diff line number Diff line change @@ -30,6 +30,9 @@ class Drawable {
30
30
// / Called when drawing a frame
31
31
virtual void draw () const = 0;
32
32
33
+ // / Returns position (not center)
34
+ Vec2 getPos () const ;
35
+
33
36
// / Sets the position of the top-left of the Drawable
34
37
virtual void setPos (double x, double y);
35
38
@@ -93,9 +96,10 @@ class Drawable {
93
96
// / Override height (in screen coordinates)
94
97
void setHeight (float );
95
98
99
+ private:
100
+ // / Position in pixel, NOT screen coordinates
96
101
Vec2 position;
97
102
98
- private:
99
103
// / Width and height in pixel, NOT screen coordinates
100
104
float width = 0 ;
101
105
float height = 0 ;
You can’t perform that action at this time.
0 commit comments