Skip to content

quadrate-language/sdl3

Repository files navigation

sdl

Simple DirectMedia Layer 3.0 bindings for Quadrate.

Installation

quadpm get https://github.com/quadrate-language/sdl3

Requirements

  • SDL3 development library

Usage

use sdl

fn main() {
    sdl::Init

    // Create window and renderer
    "My Window" 800 600 0 sdl::CreateWindow -> win
    win "" sdl::CreateRenderer -> rend

    // Event loop
    sdl::CreateEvent -> ev
    1 -> running
    loop {
        running if {
            ev sdl::PollEvent swap drop
            if {
                ev sdl::GetEventType
                dup sdl::EventQuit == if {
                    0 -> running
                }
                drop
            }

            // Render
            rend 0 0 0 255 sdl::SetRenderDrawColor
            rend sdl::RenderClear
            rend sdl::RenderPresent

            16 sdl::Delay
        } else {
            break
        }
    }

    // Cleanup
    ev sdl::DestroyEvent
    rend sdl::DestroyRenderer
    win sdl::DestroyWindow
    sdl::Quit
}

See examples/window.qd for a complete working example.

Status

This SDL3 binding provides basic window management, 2D rendering, OpenGL context support, and event handling. For full OpenGL rendering, use this module together with the gl module. See examples/opengl.qd for an OpenGL example with animated colors.

License

Apache-2.0

About

Quadrate SDL3 bindings

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages