Raftel Engine
 
Loading...
Searching...
No Matches
transform.hpp
Go to the documentation of this file.
1
14#ifndef __TRANSFORM_H__
15#define __TRANSFORM_H__ 1
16
17#pragma once
18
19namespace Raftel {
20
28 struct Vec2
29 {
30 float x, y;
31
40 Vec2 operator+(const Vec2& other) const { return { x + other.x, y + other.y }; }
41
50 Vec2 operator*(float scalar) const { return { x * scalar, y * scalar }; }
51 };
52
61 public:
62
73
77 float angle_;
78
86 void Translate(float deltaTime);
94 void Rotate(float angle);
95
104 void Scale(Vec2 scale, float deltaTime);
105
113
121
128 };
129}// namespace Raftel
130#endif // !__TRANSFORM_HPP__
Vec2 scale_
The scale factor applied to the object in 2D space.
Definition transform.hpp:75
void Rotate(float angle)
Rotates the object by the specified angle.
Vec2 velocity_
The velocity of the object for translation.
Definition transform.hpp:76
void ApplyTransform()
Applies the accumulated transformations (translation, rotation, scaling).
void Translate(float deltaTime)
Translates the object by applying its velocity over time.
Vec2 position_
The position of the object in 2D space.
Definition transform.hpp:74
Transform2D()
Default constructor for Transform2D.
void Scale(Vec2 scale, float deltaTime)
Scales the object by the given factor.
~Transform2D()
Destructor for Transform2D.
float angle_
The angle of rotation of the object.
Definition transform.hpp:77
void EndTransform()
Ends the current transformation and restores the previous matrix state.
Represents a 2D vector with basic arithmetic operations.
Definition transform.hpp:29
Vec2 operator+(const Vec2 &other) const
Adds two Vec2 vectors.
Definition transform.hpp:40
Vec2 operator*(float scalar) const
Multiplies the vector by a scalar value.
Definition transform.hpp:50
float y
The x and y components of the vector.
Definition transform.hpp:30