PointClickEngine::Graphics::Core::Display
Inherits Reference < Object
Manages display resolution, scaling, and window properties
The Display class handles all aspects of window management and coordinate system scaling, ensuring games look correct at any resolution while maintaining the intended aspect ratio.
Scaling Modes
- FitWithBars: Maintains aspect ratio, adds letterbox/pillarbox
- Stretch: Fills screen, may distort
- PixelPerfect: Integer scaling only for crisp pixels
Example
display = Display.new(1920, 1080)
display.scaling_mode = ScalingMode::FitWithBars
# Convert mouse position to game coordinates
game_pos = display.screen_to_game(mouse_pos)
Constants
DEFAULT_REFERENCE_HEIGHT = 768
DEFAULT_REFERENCE_WIDTH = 1024
Reference resolution (design/logical resolution)
Constructors
new(window_width : Int32, window_height : Int32, reference_width : Int32 = self.class.reference_width, reference_height : Int32 = self.class.reference_height)
SourceClass methods
configure_reference_resolution(width : Int32, height : Int32)
Sourcereference_aspect_ratio
Sourcereference_height
Sourcereference_width
Sourcereset_reference_resolution
SourceInstance methods
active_game_area_rect
Sourceclear_screen(clear_color : RL::Color = RL::BLACK)
Clear the screen with letterbox/pillarbox bars
draw_logical_texture(texture : RL::Texture2D, source_width : Int32 | Nil = nil, source_height : Int32 | Nil = nil, tint : RL::Color = RL::WHITE)
Sourcegame_to_screen(game_x : Number, game_y : Number) : RL::Vector2
Convert game coordinates to screen coordinates
game_to_screen(game_pos : RL::Vector2) : RL::Vector2
Convert game vector to screen coordinates
in_game_area?(screen_x : Number, screen_y : Number) : Bool
Check if screen position is within game area
logical_rect
Sourceoffset_x
Sourceoffset_y
Sourcepresent(texture : RL::Texture2D, source_width : Int32 | Nil = nil, source_height : Int32 | Nil = nil, tint : RL::Color = RL::WHITE)
Sourcereference_aspect_ratio
Sourcereference_height
Sourcereference_width
Sourcerefresh_from_window
Sourcescale_factor
Sourcescaling_mode
Sourcescreen_to_game(screen_x : Number, screen_y : Number) : RL::Vector2
Convert screen coordinates to game coordinates
screen_to_game(screen_pos : RL::Vector2) : RL::Vector2
Convert screen vector to game coordinates
set_fullscreen(value : Bool)
Sourcewindow_height
Source