61 lines
897 B
Go
61 lines
897 B
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)
|
|
fmt.Println(rect.GetLayer(), player.GetLayer())
|
|
|
|
err = e.Run()
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
}
|