gg/cmd/test/main.go

71 lines
1.1 KiB
Go

package main
import (
"vultras.su/core/gg"
"github.com/hajimehoshi/ebiten/v2/examples/resources/images"
_ "github.com/silbinarywolf/preferdiscretegpu"
"bytes"
"log"
//"strings"
"fmt"
)
type Context = gg.Context
const (
HighestL gg.Layer = -iota
DebugL
TriangleL
PlayerL
RectL
LowestL
)
var (
playerImg *gg.Image
player *Player
rectMove gg.Rectangle
rect *Rect
tri *Tri
)
func main() {
e := gg.NewEngine(&gg.WindowConfig{
Title: "Test title",
Width: 720,
Height: 480,
VSync: true,
Fullscreen: true,
})
var err error
playerImg, err = gg.LoadImage(bytes.NewReader(images.Runner_png))
if err != nil {
log.Fatal(err)
}
rect = NewRect()
player = NewPlayer()
tri = NewTri()
e.Spawn(&Debug{})
e.Spawn(player)
e.Spawn(rect)
e.Spawn(tri)
circle := &gg.Circle{}
circle.Transform = gg.T()
circle.Rotation = 300
circle.Color = gg.Rgba(1, 1, 1, 1)
circle.Antialias = true
circle.Layer = HighestL
circle.Visible = true
e.Spawn(circle)
fmt.Println(rect.GetLayer(), player.GetLayer())
err = e.Run()
if err != nil {
panic(err)
}
}