mirror of
https://github.com/Kugelschieber/go-game.git
synced 2026-01-18 06:40:28 +00:00
Added function to easily access loaded textures.
This commit is contained in:
@@ -11,24 +11,25 @@ const (
|
||||
type Game struct{}
|
||||
|
||||
func (g *Game) Setup() {
|
||||
res, err := goga.LoadRes(gopher_path)
|
||||
// load texture
|
||||
_, err := goga.LoadRes(gopher_path)
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
tex, ok := res.(*goga.Tex)
|
||||
// create sprite
|
||||
tex, err := goga.GetTex("gopher.png")
|
||||
|
||||
if !ok {
|
||||
panic("Resource is not a texture")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
sprite := goga.NewSprite(tex)
|
||||
goga.AddActor(sprite)
|
||||
}
|
||||
|
||||
func (g *Game) Update(delta float64) {
|
||||
}
|
||||
func (g *Game) Update(delta float64) {}
|
||||
|
||||
func main() {
|
||||
game := Game{}
|
||||
|
||||
Reference in New Issue
Block a user