#resource Region
Purpose
The #resource region declares assets embedded directly into the binary. No runtime file loading needed.
tape
#resource
icon app_icon "assets/icon.png";
image splash "assets/splash.png" { max_size: 256; format: rgba; };
font main_font "assets/Inter-Regular.ttf" { sizes: [12, 14, 16, 18, 24]; };
sound click "assets/click.wav";
binary shader_data "shaders/compiled.spv";Resource types
| Keyword | Purpose | Options |
|---|---|---|
icon | Application/toolbar icons | max_size |
image | Raster images | max_size, format |
font | Font files | sizes (pre-rasterization) |
sound | Audio clips | format |
binary | Raw binary data | none |
Accessing from #code
tape
#code
fn setup_window() {
ui.set_icon(app_icon);
ui.show_splash(splash);
}
fn play_feedback() {
audio.play(click);
}Resources are available as typed constants in #code.
Font pre-rasterization
tape
font ui_font "assets/JetBrainsMono.ttf" { sizes: [12, 14, 16]; };The sizes option pre-rasterizes the font at the specified pixel sizes during compilation. At runtime, rendering is instant — no font parsing needed.
@exeicon — Executable icon
tape
#resource
@exeicon("assets/app.ico")Sets the application icon for the compiled executable. The path is resolved relative to the source file. This is a compile-time-only directive — it does not create a runtime-accessible resource.
- Windows: embeds the icon into the PE resource section (
.rsrc) with RT_ICON and RT_GROUP_ICON entries, visible in Explorer, taskbar, and Alt+Tab - Uusi/ELF: stores the icon in a
.note.iconELF section for the desktop shell - Only one
@exeiconper build target (multiple is a compile error) - Supported format:
.ico - Only applies to
tape build— ignored intape run(VM mode)
This is different from icon resource declarations, which create runtime-accessible constants for UI use (toolbar icons, tray icons, etc.).
Image format options
tape
image texture "assets/tile.png" {
max_size: 512; // resize if larger
format: rgba; // store as raw RGBA pixels
};Last modified: