package main import ( "vultras.su/core/gg" "github.com/hajimehoshi/ebiten/v2/examples/resources/images" "github.com/hajimehoshi/ebiten/v2/examples/resources/fonts" //_ "github.com/silbinarywolf/preferdiscretegpu" "bytes" "log" "fmt" ) type Context = gg.Context const ( HighestL gg.Layer = -iota DebugL TriangleL PlayerL RectL LowestL ) const ( Stand gg.AnimationId = iota Walk ) var ( playerAnimations gg.AnimationSet 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() playerAnimations, _ = gg.AnimationSetFromImage( playerImg, 8, 3, 10, 1, gg.AD(Stand).DefRow(0, 0, 1, 2, 3, 4), gg.AD(Walk).DefRow(1, 0, 1, 2, 3, 4, 5, 6, 7), ) 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) txt := &Text{} txt.Transform = gg.T() //txt.Position = gg.V2(400) txt.Color = gg.Rgba(1, 1, 1, 1) txt.Layer = HighestL txt.Visible = true txt.Data = "Hello, World!\nПривет, Мир!" txt.Face, err = gg.MakeFaceFromTtf( bytes.NewReader(fonts.MPlus1pRegular_ttf), &gg.TtfFaceOptions{ Size: 32, DPI: 72, Hinting: gg.FontHintingNone, }, ) if err != nil { panic(err) } e.Spawn(txt) //fmt.Println(rect.GetLayer(), player.GetLayer()) fmt.Println("Starting...") err = e.Run() if err != nil { panic(err) } }