ShitEngine
基于 C++20 与 SDL3 的轻量级 2D 游戏引擎
载入中...
搜索中...
未找到
TransformComponent类 参考

变换组件,决定 GameObject 的位置 / 缩放 / 旋转 更多...

#include <TransformComponent.h>

类 TransformComponent 继承关系图:
Component

Public 成员函数

 TransformComponent ()
 ~TransformComponent () override=default
const Vector2getPosition () const
void setPosition (const Vector2 &position)
const Vector2getScale () const
void setScale (const Vector2 &scale)
float getRotation () const
void setRotation (float rotation)
Public 成员函数 继承自 Component
 Component ()
virtual ~Component ()=default
virtual void onCreate ()
virtual void onAttach ()
virtual void onDetach ()
virtual void onDestroy ()
 Component (const Component &)=delete
Componentoperator= (const Component &)=delete
 Component (Component &&)=delete
Componentoperator= (Component &&)=delete
GameObjectgetOwner () const
bool isRegistered () const

友元

class GameObject

额外继承的成员函数

Protected 属性 继承自 Component
GameObjectm_owner = nullptr
bool m_isRegistered = false

详细描述

变换组件,决定 GameObject 的位置 / 缩放 / 旋转

每个 GameObject 默认不含 TransformComponent,需手动 addComponent。 位置单位为世界坐标,旋转单位为度。

构造及析构函数说明

◆ TransformComponent()

TransformComponent ( )
explicit

◆ ~TransformComponent()

~TransformComponent ( )
overridedefault

成员函数说明

◆ getPosition()

const Vector2 & getPosition ( ) const
inline

◆ getRotation()

float getRotation ( ) const
inline

◆ getScale()

const Vector2 & getScale ( ) const
inline

◆ setPosition()

void setPosition ( const Vector2 & position)
inline

◆ setRotation()

void setRotation ( float rotation)
inline

◆ setScale()

void setScale ( const Vector2 & scale)
inline

◆ GameObject

friend class GameObject
friend

该类的文档由以下文件生成: