Window.init(w: Int32, h: Int32, title: String)
Opens the window, creates the GL context. Must be called once at program start.
Window.init(800, 600, "Iron Pong")
Window lifecycle, monitors, clipboard, cursor, frame loop, timing.
Every raylib window/system function bound to the Window namespace. Covers lifecycle, state toggles, properties, monitor enumeration, clipboard, events, cursor, frame loop, and misc utilities.
Window.init(w: Int32, h: Int32, title: String)Opens the window, creates the GL context. Must be called once at program start.
Window.init(800, 600, "Iron Pong")
Window.close()Releases the GL context, audio device, window handle.
Window.close()
Window.should_close() -> BoolTrue if user clicked X, pressed ESC (unless set_exit_key(KEY_NULL)), or OS requested close.
while not Window.should_close() {
-- frame loop
}
Window.is_ready() -> BoolTrue once Window.init finished successfully.
if Window.is_ready() { -- GL context valid }
Window.is_fullscreen() -> BoolTrue if window is currently fullscreen.
if not Window.is_fullscreen() { Window.toggle_fullscreen() }
Window.is_hidden / is_minimized / is_maximized / is_focused / is_resized() -> BoolPer-state predicates. is_resized() is true for exactly one frame after a resize.
if Window.is_resized() { -- rebuild framebuffer }
Window.toggle_fullscreen()Flip fullscreen state on current monitor.
if Keyboard.is_pressed(KeyboardKey.F11) { Window.toggle_fullscreen() }
Window.toggle_borderless_windowed / maximize / minimize / restore()Imperative transitions between window states.
Window.maximize()
Window.set_state(flags) / clear_state(flags) / is_state(flag)Set or clear one or more ConfigFlags bits at runtime.
Window.set_state(ConfigFlags.WINDOW_RESIZABLE)
Window.set_icon(image: Image)Set the window title bar icon. Image format must be UNCOMPRESSED_R8G8B8A8.
val icon = Image.load("icon.png")
Window.set_icon(icon)
Window.set_title(title: String)Change window title at runtime (e.g. display FPS or score).
Window.set_title("Score: 100")
Window.set_position(x: Int32, y: Int32)Set window position in screen pixels.
Window.set_position(Int32(100), Int32(100))
Window.set_size / set_min_size / set_max_size(w: Int32, h: Int32)Resize the window or constrain its future resize range.
Window.set_min_size(Int32(400), Int32(300))
Window.set_size(Int32(1280), Int32(720))
Window.set_opacity(opacity: Float32)Alpha from 0.0 (transparent) to 1.0 (opaque). Requires WINDOW_TRANSPARENT config flag on some platforms.
Window.set_opacity(Float32(0.9))
Window.set_monitor(monitor: Int32)Move window to monitor index (0-based).
Window.set_monitor(Int32(1))
Window.get_screen_width / get_screen_height() -> Int32Current window inner size in pixels.
val w = Window.get_screen_width()
val h = Window.get_screen_height()
Window.get_render_width / get_render_height() -> Int32Framebuffer size (may differ from screen size on HiDPI).
val fbw = Window.get_render_width()
Window.get_window_position / get_window_scale_dpi() -> Vector2Top-left corner in screen pixels / DPI scale vector.
val p = Window.get_window_position()
val dpi = Window.get_window_scale_dpi()
Window.get_monitor_count() -> Int32Number of attached monitors.
val n = Window.get_monitor_count()
Window.get_monitor_* (position / width / height / physical_* / refresh_rate / name)Per-monitor metadata by index. get_monitor_position returns Vector2; physical w/h are in mm; refresh rate in Hz.
val pos = Window.get_monitor_position(Int32(0))
val name = Window.get_monitor_name(Int32(0))
Window.get_clipboard_text / set_clipboard_text / get_clipboard_image()OS clipboard access. Text is UTF-8; image is a screenshot-style Image that must be Image.unload(...)'d after use.
Window.set_clipboard_text("copied!")
val current = Window.get_clipboard_text()
Window.enable_event_waiting / disable_event_waiting()When enabled, main loop blocks on events instead of polling — low-power mode for GUI apps.
Window.enable_event_waiting() -- wait for input
Window.show_cursor / hide_cursor / is_cursor_hidden / enable_cursor / disable_cursor / is_cursor_on_screen / set_mouse_cursorCursor visibility + FPS-style locking. disable_cursor hides and locks cursor to window center (for FPS controls).
Window.set_mouse_cursor(MouseCursor.CROSSHAIR)
Window.hide_cursor()
Window.set_config_flags(flags: ConfigFlags) / set_trace_log_level(level: TraceLogLevel)Window hints to apply on next Window.init(). Trace log threshold (default INFO).
Window.set_config_flags(ConfigFlags.MSAA_4X_HINT)
Window.set_trace_log_level(TraceLogLevel.WARNING)
Window.set_target_fps(fps: Int32)Cap main-loop rate. 0 = uncapped. Delta-time still correct via get_frame_time().
Window.set_target_fps(60)
Window.get_fps() -> Int32Measured frames per second (averaged).
Draw.fps(Int32(10), Int32(10)) -- shortcut for Draw.text(get_fps())
Window.get_frame_time() -> Float32Seconds elapsed since last frame — use as delta-time for velocity integration.
val dt = Window.get_frame_time()
pos.x = pos.x + velocity.x * dt
Window.get_time() -> FloatSeconds since Window.init(). Double-precision; usable for animation phase.
val t = Window.get_time()
Window.wait_time(seconds: Float)High-precision sleep. Used by raylib internally for the FPS cap; exposed for manual pacing.
Window.wait_time(0.016) -- 16 ms (~60 FPS)
Window.take_screenshot(filename: String)Save current framebuffer to a PNG file.
if Keyboard.is_pressed(KeyboardKey.F12) {
Window.take_screenshot("screen.png")
}
Window.load_image_from_screen() -> ImageCapture framebuffer as an in-memory Image. Remember to Image.unload(img).
val shot = Window.load_image_from_screen()
Image.unload(shot)
Window.open_url(url: String)Open URL in the system default browser.
Window.open_url("https://ironlang.dev/raylib/")
set_config_flags.set_trace_log_level.Draw.begin / end frame bracketing used inside the Window.should_close loop.