AeonGUI
A portable video game graphic user interface library.
Loading...
Searching...
No Matches
Transform.hpp
1/*
2Copyright (C) 2019,2025,2026 Rodrigo Jose Hernandez Cordoba
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16#ifndef AEONGUI_TRANSFORM_H
17#define AEONGUI_TRANSFORM_H
18#include <cstdint>
19#include "aeongui/Platform.hpp"
20#include "aeongui/Vector2.hpp"
21#include "aeongui/Matrix2x3.hpp"
22
23namespace AeonGUI
24{
25 class AABB;
32 {
33 public:
35 DLL Transform();
41 DLL Transform ( const Vector2& aScale, float aRotation, const Vector2 aTranslation );
45 DLL const Vector2& GetScale() const;
49 DLL float GetRotation() const;
53 DLL const Vector2& GetTranslation() const;
57 DLL Matrix2x3 GetMatrix() const;
58
62 DLL void SetScale ( const Vector2& aScale );
66 DLL void SetRotation ( float aRotation );
70 DLL void SetTranslation ( const Vector2& );
73
77 DLL Transform& operator*= ( const Transform& aTransform );
79 private:
80 Vector2 mScale{1.0f, 1.0f};
81 float mRotation{};
82 Vector2 mTranslation{};
83 };
84
88 DLL const Transform operator* ( const Transform& aLeft, const Transform& aRight );
92 DLL const AABB operator* ( const Transform& aLeft, const AABB& aRight );
93}
94#endif
Platform-specific DLL import/export macros and compiler helpers.
Axis-Aligned Bounding Box.
Definition AABB.hpp:27
2x3 affine transformation matrix.
Definition Matrix2x3.hpp:37
2D transform composed of scale, rotation, and translation.
Definition Transform.hpp:32
const Vector2 & GetTranslation() const
Get the translation component.
Definition Transform.cpp:38
Transform & operator*=(const Transform &aTransform)
Combine this transform with another (post-multiply).
Definition Transform.cpp:61
float GetRotation() const
Get the rotation angle.
Definition Transform.cpp:33
void SetTranslation(const Vector2 &)
Set the translation component.
Definition Transform.cpp:56
void SetScale(const Vector2 &aScale)
Set the scale component.
Definition Transform.cpp:48
void SetRotation(float aRotation)
Set the rotation angle.
Definition Transform.cpp:52
Matrix2x3 GetMatrix() const
Build the equivalent 2x3 transformation matrix.
Definition Transform.cpp:43
const Vector2 & GetScale() const
Get the scale component.
Definition Transform.cpp:28
Transform()
Default constructor. Identity transform.
Definition Transform.cpp:22
2D vector of doubles.
Definition Vector2.hpp:31