Available

amalgame-ui-sdl

SDL2 binding: window, events, 2D drawing, text.

amc package add ui-sdl GitHub ↗ ← Back to the ecosystem

Overview

Binding to SDL2 and SDL2_ttf, dynamically linked: windows, keyboard and mouse events, 2D drawing and text.

Features

  • ✓SDL2 and SDL2_ttf dynamically linked (libsdl2-dev and libsdl2-ttf-dev to build)
  • ✓Window, events, 2D drawing: Clear, FillRect, DrawLine, DrawText
  • ✓Light or dark system theme detection (OSTheme.DetectOS)
  • ✓Keyboard, mouse and text input
  • ✓Base of ui-forms

Example

Minimal usage example — copy-paste runnable after install.

amc package add ui-sdl

import Amalgame.UI.SDL

public class Program {
    public static void Main(string[] args) {
        let win: Window = Window.New("Demo", 800, 600)
        if (win == null) {
            return
        }
        let bg: Color = new Color(32, 32, 32, 255)
        let blue: Color = new Color(0, 160, 255, 255)
        while (!win.ShouldClose()) {
            win.Poll()
            win.Clear(bg)
            win.FillRect(new Rect(100, 100, 200, 120), blue)
            win.Present()
        }
        win.Close()
    }
}

At a glance

Related packages