2023-02-17 07:04:29 +03:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2024-01-05 04:22:53 +03:00
|
|
|
"vultras.su/core/gg"
|
2023-02-17 23:51:40 +03:00
|
|
|
"github.com/hajimehoshi/ebiten/v2/examples/resources/images"
|
|
|
|
"bytes"
|
|
|
|
"log"
|
2023-12-23 00:09:07 +03:00
|
|
|
//"strings"
|
2023-05-26 18:31:04 +03:00
|
|
|
"fmt"
|
2023-02-17 07:04:29 +03:00
|
|
|
)
|
|
|
|
|
2023-12-20 22:39:33 +03:00
|
|
|
type Context = gg.Context
|
|
|
|
|
2023-08-31 11:29:37 +03:00
|
|
|
const (
|
2023-10-23 15:45:18 +03:00
|
|
|
HighestL gg.Layer = -iota
|
2023-08-31 11:29:37 +03:00
|
|
|
DebugL
|
|
|
|
TriangleL
|
|
|
|
PlayerL
|
|
|
|
RectL
|
|
|
|
LowestL
|
|
|
|
)
|
|
|
|
|
2023-02-17 23:51:40 +03:00
|
|
|
var (
|
2023-10-23 15:45:18 +03:00
|
|
|
playerImg *gg.Image
|
|
|
|
player *Player
|
|
|
|
rectMove gg.Rectangle
|
|
|
|
rect *Rect
|
|
|
|
tri *Tri
|
2023-02-17 23:51:40 +03:00
|
|
|
)
|
|
|
|
|
2023-02-17 07:04:29 +03:00
|
|
|
func main() {
|
2023-10-23 15:45:18 +03:00
|
|
|
e := gg.NewEngine(&gg.WindowConfig{
|
|
|
|
Title: "Test title",
|
|
|
|
Width: 720,
|
2023-02-18 09:11:09 +03:00
|
|
|
Height: 480,
|
2023-10-23 15:45:18 +03:00
|
|
|
VSync: true,
|
2023-02-17 07:04:29 +03:00
|
|
|
})
|
|
|
|
|
2023-02-17 23:51:40 +03:00
|
|
|
var err error
|
2023-10-23 15:45:18 +03:00
|
|
|
playerImg, err = gg.LoadImage(bytes.NewReader(images.Runner_png))
|
2023-02-17 23:51:40 +03:00
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
|
2023-05-30 14:34:10 +03:00
|
|
|
rect = NewRect()
|
2023-12-26 23:31:04 +03:00
|
|
|
player = NewPlayer()
|
2023-06-20 14:04:55 +03:00
|
|
|
tri = NewTri()
|
2023-10-23 15:45:18 +03:00
|
|
|
|
2023-08-31 11:29:37 +03:00
|
|
|
e.Add(&Debug{})
|
|
|
|
e.Add(player)
|
|
|
|
e.Add(rect)
|
|
|
|
e.Add(tri)
|
|
|
|
fmt.Println(rect.GetLayer(), player.GetLayer())
|
2023-10-23 15:45:18 +03:00
|
|
|
|
2023-12-25 23:41:12 +03:00
|
|
|
err = e.Run()
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2023-02-17 07:04:29 +03:00
|
|
|
}
|