From 9bf56c1386ac9ba84b5d43b3e1255217c8341be2 Mon Sep 17 00:00:00 2001 From: Sander Schobers Date: Mon, 9 Aug 2021 08:28:02 +0200 Subject: [PATCH] Removed unused cube textures. --- cmd/tins2021/levelcontroller.go | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/cmd/tins2021/levelcontroller.go b/cmd/tins2021/levelcontroller.go index 2d3848c..34470fc 100644 --- a/cmd/tins2021/levelcontroller.go +++ b/cmd/tins2021/levelcontroller.go @@ -18,7 +18,7 @@ type levelController struct { Scale float32 Level *tins2021.Level - Cubes map[string]cubeTexture + Cubes cubeTexture Animations map[string]*tins2021.Animations MonsterTextureNames map[tins2021.MonsterType]string @@ -31,11 +31,7 @@ type levelController struct { func newLevelControl(ctx ui.Context, level *tins2021.Level) *levelController { control := &levelController{Level: level, Scale: .6} textures := ctx.Textures() - control.Cubes = map[string]cubeTexture{ - "regular": newCubeTexture(textures, tins2021.Orange), - "blocked": newCubeTexture(textures, tins2021.Purple), - "colored": newCubeTexture(textures, tins2021.Blue), - } + control.Cubes = newCubeTexture(textures, tins2021.Orange) newAnimatedTexture(ctx, "star", "resources/images/star.png", func() image.Image { return tins2021.AnimatePolygon(tins2021.CreateStar(5), tins2021.Yellow, tins2021.NewRotateAnimation(defaultAnimationFrames)) }) @@ -167,12 +163,10 @@ func (r levelController) Render(ctx ui.Context) { } textures := ctx.Textures() - regular := r.Cubes["regular"].Scaled(textures, scale) - // blocked := r.Cubes["blocked"].Scaled(textures, scale) - // colors := r.Cubes["colored"].Scaled(textures, scale) + cubes := r.Cubes.Scaled(textures, scale) - cubeWidth := float32(regular.Normal.Width()) - cubeHeight := float32(regular.Normal.Height()) + cubeWidth := float32(cubes.Normal.Width()) + cubeHeight := float32(cubes.Normal.Height()) player := ctx.Textures().ScaledByName("dwarf", scale*.6) star := tins2021.NewAnimatedTexture(ctx.Textures().ScaledByName("star", scale*.4), defaultAnimationFrames) @@ -201,9 +195,9 @@ func (r levelController) Render(ctx ui.Context) { continue } screenPos, platformPos := positionOfTile(pos, tile) - tileTexture := regular.Normal.Texture + tileTexture := cubes.Normal.Texture if tile.Inversed { - tileTexture = regular.Inversed.Texture + tileTexture = cubes.Inversed.Texture } renderer.DrawTexturePoint(tileTexture, screenPos) r.SmallFont.TextAlign(renderer, platformPos, color.Black, strconv.Itoa(distances[pos]), ui.AlignCenter)