Categorygithub.com/taylorza/go-gfx
repository
0.0.0-20210923025601-624b60e65909
Repository: https://github.com/taylorza/go-gfx.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author

# README

go-gfx Linux-Build Windows-Build Go Reference

Package gfx provides a simple native Go 2d graphics library for Windows and Linux.

Installation

Use the 'go' command:

$ go get github.com/taylorza/go-gfx

Examples

package main

import (
	"github.com/taylorza/go-gfx/pkg/gfx"
)

// Define a type that represents your application. This type must satisfy the Application interface
// and provide the Load, Update and Unload methods. This struct can maintain any additional state you
// require for your graphics application
type myapp struct {
}

// Load called once when the application is initialized
func (app *myapp) Load() {}

// Unload called when the application ends
func (app *myapp) Unload() {}

// Update called for every frame and provides the time in seconds since the last frame update
func (app *myapp) Update(delta float64) {
	// Update and draw your frame
	gfx.Clear(gfx.Cyan)
	gfx.DrawCircle(gfx.Width()/2, gfx.Height()/2, gfx.Height()/3, gfx.Red)
}

func main() {
	if gfx.Init("GFX Example", 0, 0, 320, 240, 2, 2) {
		gfx.Run(&myapp{})
	}
}