galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
Loading...
Searching...
No Matches
Shape.cpp
Go to the documentation of this file.
1
7
8#include <glad/glad.h>
9
10#include "Shape.hpp"
11
12namespace galaxy
13{
14 namespace graphics
15 {
17 : m_mode {GL_TRIANGLES}
18 , m_width {0.0f}
19 , m_height {0.0f}
20 {
21 }
22
24 {
25 this->m_vao = std::move(s.m_vao);
26 this->m_colour = std::move(s.m_colour);
27 this->m_mode = s.m_mode;
28 this->m_width = s.m_width;
29 this->m_height = s.m_height;
30 }
31
33 {
34 if (this != &s)
35 {
36 this->m_vao = std::move(s.m_vao);
37 this->m_colour = std::move(s.m_colour);
38 this->m_mode = s.m_mode;
39 this->m_width = s.m_width;
40 this->m_height = s.m_height;
41 }
42
43 return *this;
44 }
45
47 {
48 }
49
50 unsigned int Shape::mode() const
51 {
52 return m_mode;
53 }
54
55 float Shape::width() const
56 {
57 return m_width;
58 }
59
60 float Shape::height() const
61 {
62 return m_height;
63 }
64
66 {
67 return m_vao;
68 }
69 } // namespace graphics
70} // namespace galaxy
A generic 2D shape.
Definition Shape.hpp:22
virtual ~Shape()
Destructor.
Definition Shape.cpp:46
Colour m_colour
Used by all primitives.
Definition Shape.hpp:84
VertexArray m_vao
Vertex Array Object.
Definition Shape.hpp:105
Shape & operator=(Shape &&)
Move assignment operator.
Definition Shape.cpp:32
unsigned int m_mode
Type to render i.e. GL_LINES, GL_TRIANGLES, etc.
Definition Shape.hpp:90
float height() const
Get texture height.
Definition Shape.cpp:60
VertexArray & vao()
Get vertex array object.
Definition Shape.cpp:65
unsigned int mode() const
Get OpenGL rendering mode.
Definition Shape.cpp:50
float m_height
Cached height.
Definition Shape.hpp:100
Shape()
Constructor.
Definition Shape.cpp:16
float m_width
Cached width.
Definition Shape.hpp:95
float width() const
Get texture width.
Definition Shape.cpp:55
Abstraction for OpenGL vertex array objects.
Animated.cpp galaxy.
Definition Animated.cpp:16