{"id":13534180,"url":"https://github.com/armory3d/zui","last_synced_at":"2025-09-24T14:31:47.229Z","repository":{"id":35125761,"uuid":"39324240","full_name":"armory3d/zui","owner":"armory3d","description":"Immediate Mode User Interface","archived":false,"fork":false,"pushed_at":"2023-05-10T19:28:29.000Z","size":2596,"stargazers_count":314,"open_issues_count":0,"forks_count":62,"subscribers_count":31,"default_branch":"main","last_synced_at":"2024-11-15T09:49:00.889Z","etag":null,"topics":["imgui","user-interface"],"latest_commit_sha":null,"homepage":"","language":"Haxe","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"BradDenver/grunt-preen","license":"zlib","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/armory3d.png","metadata":{"files":{"readme":"README.md","changelog":"changes.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2015-07-19T06:02:11.000Z","updated_at":"2024-10-29T09:25:54.000Z","dependencies_parsed_at":"2024-01-03T04:15:07.161Z","dependency_job_id":null,"html_url":"https://github.com/armory3d/zui","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/armory3d%2Fzui","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/armory3d%2Fzui/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/armory3d%2Fzui/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/armory3d%2Fzui/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/armory3d","download_url":"https://codeload.github.com/armory3d/zui/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234089412,"owners_count":18778067,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["imgui","user-interface"],"created_at":"2024-08-01T07:01:27.467Z","updated_at":"2025-09-24T14:31:41.916Z","avatar_url":"https://github.com/armory3d.png","language":"Haxe","readme":"# zui\n\nPortable immediate mode UI library designed for tools and debug interfaces. Written in [Haxe](https://haxe.org/) and [Kha](http://kha.tech/), used in [ArmorPaint](http://armorpaint.org).\n\n![](https://armorpaint.org/img/zui.jpg)\n\n## Getting started\n- Clone into *your_kha_project/Libraries*\n- Add `project.addLibrary('zui');` into *khafile.js*\n``` hx\n\t// In init()\n\tvar ui = new Zui({ font: myFont });\n\n\t// In render()\n\tpublic function render(frames: Array\u003cFramebuffer\u003e) {\n\t\tvar g = frames[0].g2;\n\t\tg.begin();\n\t\t// Draw your stuff...\n\t\tg.end();\n\n\t\tui.begin(g);\n\t\tif (ui.window(Id.handle(), x, y, w, h, drag)) {\n\t\t\tif (ui.button(\"Hello\")) {\n\t\t\t\ttrace(\"World\");\n\t\t\t}\n\t\t}\n\t\tui.end();\n\n\t\t// Draw more stuff...\n\t}\n```\n\n## Elements\n``` hx\nfunction tab(handle: Handle, text: String, vertical = false): Bool;\nfunction panel(handle: Handle, text: String, isTree = false): Bool;\nfunction image(image: Image, tint = 0xffffffff): State;\nfunction text(text: String, align = Left, bg = 0x00000000);\nfunction textInput(handle: Handle, label = \"\", align = Left): String;\nfunction button(text: String, align = Center, label = \"\"): Bool;\nfunction check(handle: Handle, text: String): Bool;\nfunction radio(groupId: Handle, pos: Int, text: String): Bool;\nfunction combo(handle: Handle, texts: Array\u003cString\u003e, label = \"\"): Int;\nfunction slider(handle: Handle, text: String, from: Float, to: Float, filled = false, precision = 100, displayValue = true): Float;\nfunction tooltip(text: String);\nfunction tooltipImage(image: Image);\n\n// Formatting\nfunction row(ratios: Array\u003cFloat\u003e);\nfunction separator(h = 4, fill = true);\nfunction indent();\nfunction unindent();\n```\n\nId.hx - simple macros to generate handles\n``` hx\nvar state = ui.check(Id.handle(), \"Check Box\");\n```\n\nExt.hx - prebuilt elements:\n``` hx\nfunction colorWheel(...); // See examples\nfunction fileBrowser(...);\nfunction inlineRadio(handle: Handle, texts: Array\u003cString\u003e): Int;\nfunction textArea(handle: Handle, align = Left): String;\n```\n\nNodes.hx - drawing node systems\n``` hx\nnodes.nodeCanvas(...); // See examples\n```\n\n## Examples\nCheck out [examples/](https://github.com/armory3d/zui/tree/master/examples) folder. To run specific example, simply drop it's folder into [KodeStudio](https://github.com/KTXSoftware/KodeStudio/releases) and hit run. If you are having trouble compiling, clone latest [Kha](https://github.com/Kode/Kha) repository into your example folder (alongside the `khafile.js`). This will let KodeStudio pick up the most recent Kha.\n\n## Theming\nThemes can be defined using TTheme typedef. Check zui.Themes class for example. Set ZuiOptions.theme when creating new Zui instance to overwrite default theme.\n\n## Snippets\n\n**Check element for changes**\n```hx\nvar hcombo = Id.handle();\nui.combo(hcombo, [\"Item 1\", \"item 2\"]);\nif (hcombo.changed) {\n\ttrace(\"Combo value changed this frame\");\n}\n```\n\n**Force redrawing zui window on demand**\n```hx\nfunction render(..) {\n    // Get window handle\n    var hwin = Id.handle();\n    // Force redraw - set each frame or whenever desired\n    hwin.redraws = 1;\n    if (ui.window(hwin, x, y, w, h)) { ... }\n}\n```\n\n**Using render targets - prevent nested begin/end calls**\n```hx\ng2.begin();\n..\ng2.end();\n\nrenderTarget.g2.begin();\n..\nrenderTarget.g2.end();\n\nzui.begin(); // Zui also draws to texture..\n..\nzui.end();\n\ng2.begin();\n..\ng2.end();\n```\n\n**Using Id.handle() in a for loop**\n```hx\n// Id.handle() works at compile time\n// Call .nest() to get unique handle per iteration\nfor (i in 0...3) Id.handle().nest(i);\n// Or use new zui.Handle() directly\n```\n\n**Set initial Id.handle() state**\n```hx\nvar h1 = Id.handle({selected: true});\nvar h2 = Id.handle({position: 0});\nvar h3 = Id.handle({value: 1.0});\nvar h4 = Id.handle({text: \"Text\"});\n```\n\n## Custom integration\nUsing the powerful render target system of Kha, it is possible to easily integrate the library into any scenario. Set ZuiOptions.autoNotifyInput to false when creating a new Zui instance. You can then manually process the input and render the resulting texture in any way you may need.\n``` hx\nzui.onMouseDown(button:Int, x: Int, y: Int)\nzui.onMouseUp(button:Int, x: Int, y: Int)\nzui.onMouseMove(x: Int, y: Int, movementX: Int, movementY: Int)\nzui.onMouseWheel(delta: Int)\n```\n\n---\n\nInspired by [imgui](https://github.com/ocornut/imgui).\n","funding_links":[],"categories":["Libraries"],"sub_categories":["Haxe"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farmory3d%2Fzui","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farmory3d%2Fzui","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farmory3d%2Fzui/lists"}