Parallax System
Source: client/engine/systems/SystemsFunctions/ParallaxSystem.cpp
Purpose: Scroll parallax background layers.
Components used:
ParrallaxLayer(scroll_speed)TransformDrawable(for texture size)
Behavior
- Advance the layer X position by
scroll_speed * dt. - Reset X position when it exceeds the negative texture width to create a loop.
Main signature
void ParallaxSystem(Eng::registry ®, const GameWorld &game_world,
Eng::sparse_array<Com::Transform> &transforms,
Eng::sparse_array<Com::ParrallaxLayer> const ¶llax_layers,
Eng::sparse_array<Com::Drawable> const &drawables);
Notes
- Relies on
game_world.window_size_andgame_world.last_delta_. - Checks
drawable.isLoadedbefore using texture size.