https://github.com/dfirebaugh/banana
a 2d graphics library
https://github.com/dfirebaugh/banana
Last synced: over 1 year ago
JSON representation
a 2d graphics library
- Host: GitHub
- URL: https://github.com/dfirebaugh/banana
- Owner: dfirebaugh
- License: mit
- Created: 2024-11-23T03:56:17.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-24T12:51:25.000Z (over 1 year ago)
- Last Synced: 2025-02-01T02:48:26.583Z (over 1 year ago)
- Language: Go
- Homepage:
- Size: 7.95 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# banana engine
[](https://goreportcard.com/report/github.com/dfirebaugh/banana)
[](https://pkg.go.dev/github.com/dfirebaugh/banana)
banana engine is a 2d graphics engine.
currently supported
- basic shape rendering
- texture rendering
- rendering to a framebuffer
- input detection (keyboard and mouse)
- bitmap font
I'm currently researching strategies to implement a gui system.
Check out the `examples` dir...
### drawing a triangle
`go run ./examples/triangle`
```golang
import (
"github.com/dfirebaugh/banana"
"golang.org/x/image/colornames"
)
const (
screenWidth = 240
screenHeight = 160
)
func main() {
banana.SetWindowSize(screenWidth, screenHeight)
banana.Run(nil, func() {
banana.Clear(colornames.Skyblue)
banana.RenderShape(&banana.Polygon{
Vertices: []banana.Vertex{
{
X: 0,
Y: float32(screenHeight),
Color: colornames.Red,
},
{
X: float32(screenWidth / 2),
Y: 0,
Color: colornames.Green,
},
{
X: float32(screenWidth),
Y: float32(screenHeight),
Color: colornames.Blue,
},
},
})
})
}
```
