https://github.com/zeozeozeo/microui-go
A tiny, portable, immediate-mode UI library ported to idiomatic Go
https://github.com/zeozeozeo/microui-go
golang golang-gui golang-ui gui immediate-gui immediate-mode immediate-mode-ui immediate-ui microui no-cgo port pure-go ui
Last synced: 6 months ago
JSON representation
A tiny, portable, immediate-mode UI library ported to idiomatic Go
- Host: GitHub
- URL: https://github.com/zeozeozeo/microui-go
- Owner: zeozeozeo
- License: unlicense
- Created: 2022-12-11T14:11:56.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-28T16:28:26.000Z (9 months ago)
- Last Synced: 2024-08-29T18:23:35.761Z (9 months ago)
- Topics: golang, golang-gui, golang-ui, gui, immediate-gui, immediate-mode, immediate-mode-ui, immediate-ui, microui, no-cgo, port, pure-go, ui
- Language: Go
- Homepage: https://zeozeozeo.github.io/ebitengine-microui-go/demo
- Size: 19.5 KB
- Stars: 19
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 
A tiny, portable, immediate-mode UI library ported to Go (as of commit [0850aba860959c3e75fb3e97120ca92957f9d057](https://github.com/rxi/microui/tree/0850aba860959c3e75fb3e97120ca92957f9d057), v2.02)
# API changes
- Functions and structs are renamed to be PascalCase and the prefix `mu_` is removed, like this:
> `mu_push_command` -> `PushCommand`
> `mu_begin_treenode_ex` -> `BeginTreeNodeEx`
> `mu_get_clip_rect` -> `GetClipRect`
- Every function that takes `mu_Context` (`Context`) instead has a `Context` reciever, so `Button(ctx, label)` becomes `ctx.Button(label)`
- Stacks are now slices with variable length, `append` is used for `push` and `slice = slice[:len(slice)-1]` is used for `pop`
- `mu_Font` (`Font`) is `interface{}`, since it doesn't store any font data. You can use `reflect` if you want to store values inside it
- All pointer-based commands (`MU_COMMAND_JUMP`) and the `Command` struct have been reworked to use indices
- The `mu_Real` type has been replaced with `float32` because Go does not allow implicit casting of identical type aliases
- The library is split into separate files instead of one file
- The library is ~1300 lines of code in total## Additional functions:
- `NewContext`, which is a helper for creating a new `Context`
- `ctx.Render`, which calls a function for every command inside the command list, then clears it# Integrations, demos, renderers
* [Ebitengine](https://ebitengine.org/) rendering backend + demo port: [zeozeozeo/ebitengine-microui-go](https://github.com/zeozeozeo/ebitengine-microui-go)

* Official Ebitengine fork and integration efforts: [ebitengine/microui](https://github.com/ebitengine/microui)# Notes
The library expects the user to provide input and handle the resultant drawing commands, it does not do any drawing/tessellation itself.
# Credits
Thank you [@rxi](https://github.com/rxi) for creating this awesome library and thank you [@Zyko0](https://github.com/Zyko0) for contributing numerous fixes to this Go port.