Jagguar Game Engine

Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
TransformComponent Class Reference

`#include <TransformComponent.hpp>`

Inheritance diagram for TransformComponent:
[legend]
Collaboration diagram for TransformComponent:
[legend]

## Public Member Functions
| TransformComponent (int _x, int _y)
| ~TransformComponent ()
void | SetTransform (Vec2D _pos)
void | SetTransform (int _x, int _y)
void | Update (SDL_Event e, int frame, std::vector< std::string > broadcastList) override
void | Render (SDL_Renderer *ren) override
void | ShowComponentEditor (bool *showEditor) override
Vec2D | getPos () const
const char * | ComponentTypeName () override
Public Member Functions inherited from Component
| Component ()
| ~Component ()
virtual void | Update (SDL_Event e, int frame, std::vector< std::string > broadcastList)
virtual void | Render (SDL_Renderer *ren)
virtual void | ShowComponentEditor (bool *showEditor)
virtual bool | HasTag (ComponentTag t)
virtual const char * | ComponentTypeName ()
void | ParseAndUpdateBroadcast (std::vector< std::string > broadcastList)

## Private Attributes
Vec2D | position
std::vector< ComponentTag > | tags = {ComponentTag::Position}

## Additional Inherited Members
Protected Attributes inherited from Component
std::vector< ComponentTag > | tags
std::vector< std::string > | previousBroadcasts
std::vector< std::string > | pendingBroadcasts

## Detailed Description

A Component implementation to hold the position of a GameObject. Used by every other Component that needs a position.

## Constructor & Destructor Documentation

## ◆ TransformComponent()

TransformComponent::TransformComponent | ( | int | _x,
|  | int | _y
| ) |  |

Construct a new Transform Component object.

Parameters

  _x | the x position of the TransformComponent
  _y | the y position of the TransformComponent

## ◆ ~TransformComponent()

TransformComponent::~TransformComponent | ( |  | ) |

Destroy the Transform Component object.

## Member Function Documentation

## ◆ ComponentTypeName()

const char * TransformComponent::ComponentTypeName | ( |  | ) |
| inline override virtual

The name of the component type. Used by the GUI

See also
  GameMakerGUI::CreateComponent()

Returns
  the name of the component

Reimplemented from Component.

## ◆ getPos()

Vec2D TransformComponent::getPos | ( |  | ) | const

Get the position of the TransformComponent.

Returns
  the current position of the TransformComponent

Here is the caller graph for this function:

## ◆ Render()

void TransformComponent::Render | ( | SDL_Renderer * | ren | ) |
| override virtual

Renders the component (if it has anything to render)

Parameters

  ren | the SDL renderer to be displayed upon

See also
  IGraphicsEngineRenderer

Reimplemented from Component.

## ◆ SetTransform() [1/2]

void TransformComponent::SetTransform | ( | int | _x,
|  | int | _y
| ) |  |

Set the position of the TransformComponent.

Parameters

  _x | the new x position of the TransformComponent
  _y | the new y position of the TransformComponent

See also
  SetTransform(Vec2D)

## ◆ SetTransform() [2/2]

void TransformComponent::SetTransform | ( | Vec2D | _pos | ) |

Set the position of the TransformComponent.

Parameters

  _pos | the new position of the TransformComponent

See also
  SetTransform(int, int)

Here is the caller graph for this function:

## ◆ ShowComponentEditor()

void TransformComponent::ShowComponentEditor | ( | bool * | showEditor | ) |
| override virtual

Using Imgui, render an editor for this component

See also
  GameMakerGUI::RenderEditor()

Parameters

  showEditor |

Reimplemented from Component.

## ◆ Update()

void TransformComponent::Update | ( | SDL_Event | e,
|  | int | frame,
|  | std::vector< std::string > | broadcastList
| ) |  |
| override virtual

Updates the state of the component object. Called by the Engine every tick

Parameters

  e | any inputs given by the user
  frame | what frame is the game currently displaying
  broadcastList | a list to be used to send messages between components

See also
  ParseAndUpdateBroadcast()

Reimplemented from Component.

Here is the call graph for this function:

The documentation for this class was generated from the following files:

- include/TransformComponent.hpp
- src/TransformComponent.cpp