Drawable System
Source: client/engine/systems/SystemsFunctions/DrawableSystem.cpp
Purpose: Render entities with Drawable components: load textures, position sprites, and draw them.
Components used:
DrawableTransformShader(optional)
Behavior
- Initialize textures not yet loaded from
drawable.spritePath(InitializeDrawable). - Compute the sprite origin via
GetOffsetFromTransformand apply it. - Sort entities by
z_indexto honor draw order. - For each entity, update position, scale, rotation, and opacity, then draw the sprite on
game_world.window_. - If a shader is attached and loaded, apply it and update the
timeuniform.
Main signature
void DrawableSystem(Eng::registry ®, GameWorld &game_world,
Eng::sparse_array<Com::Transform> const &transforms,
Eng::sparse_array<Com::Drawable> &drawables,
Eng::sparse_array<Com::Shader> &shaders);
Notes
- Texture load failures are logged to
std::cerr. - Depends on
game_worldforwindow_andtotal_time_clock_.