Icons
imgui_icons is an asset-free vector icon set: every glyph is geometry drawn
straight onto the ImGui draw list — no SVG, no texture atlas, no font merge.
Glyphs are authored on a logical 24x24 grid and tinted from the daslang amber
accent, so they scale to any size and follow the theme. Two entry points:
icon_button(IDENT, (glyph = "play", tip = "Play"))— a clickable, themed icon button. It usesClickStatelike any button (state.click_countaccumulates, snapshot kindicon_button), and a non-emptytipshows a hover tooltip.icon("waveform", 24.0f)— draw a glyph at the cursor with no interaction, then advance the cursor. Use it for inline chrome, status rows, or labels.
Glyphs are addressed by name. The whole set is enumerable with icon_count()
/ icon_name(i) / icon_category(i) — enough to build an in-app icon
picker. The full visual catalog (every glyph, by category) is the
Icon set reference page.
Source: examples/tutorial/icons.das.
Walkthrough
1options gen2
2
3require imgui
4require imgui_app
5require opengl/opengl_boost
6require live/glfw_live
7require live/live_api
8require live/live_commands
9require live/live_vars
10require live/opengl_live // nolint:STYLE030 - registers screenshot/record_* live commands for the recorder
11require live_host
12require imgui/imgui_live
13require imgui/imgui_boost_runtime
14require imgui/imgui_boost_v2
15require imgui/imgui_widgets_builtin
16require imgui/imgui_containers_builtin
17require imgui/imgui_visual_aids
18require imgui/imgui_icons
19
20// =============================================================================
21// TUTORIAL: imgui_icons — an asset-free vector icon set.
22//
23// Every glyph is geometry drawn straight onto the ImGui draw list (no SVG, no
24// texture atlas), tinted from the daslang amber accent. Two ways to use it:
25//
26// icon_button(IDENT, (glyph = "play", tip = "Play")) — a clickable, themed
27// icon button. Uses
28// ClickState like any
29// button; returns true
30// on click.
31// icon("waveform", 24.0f) — draw a glyph at the
32// cursor (no interaction)
33// and advance the cursor.
34//
35// Glyphs are addressed by name. Enumerate the whole set with icon_count() /
36// icon_name(i) / icon_category(i) — e.g. to build an icon picker. The full
37// catalog (with images) is in the docs: stdlib -> Builtin widgets -> Icon set.
38//
39// STANDALONE: daslang.exe modules/dasImgui/examples/tutorial/icons.das
40// LIVE: daslang-live modules/dasImgui/examples/tutorial/icons.das
41//
42// DRIVE (when running live):
43// curl -X POST -d '{"name":"imgui_click","args":{"target":"IC_WIN/IC_PLAY"}}' \
44// localhost:9090/command
45// =============================================================================
46
47[export]
48def init() {
49 live_create_window("dasImgui icons tutorial", 680, 560)
50 live_imgui_init(live_window)
51 var style & = unsafe(GetStyle())
52 style.FontScaleMain = 1.4f
53}
54
55[export]
56def update() {
57 if (!live_begin_frame()) return
58 begin_frame()
59
60 ImGui_ImplGlfw_NewFrame()
61 apply_synth_io_override()
62 NewFrame()
63
64 SetNextWindowPos(ImVec2(20.0f, 20.0f), ImGuiCond.Always)
65 SetNextWindowSize(ImVec2(640.0f, 520.0f), ImGuiCond.Always)
66 window(IC_WIN, (text = "icons tutorial", closable = false,
67 flags = ImGuiWindowFlags.None)) {
68
69 text("Vector icons drawn on the draw list - no atlas, no asset files.")
70 separator()
71
72 // ---- Stage 1: icon_button — a clickable transport bar ----
73 text(IC_HINT, (text = "icon_button: clickable, themed, addressed by glyph name."))
74 icon_button(IC_PLAY, (glyph = "play", tip = "Play")); same_line(IC_SL1)
75 icon_button(IC_PAUSE, (glyph = "pause", tip = "Pause")); same_line(IC_SL2)
76 icon_button(IC_STOP, (glyph = "stop", tip = "Stop")); same_line(IC_SL3)
77 icon_button(IC_REC, (glyph = "record", tip = "Record"))
78 text("clicks: play={IC_PLAY.click_count} pause={IC_PAUSE.click_count} stop={IC_STOP.click_count} rec={IC_REC.click_count}")
79 spacing()
80
81 // ---- Stage 2: tip + the rest of an edit toolbar ----
82 text(IC_HINT2, (text = "A non-empty tip shows a hover tooltip - hover any glyph."))
83 icon_button(IC_UNDO, (glyph = "undo", tip = "Undo")); same_line(IC_SL4)
84 icon_button(IC_REDO, (glyph = "redo", tip = "Redo")); same_line(IC_SL5)
85 icon_button(IC_CUT, (glyph = "cut", tip = "Cut")); same_line(IC_SL6)
86 icon_button(IC_SAVE, (glyph = "save", tip = "Save"))
87 spacing()
88 separator()
89
90 // ---- Stage 3: icon() — draw-only, any size ----
91 text(IC_DISP, (text = "icon(name, size): draw a glyph inline, no interaction. Sizes scale freely:"))
92 icon("waveform", 20.0f); same_line()
93 icon("waveform", 32.0f); same_line()
94 icon("waveform", 48.0f)
95 spacing()
96 text("The set spans transport, edit, mix, synth, scene and chrome glyphs:")
97 icon("filter", 28.0f); same_line()
98 icon("knob", 28.0f); same_line()
99 icon("wave-sine", 28.0f); same_line()
100 icon("layers", 28.0f); same_line()
101 icon("camera", 28.0f); same_line()
102 icon("gear", 28.0f)
103 spacing()
104 separator()
105
106 // ---- Stage 4: enumerate the catalog ----
107 text("icon_count()/icon_name(i)/icon_category(i) enumerate the set:")
108 text("{icon_count()} glyphs - e.g. [0] '{icon_name(0)}' in '{icon_category(0)}'.")
109 }
110
111 end_of_frame()
112 Render()
113 var w, h : int
114 live_get_framebuffer_size(w, h)
115 glViewport(0, 0, w, h)
116 glClearColor(0.10f, 0.10f, 0.12f, 1.0f)
117 glClear(GL_COLOR_BUFFER_BIT)
118 live_imgui_render()
119
120 live_end_frame()
121}
122
123[export]
124def shutdown() {
125 live_imgui_shutdown()
126 live_destroy_window()
127}
128
129[export]
130def main() {
131 init()
132 while (!exit_requested()) {
133 update()
134 }
135 shutdown()
136}
Requires
imgui/imgui_icons— the icon set:icon,icon_button_draw, and the catalog accessors.imgui/imgui_widgets_builtin— theicon_button[widget](themed, snapshot-visible, playwright-drivable wrapper overicon_button_draw).
icon() — draw only
When there is nothing to click, icon draws a glyph inline:
icon("waveform", 20.0f); same_line()
icon("waveform", 32.0f); same_line()
icon("waveform", 48.0f)
Because the glyph is geometry (not a rasterized image), every size is crisp —
there is no atlas resolution to outgrow. icon advances the cursor by the
box size, so it lays out like any other item.
Enumerating the set
The catalog is data, so it is enumerable at runtime:
for (i in range(icon_count())) {
text("{icon_name(i)} ({icon_category(i)})")
}
This is how the documentation catalog page is generated, and it is the same loop you would write to populate an icon picker.