Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/martinlindhe/gameui
A game UI for golang
https://github.com/martinlindhe/gameui
ebiten game-development game-ui golang
Last synced: 3 months ago
JSON representation
A game UI for golang
- Host: GitHub
- URL: https://github.com/martinlindhe/gameui
- Owner: martinlindhe
- License: mit
- Created: 2016-10-15T18:37:47.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-05-23T20:45:41.000Z (over 7 years ago)
- Last Synced: 2024-06-20T12:39:24.213Z (7 months ago)
- Topics: ebiten, game-development, game-ui, golang
- Language: Go
- Homepage:
- Size: 277 KB
- Stars: 23
- Watchers: 6
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# About
[![GoDoc](https://godoc.org/github.com/martinlindhe/gameui?status.svg)](https://godoc.org/github.com/martinlindhe/gameui)
[![Travis-CI](https://api.travis-ci.org/martinlindhe/gameui.svg)](https://travis-ci.org/martinlindhe/gameui)
[![codecov.io](https://codecov.io/github/martinlindhe/gameui/coverage.svg?branch=master)](https://codecov.io/github/martinlindhe/gameui?branch=master)A game UI for golang with boilerplate to run with [ebiten](https://github.com/hajimehoshi/ebiten/).
# Example usage
```go
package mainimport "github.com/martinlindhe/gameui"
const (
width, height = 320, 200
fontName = "_resources/font/open_dyslexic/OpenDyslexic3-Regular.ttf"
)var (
gui = ui.New(width, height)
font12, _ = ui.NewFont(fontName, 12, 72, ui.White)
)func main() {
// add a text element
text := ui.NewText(font12).SetText("hello")
text.Position = ui.Point{X: width/2 - text.GetWidth()/2, Y: height / 3}
gui.AddComponent(text)if err := gui.Update(); err != nil {
return err
}// get a image.Image
img := gui.Render()
}
```Full example using ebiten:
go get github.com/martinlindhe/gameui
cd $GOPATH/src/github.com/martinlindhe/gameui
go run examples/tooltip/main.goSee the [examples folder](examples) for more examples
### License
Under [MIT](LICENSE)