()
| 3205 | } |
| 3206 | |
| 3207 | func (mc *MapContents) UpdateTexture() { |
| 3208 | |
| 3209 | if mc.RenderTexture != nil { |
| 3210 | |
| 3211 | SetRenderTarget(mc.RenderTexture.Texture) |
| 3212 | |
| 3213 | mapColor := getThemeColor(GUIMapColor) |
| 3214 | globals.Renderer.SetDrawColor(mapColor.RGBA()) |
| 3215 | globals.Renderer.RenderFillRect(nil) |
| 3216 | |
| 3217 | guiTex := globals.GUITexture.Texture |
| 3218 | |
| 3219 | for y := 0; y < len(mc.MapData.Data); y++ { |
| 3220 | |
| 3221 | for x := 0; x < len(mc.MapData.Data[y]); x++ { |
| 3222 | |
| 3223 | value := mc.MapData.GetI(x, y) |
| 3224 | |
| 3225 | src := &sdl.FRect{208, 64, 32, 32} |
| 3226 | dst := &sdl.FRect{float32(x) * globals.GridSize, float32(y) * globals.GridSize, globals.GridSize, globals.GridSize} |
| 3227 | |
| 3228 | // Draw the grid space |
| 3229 | |
| 3230 | globals.Renderer.SetDrawColor(mapColor.RGBA()) |
| 3231 | |
| 3232 | guiTex.SetColorMod(mapColor.Sub(5).RGB()) |
| 3233 | guiTex.SetAlphaMod(mapColor[3]) |
| 3234 | globals.Renderer.RenderTextureRotated(guiTex, src, dst, 0, &sdl.FPoint{16, 16}, sdl.FLIP_NONE) |
| 3235 | |
| 3236 | rot := float64(0) |
| 3237 | color := NewColor(255, 255, 255, 255) |
| 3238 | |
| 3239 | if value > 0 { |
| 3240 | |
| 3241 | // Color value is the value contained in the grid without the pattern bits |
| 3242 | colorValue := mc.ColorIndexToColor(value) |
| 3243 | |
| 3244 | color = MapPaletteColors[colorValue-1] |
| 3245 | |
| 3246 | src.X = 544 |
| 3247 | src.Y = 0 |
| 3248 | |
| 3249 | if value&MapPatternCrossed > 0 { |
| 3250 | src.Y = 32 |
| 3251 | } else if value&MapPatternDotted > 0 { |
| 3252 | src.Y = 64 |
| 3253 | } else if value&MapPatternChecked > 0 { |
| 3254 | src.Y = 96 |
| 3255 | } else if value&MapPatternTerrain > 0 { |
| 3256 | src.Y = 128 |
| 3257 | } |
| 3258 | |
| 3259 | rv := mc.MapData.GetI(x+1, y) |
| 3260 | lv := mc.MapData.GetI(x-1, y) |
| 3261 | tv := mc.MapData.GetI(x, y-1) |
| 3262 | bv := mc.MapData.GetI(x, y+1) |
| 3263 | |
| 3264 | // patternValue := mc.ColorIndexToPattern(value) |
no test coverage detected