2017-09-27 03:59:31 -07:00

37 lines
645 B
Go

package main
import (
"github.com/faiface/pixel"
"github.com/faiface/pixel/pixelgl"
"golang.org/x/image/colornames"
)
func run() {
// All code goes here!
// Note: There are more options, but they have defaults
cfg := pixelgl.WindowConfig{
Title: "Pixel Rocks!",
//rectangle, lower left xy, upper right xy
Bounds: pixel.R(0, 0, 1024, 768),
VSync: true,
}
//Takes a config and returns a window or err
win, err := pixelgl.NewWindow(cfg)
if err != nil {
panic(err)
}
win.Clear(colornames.Skyblue)
// Main loop
for !win.Closed() {
win.Update()
}
}
/* Nothing else happens in main*/
func main() {
pixelgl.Run(run)
}