jade-engine
0.0
|
#include <LineStrip.h>
Public Member Functions | |
LineStrip (const LineStripParams ¶ms) | |
void | Render (SDL_Renderer *renderer) override |
void | Update () override |
void | SetPoints (const std::vector< Vector2D_i32 > &points) |
![]() | |
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 | |
![]() | |
const std::shared_ptr< Transform > | transform |
![]() | |
LoadState | _loadState |
bool | _shown |
int32_t | _z |
Game object that renders a sequence of connected line segments on screen, each 1 pixel thick.
JadeEngine::LineStrip::LineStrip | ( | const LineStripParams & | params | ) |
Constructor for LineStrip that accepts LineStripParams.
Game::Create
function to create LineStrips instead of constructing the object directly.
|
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.
renderer | The engine's SDL2 renderer that should be used to render the game object. |
Reimplemented from JadeEngine::IGameObject.
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.
|
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.
Reimplemented from JadeEngine::IGameObject.