diff options
author | Hop311 <hop3114@gmail.com> | 2023-04-29 21:00:44 +0200 |
---|---|---|
committer | Hop311 <hop3114@gmail.com> | 2023-04-29 21:00:44 +0200 |
commit | 7e2700514652212e50a006ad525e7c7ca8e7840c (patch) | |
tree | 681431640bca4f25f5e383cc7960e5ff228b47cc /game/src/GameSession/MapView.gd | |
parent | 1f8545facd248bbf4ea0cd551fea5f7d9b0efdce (diff) |
Terrain textures + province colour alpha channel
Diffstat (limited to 'game/src/GameSession/MapView.gd')
-rw-r--r-- | game/src/GameSession/MapView.gd | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/game/src/GameSession/MapView.gd b/game/src/GameSession/MapView.gd index 340083f..2e2c5e6 100644 --- a/game/src/GameSession/MapView.gd +++ b/game/src/GameSession/MapView.gd @@ -71,7 +71,8 @@ func _ready(): # Set map mesh size and get bounds _map_mesh.aspect_ratio = GameSingleton.get_aspect_ratio() - _map_shader_material.set_shader_parameter(Events.ShaderManager.param_terrain_tile_factor, float(GameSingleton.get_height()) / 64.0) + _map_shader_material.set_shader_parameter(Events.ShaderManager.param_terrain_tile_factor, + float(GameSingleton.get_height()) / 128.0) var map_mesh_aabb := _map_mesh.get_core_aabb() * _map_mesh_instance.transform _map_mesh_corner = Vector2( min(map_mesh_aabb.position.x, map_mesh_aabb.end.x), @@ -111,15 +112,20 @@ func zoom_in() -> void: func zoom_out() -> void: _zoom_target += _zoom_target_step +func _select_province(index : int) -> void: + _map_shader_material.set_shader_parameter(Events.ShaderManager.param_selected_index, index) + province_selected.emit(index) + +func _deselect_province() -> void: + _select_province(0) + # REQUIREMENTS # * SS-31 func _unhandled_input(event : InputEvent): if _mouse_over_viewport and event.is_action_pressed(_action_click): # Check if the mouse is outside of bounds if _map_mesh.is_valid_uv_coord(_mouse_pos_map): - var selected_index := GameSingleton.get_province_index_from_uv_coords(_mouse_pos_map) - _map_shader_material.set_shader_parameter(Events.ShaderManager.param_selected_index, selected_index) - province_selected.emit(selected_index) + _select_province(GameSingleton.get_province_index_from_uv_coords(_mouse_pos_map)) else: print("Clicked outside the map!") elif event.is_action_pressed(_action_drag): |