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:
git clone https://github.com/Carnival-Science/Alicorn.gitcd alicornRun the starter with the script for your platform:
./tools/native_hello.shOn Windows PowerShell:
.\tools\native_hello.ps1The runner builds the example and opens a native window. The source is
examples/01_hello/main.odin.
The shape of an app
Section titled “The shape of an app”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.