Skip to content

Your first native app

The shortest route is the repository’s native starter. After installing the prerequisites, clone the repository if you have not already:

Terminal window
git clone https://github.com/Carnival-Science/Alicorn.git
cd alicorn

Run the starter with the script for your platform:

Terminal window
./tools/native_hello.sh

On Windows PowerShell:

Terminal window
.\tools\native_hello.ps1

The runner builds the example and opens a native window. The source is examples/01_hello/main.odin.

The starter uses the high-level alicorn:ui package. App data stays in an ordinary Odin struct; the render procedure describes the visible interface:

import ui "alicorn:ui"
App :: struct { saved: bool }
render :: proc(app: ^App, ctx: ^ui.UI) {
if ui.column(ctx, padding=24, gap=12) {
ui.text(ctx, "Hello, Alicorn")
if ui.button(ctx, "Save") {
app.saved = true
}
}
}
main :: proc() {
app := App{}
ui.run(&app, render, title="Alicorn", width=720, height=480)
}

Change the text or button label in the example and rerun the same command. Then try the form example and continue through the example progression.