Minimal UI library written in Odin
  • Odin 99.1%
  • Makefile 0.9%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-10-28 11:07:41 +02:00
backend feat!: button hover animations 2026-10-28 10:56:33 +02:00
examples fix: example does not reset cursor to arrow 2026-10-28 11:07:41 +02:00
tests chore: use raven package name instead of ui in examples 2026-08-15 17:05:26 +03:00
animation.odin feat: transition animation helper 2026-10-28 10:56:33 +02:00
button.odin feat!: button hover animations 2026-10-28 10:56:33 +02:00
draggable.odin chore: use raven package name instead of ui in examples 2026-08-15 17:05:26 +03:00
helpers.odin feat: add helpers for centering elements 2026-09-17 10:24:27 +03:00
Makefile chore: add makefile with common actions 2026-08-08 22:18:52 +03:00
odinfmt.json first commit 2026-08-02 00:11:43 +03:00
raven.odin feat: support multiple backends 2026-08-08 22:18:30 +03:00
README.md feat!: button hover animations 2026-10-28 10:56:33 +02:00
scroll.odin feat: support multiple backends 2026-08-08 22:18:30 +03:00
text.odin perf(sdl3): ttf.SetFontSize should be called only once 2026-08-16 10:49:33 +03:00
text_editor.odin feat: add mouse support to text editor 2026-08-09 16:56:53 +03:00
theme.odin feat!: button hover animations 2026-10-28 10:56:33 +02:00

Raven UI Library

🚧 This project is still experimental

Raven is a minimalistic immediate-mode UI library for Raylib written in Odin.

It is a loose collection of tools, rather than a complete framework. You are encouraged to copy the source code into your project and modify and extend it as required.

Instead of a complex layout algorithm, it gives the user full control over how and where UI elements are drawn, by providing various helpers:

count: int
button: raven.Button
raven.button_init(&button, "increment")

text := fmt.aprintf("count: %d", count, allocator = context.temp_allocator)
text_rec := raven.draw_text(text, {0, 0})

// Every draw_* procedure takes a Vector2 position and returns a Rectangle position+size.
// So every subsequent draw can simply offset its position from the previous Rectangle.
button_rec := raven.draw_button(&button, raven.pos_below(text_rec))
if raven.is_clicked(button_rec) do count += 1

Raven is backend independent. You may use SDL3, or Raylib as your rendering backend. The default backend is Raylib. To switch the used backend, the RAVEN_BACKEND compile flag can be used:

odin build my_project -define:RAVEN_BACKEND=sdl3

When using OLS, you may want to define a profile in ols.json to tell OLS which backend you are using:

{
    "$schema": "https://raw.githubusercontent.com/DanielGavin/ols/master/misc/ols.schema.json",
    "profile": "sdl3",
    "profiles": [
        { "name": "sdl3", "defines": { "RAVEN_BACKEND": "sdl3" } },
        { "name": "raylib", "defines": { "RAVEN_BACKEND": "raylib" } }
    ]
}

Features

  • Text drawing and measuring, with word wrapping and Unicode support
  • Buttons
  • Scroll containers
  • Text editor with selection, clipboard, and keyboard navigation support
  • Font loading with Unicode codepoint ranges
  • Theming via raven.default_theme

Usage

Copy the library directory into your project and import it:

import "raven"

Run an example:

odin run examples/counter

See the examples directory for more examples.

Run the tests:

odin test tests/

Stateful elements

Elements with state are split into an update and a draw procedure. Call both once per frame:

raven.update_text_editor(&editor)
raven.draw_text_editor(&editor, bounds)

Theming

The raven.Theme struct is a convenient way to apply styling to UI elements. Many procedures in Raven take an optional theme argument. When omitted, it defaults to the global raven.default_theme.

To customize the default styling of elements, mutate raven.default_theme:

raven.default_theme.font_size = 24
raven.default_theme.text_color = raylib.WHITE

To give specific elements a different look, create a new theme as required:

button_theme := raven.default_theme
button_theme.button_background_color = raylib.DARKGRAY

raven.draw_button("delete", {10, 10}, theme = button_theme)