Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/SolarLune/gooey
https://github.com/SolarLune/gooey
Last synced: 8 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/SolarLune/gooey
- Owner: SolarLune
- License: mit
- Created: 2024-06-28T16:43:59.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-06-28T16:53:12.000Z (5 months ago)
- Last Synced: 2024-08-02T14:06:15.131Z (3 months ago)
- Language: Go
- Size: 243 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# Gooey
Gooey is a pixel-focused immediate-mode GUI for games, written in Go for Ebitengine.
## Why the name
Next question.
## How does it work?
Pretty easily:
```go
type Game struct {}
func (g *Game) Init() {
gooey.Init(640, 360) // Create GUI backbuffer
}func (g *Game) Update() error { return nil }
func (g *Game) Draw(screen *ebiten.Image) {
gooey.Clear() // Clear the GUI backbuffer.
a := gooey.NewArea("root", 0, 0, 640, 360) // Define an area, with a given ID and X, Y, W, and H.
// Draw and check to see if a button was pressed.
if a.UIButton("testButton", gooey.ButtonOptions{Label: "Test."}) {
fmt.Println("The Test button was pressed.")
}// Draw the result.
screen.DrawImage(gooey.Texture(), nil)}
func (g *Game) Layout(w, h int) (int, int) { return 640, 360 }
func main() {
if err := n.RunGame(&Game{}); err != nil { panic(err) }
}```