module
Eagle::Window
Overview
The game window: its size, title, fullscreen state and cursor.
Sizes are in logical points, the units you draw in. On high-DPI screens the
framebuffer has more pixels (.pixel_size), and Eagle scales for you.
g.print("PAUSED", Window.center.x, Window.center.y, align: TextAlign::Center)
Window.fullscreen = !Window.fullscreen? if Input.pressed?(Key::F11)
Window.title = "Level 2"
Defined in:
eagle/core/window.crClass Method Summary
-
.aspect : Float32
Width divided by height.
-
.center : Vec2
The center of the window, handy for placing things in the middle of the screen.
-
.cursor_visible=(v : Bool)
Shows or hides the mouse cursor, for games that draw their own crosshair.
-
.focused? : Bool
True while the window has keyboard focus.
-
.fullscreen=(v : Bool)
Switches between fullscreen and windowed mode.
-
.fullscreen? : Bool
True in fullscreen mode.
-
.height : Int32
Height in logical points.
-
.pixel_height : Int32
Framebuffer height in device pixels.
-
.pixel_size : Vec2
Framebuffer size in device pixels.
-
.pixel_width : Int32
Framebuffer width in device pixels.
-
.rect : Rect
The whole window as a
Rectfrom(0, 0). -
.relative_mouse=(v : Bool)
Captures the mouse for mouse-look: the cursor is hidden and locked, and
Input.mouse_deltakeeps reporting movement. -
.scale : Float32
Device pixels per logical point: 2 on most Retina screens, 1 elsewhere.
-
.size : Vec2
(width, height)in logical points. -
.title : String
The window title.
-
.title=(t : String)
Changes the window title.
-
.vsync=(v : Bool)
Turns vsync on or off.
-
.vsync? : Bool
True when presentation waits for the display's refresh.
-
.width : Int32
Width in logical points.
Class Method Detail
The center of the window, handy for placing things in the middle of the screen.
Shows or hides the mouse cursor, for games that draw their own crosshair.
True while the window has keyboard focus. Pause the game when it loses focus if you like.
Captures the mouse for mouse-look: the cursor is hidden and locked, and Input.mouse_delta
keeps reporting movement. Turn it off again for menus.