class

PointClickEngine::Characters::SpriteController

Inherits Reference < Object

Manages sprite loading, scaling, and rendering for characters

The SpriteController handles all sprite-related operations including:

  • Sprite loading and initialization
  • Scale calculation and management
  • Position synchronization
  • Rendering coordination

Constructors

new(position : RL::Vector2, size : RL::Vector2)
Source

Instance methods

after_yaml_deserialize(ctx : YAML::ParseContext)

Called after YAML deserialization to restore sprite state

Source
clear_manual_scale

Clears manual scale override

Source
clone

Creates a copy of this sprite controller

Source
contains_point?(point : RL::Vector2) : Bool

Checks if a point is within the sprite bounds

Source
draw

Renders the sprite with current settings

Source
effective_scale

Gets effective scale (manual override or calculated)

Source
frame_height

Gets the frame height of the sprite

Source
frame_width

Gets the frame width of the sprite

Source
get_bounds

Gets sprite bounds for collision detection

Source
load_spritesheet(path : String, frame_width : Int32, frame_height : Int32)

Loads a spritesheet for character animation

Source
loaded?

Checks if sprite is loaded

Source
manual_scale

Manual scale override (nil for automatic scaling)

Source
manual_scale=(manual_scale : Float32 | Nil)

Manual scale override (nil for automatic scaling)

Source
position

Reference to the character's position

Source
position=(position : RL::Vector2)

Reference to the character's position

Source
reload_texture

Reloads the sprite texture

Source
scale

Character's current scale factor

Source
scale=(scale : Float32)

Character's current scale factor

Source
set_manual_scale(scale : Float32 | Nil)

Sets manual scale override

Source
size

Reference to the character's size

Source
size=(size : RL::Vector2)

Reference to the character's size

Source
sprite

The animated sprite data

Source
sprite=(sprite : Graphics::Sprites::AnimatedSprite | Nil)

The animated sprite data

Source
sprite_path

Path to the sprite/spritesheet file

Source
sprite_path=(sprite_path : String | Nil)

Path to the sprite/spritesheet file

Source
unload

Unloads sprite resources

Source
update_position(new_position : RL::Vector2)

Updates sprite position to match character position

Source
update_scale(new_scale : Float32)

Updates sprite scale

Source
update_size_from_sprite

Updates size based on sprite dimensions and scale

Source
visible

Visibility state (independent of sprite)

Source
visible=(visible : Bool)

Visibility state (independent of sprite)

Source
visible?

Gets sprite visibility

Source