The Table Engine
transform.h
Go to the documentation of this file.
1
#pragma once
2
10
#include "
component.h
"
11
#include "
vec2.h
"
12
#include "
gameobject.h
"
13
14
#include "SDL2/SDL.h"
15
23
class
Transform
:
public
Component
{
24
private
:
25
SDL_Rect*
mTransform
;
26
Vec2
mPosition
;
27
Vec2
mSize
;
28
29
public
:
33
Transform
();
34
40
Transform
(
int
x,
int
y);
41
45
~Transform
();
46
51
SDL_Rect*
getScreenRect
();
52
57
Vec2
getWorldPosition
();
58
63
Vec2
getScreenPosition
();
64
69
Vec2
getScreenSize
();
70
76
void
setWorldPosition
(
float
x,
float
y);
77
82
void
setWorldPosition
(
Vec2
pos);
83
89
void
updateWorldPosition
(
float
dx,
float
dy);
90
95
void
updateWorldPosition
(
Vec2
dpos);
96
102
void
setWorldSize
(
float
w,
float
h);
103
108
void
setWorldSize
(
Vec2
size);
109
113
void
update
();
114
};
Component
Base class for all game components, providing basic component functionalities.
Definition:
component.h:25
Transform
Component for handling the transformation of game objects.
Definition:
transform.h:23
Transform::updateWorldPosition
void updateWorldPosition(float dx, float dy)
Update the world position by a delta value.
Definition:
transform.cpp:69
Transform::getScreenSize
Vec2 getScreenSize()
Get the size of the Transform in screen space.
Definition:
transform.cpp:44
Transform::update
void update()
Render function for the Transform component, handling visual updates.
Definition:
transform.cpp:81
Transform::getScreenPosition
Vec2 getScreenPosition()
Get the screen space position calculated from world space.
Definition:
transform.cpp:39
Transform::setWorldPosition
void setWorldPosition(float x, float y)
Set the world space position of the Transform.
Definition:
transform.cpp:49
Transform::mPosition
Vec2 mPosition
Position in world space.
Definition:
transform.h:26
Transform::Transform
Transform()
Default constructor.
Definition:
transform.cpp:9
Transform::~Transform
~Transform()
Destructor.
Definition:
transform.cpp:24
Transform::mSize
Vec2 mSize
Size in world space.
Definition:
transform.h:27
Transform::mTransform
SDL_Rect * mTransform
Holds position and size relative to the screen.
Definition:
transform.h:25
Transform::setWorldSize
void setWorldSize(float w, float h)
Set the world space size of the Transform.
Definition:
transform.cpp:59
Transform::getWorldPosition
Vec2 getWorldPosition()
Get the world space position of the Transform.
Definition:
transform.cpp:34
Transform::getScreenRect
SDL_Rect * getScreenRect()
Get the SDL_Rect describing the position and size on the screen.
Definition:
transform.cpp:29
component.h
Defines the Component base class for all components in the game engine.
gameobject.h
Vec2
A structure to represent 2D vectors.
Definition:
vec2.h:16
vec2.h
Definition of Vec2 structure for 2D vector operations.
Engine
include
transform.h
Generated by
1.9.1