jade-engine  0.0
JadeEngine::Button Class Reference
Inheritance diagram for JadeEngine::Button:
JadeEngine::IGameObject

Public Member Functions

 Button (const ButtonParams &params)
 
void Disable (bool disabled)
 
bool Disabled () const
 
void Show (const bool shown) override
 
void Update () override
 
void SetPosition (uint32_t x, uint32_t y)
 
void SetCenterPosition (uint32_t x, uint32_t y)
 
int32_t GetWidth () const
 
int32_t GetHeight () const
 
int32_t GetX () const
 
int32_t GetY () const
 
int32_t GetCenterX () const
 
int32_t GetCenterY () const
 
void SetText (const std::string &text)
 
bool Pressed ()
 
bool Down ()
 
bool Released ()
 
- Public Member Functions inherited from JadeEngine::IGameObject
 IGameObject ()
 
virtual void Clean ()
 
virtual LoadState Load (SDL_Renderer *renderer)
 
virtual void Render (SDL_Renderer *renderer)
 
LoadState GetLoadState () const
 
void SetLoadState (const LoadState newState)
 
bool IsShown () const
 
int32_t GetZ () const
 
void Destroy ()
 
bool DestructionWanted () const
 

Additional Inherited Members

- Public Attributes inherited from JadeEngine::IGameObject
const std::shared_ptr< Transformtransform
 
- Protected Attributes inherited from JadeEngine::IGameObject
LoadState _loadState
 
bool _shown
 
int32_t _z
 

Member Function Documentation

◆ Show()

void JadeEngine::Button::Show ( const bool  show)
overridevirtual

Show or hide game object.

Warning
This does not affect any owned child game objects as this interface has no knowledge of them. It only handles tracking the visibility state. It is recommended to override this function for game object that own other game objects. Inside the overridden function one should call this - base - function and handle hiding/showing of children game objects there.
void SomeGameObject::Show(const bool shown) //override
{
// Show or hide any child objects or perform any other necessary operations
_childObject->Show(IsShown());
}
See also
IGameObject::IsShown

Reimplemented from JadeEngine::IGameObject.

◆ Update()

void JadeEngine::Button::Update ( )
overridevirtual

Triggered every frame while the scene that owns this game object is active and the game object was successfully loaded.

The trigger order is the following: IScene::PreUpdate -> IGameObject::Load -> IGameObject::Update -> IScene::Update -> IGameObject::Load -> IGameObject::Render.

To obtain delta time since last frame use GTime.deltaTime.

See also
Time, LoadState, IGameObject::Render, IScene::Update, IScene::PreUpdate

Reimplemented from JadeEngine::IGameObject.


The documentation for this class was generated from the following files:
JadeEngine::IGameObject::Show
virtual void Show(const bool show)
Definition: IGameObject.h:170
JadeEngine::IGameObject::IsShown
bool IsShown() const
Definition: IGameObject.h:153