aboutsummaryrefslogtreecommitdiff
path: root/game/src/GameSession/MapView.gd
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2023-04-26 01:26:33 +0200
committer GitHub <noreply@github.com>2023-04-26 01:26:33 +0200
commit10053cf259c55ee45803268a844edf1011d8a16b (patch)
treefcf86e6fac31430ba537a0d056e97f901ad76dd7 /game/src/GameSession/MapView.gd
parent639f86febf39184cccde9f898fc328375048233f (diff)
parent563834e7e6f9ce565bbfd553a0d9ff80a98c677d (diff)
Merge pull request #98 from OpenVic2Project/some-cleanup
Req comments + cleanup + c++ registry refactoring
Diffstat (limited to 'game/src/GameSession/MapView.gd')
-rw-r--r--game/src/GameSession/MapView.gd12
1 files changed, 7 insertions, 5 deletions
diff --git a/game/src/GameSession/MapView.gd b/game/src/GameSession/MapView.gd
index 510d70a..e74ea59 100644
--- a/game/src/GameSession/MapView.gd
+++ b/game/src/GameSession/MapView.gd
@@ -41,7 +41,6 @@ var _mouse_over_viewport : bool = true
var _map_mesh : MapMesh
var _map_shader_material : ShaderMaterial
var _map_image_size : Vector2
-var _map_province_index_image : Image
var _map_province_colour_image : Image
var _map_province_colour_texture : ImageTexture
var _map_mesh_corner : Vector2
@@ -77,12 +76,15 @@ func _ready():
return
_map_shader_material = map_material
- # Province index texture
- _map_province_index_image = GameSingleton.get_province_index_image()
- if _map_province_index_image == null:
+ # Province index textures
+ var map_province_index_images := GameSingleton.get_province_index_images()
+ if map_province_index_images == null or map_province_index_images.is_empty():
push_error("Failed to get province index image!")
return
- var province_index_texture := ImageTexture.create_from_image(_map_province_index_image)
+ var province_index_texture := Texture2DArray.new()
+ if province_index_texture.create_from_images(map_province_index_images) != OK:
+ push_error("Failed to generate province index texture array!")
+ return
_map_shader_material.set_shader_parameter(_shader_param_province_index, province_index_texture)
# Province colour texture