class

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)
Source

Class methods

configure_reference_resolution(width : Int32, height : Int32)
Source
reference_aspect_ratio
Source
reference_height
Source
reference_width
Source
reset_reference_resolution
Source

Instance methods

active_game_area_rect
Source
clear_screen(clear_color : RL::Color = RL::BLACK)

Clear the screen with letterbox/pillarbox bars

Source
draw_debug_info

Draw debug information

Source
draw_logical_texture(texture : RL::Texture2D, source_width : Int32 | Nil = nil, source_height : Int32 | Nil = nil, tint : RL::Color = RL::WHITE)
Source
fullscreen?

Fullscreen state

Source
game_area_screen_rect

Get the game area rectangle in screen coordinates

Source
game_to_screen(game_x : Number, game_y : Number) : RL::Vector2

Convert game coordinates to screen coordinates

Source
game_to_screen(game_pos : RL::Vector2) : RL::Vector2

Convert game vector to screen coordinates

Source
in_game_area?(screen_x : Number, screen_y : Number) : Bool

Check if screen position is within game area

Source
in_game_area?(screen_pos : RL::Vector2) : Bool

Check if screen vector is within game area

Source
logical_rect
Source
offset_x
Source
offset_y
Source
present(texture : RL::Texture2D, source_width : Int32 | Nil = nil, source_height : Int32 | Nil = nil, tint : RL::Color = RL::WHITE)
Source
reference_aspect_ratio
Source
reference_height
Source
reference_width
Source
refresh_from_window
Source
resize(new_width : Int32, new_height : Int32)

Update window dimensions (e.g., after resize)

Source
scale_factor
Source
scaling_mode
Source
scaling_mode=(mode : ScalingMode)

Change scaling mode

Source
screen_to_game(screen_x : Number, screen_y : Number) : RL::Vector2

Convert screen coordinates to game coordinates

Source
screen_to_game(screen_pos : RL::Vector2) : RL::Vector2

Convert screen vector to game coordinates

Source
set_fullscreen(value : Bool)
Source
toggle_fullscreen

Toggle fullscreen mode

Source
window_height
Source
window_width

Display properties

Source
with_game_coordinates

Apply display transformation for rendering

Source

Nested types