PointClickEngine::Scenes::BackgroundRenderer
Inherits Reference < Object
Manages background rendering and scaling for scenes
The BackgroundRenderer handles all background-related functionality including:
- Background texture loading and management
- Automatic scaling calculations
- Camera-aware background positioning
- Background rendering optimization
Constructors
new(scene_width : Int32, scene_height : Int32)
SourceInstance methods
create_tiled_background(tile_texture : RL::Texture2D, tile_width : Int32, tile_height : Int32)
Creates a tiled background pattern
draw(camera_offset : RL::Vector2, parallax_factor : Float32 = 1.0_f32)
Renders the background with camera offset
Draws the background texture with proper scaling and positioning, accounting for camera movement for parallax effects.
- camera_offset : Current camera offset for scene scrolling
- parallax_factor : Parallax factor (0.0 = no parallax, 1.0 = full parallax)
draw_with_tint(camera_offset : RL::Vector2, tint : RL::Color, parallax_factor : Float32 = 1.0_f32)
Applies a color tint to the background
get_visible_area(camera_offset : RL::Vector2, viewport_width : Int32, viewport_height : Int32) : RL::Rectangle
Gets the visible area of the background for the given camera position
load_background(path : String)
Loads a background image from file
Loads the texture and calculates appropriate scaling and positioning based on scene dimensions and scaling mode.
- path : File path to the background image
load_background_from_texture(texture : RL::Texture2D)
Loads background from texture data
- texture : Pre-loaded texture to use as background
maintain_aspect_ratio=(maintain_aspect_ratio : Bool)
Whether to maintain aspect ratio when scaling
scaling_mode
Sourcescaling_mode=(scaling_mode : ScalingMode)
Sourcescene_height
Sourcescene_height=(scene_height : Int32)
Sourceupdate_scene_size(width : Int32, height : Int32)
Updates scene dimensions and recalculates scaling