jade-engine  0.0
JadeEngine::LineStrip Class Reference

#include <LineStrip.h>

Inheritance diagram for JadeEngine::LineStrip:
JadeEngine::IGameObject

Public Member Functions

 LineStrip (const LineStripParams &params)
 
void Render (SDL_Renderer *renderer) override
 
void Update () override
 
void SetPoints (const std::vector< Vector2D_i32 > &points)
 
- Public Member Functions inherited from JadeEngine::IGameObject
 IGameObject ()
 
virtual void Clean ()
 
virtual LoadState Load (SDL_Renderer *renderer)
 
LoadState GetLoadState () const
 
void SetLoadState (const LoadState newState)
 
bool IsShown () const
 
virtual void Show (const bool show)
 
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
 

Detailed Description

Game object that renders a sequence of connected line segments on screen, each 1 pixel thick.

See also
LineStripParams

Constructor & Destructor Documentation

◆ LineStrip()

JadeEngine::LineStrip::LineStrip ( const LineStripParams params)

Constructor for LineStrip that accepts LineStripParams.

Warning
One should use Game::Create function to create LineStrips instead of constructing the object directly.
See also
Game::Create, LineStripParams

Member Function Documentation

◆ Render()

void JadeEngine::LineStrip::Render ( SDL_Renderer *  renderer)
overridevirtual

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

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

Parameters
rendererThe engine's SDL2 renderer that should be used to render the game object.
See also
IGameObject::Update, LoadState, IGameObject::IsShown

Reimplemented from JadeEngine::IGameObject.

◆ SetPoints()

void JadeEngine::LineStrip::SetPoints ( const std::vector< Vector2D_i32 > &  points)

Changed the points that define the LineStrip. The LineScript will now consist of points.size()-1 lines.

The points are relative to the LineStrip's transform center position (LineStrip::transform->GetCenterPosition()). This means the whole strip can be moved around by changing the transform.

Each point is a both a start and an end of a line segment apart from the very first and very last points which are only start and end points respectively. Assuming three different points are passed: A, B, C in that order than the LineStrip will look like A-B-C. In order to create a closed loop, a copy of the very first point should the very last point.

See also
Transform

◆ Update()

void JadeEngine::LineStrip::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: