diff --git a/Assets/UI_styles/Themes/Touchscreen/Theme1.tres b/Assets/UI_styles/Themes/Touchscreen/Theme1.tres index 2f4172d6..9cc79eb0 100644 --- a/Assets/UI_styles/Themes/Touchscreen/Theme1.tres +++ b/Assets/UI_styles/Themes/Touchscreen/Theme1.tres @@ -1,4 +1,4 @@ -[gd_resource type="Theme" load_steps=12 format=2] +[gd_resource type="Theme" load_steps=16 format=2] [ext_resource path="res://Assets/Fonts/Ubuntu-Bold.ttf" type="DynamicFontData" id=1] [ext_resource path="res://Assets/UI_styles/Themes/Touchscreen/Theme1/button_normal.tres" type="StyleBox" id=2] @@ -27,6 +27,18 @@ bg_color = Color( 0.6, 0.6, 0.6, 0 ) size = 32 font_data = ExtResource( 4 ) +[sub_resource type="StyleBoxFlat" id=12] +bg_color = Color( 0.501961, 0.501961, 0.501961, 0.501961 ) + +[sub_resource type="StyleBoxFlat" id=17] +bg_color = Color( 0.168627, 0.168627, 0.168627, 1 ) +border_width_left = 30 +border_color = Color( 0.501961, 0.501961, 0.501961, 0.25098 ) + +[sub_resource type="StyleBoxFlat" id=15] + +[sub_resource type="StyleBoxFlat" id=16] + [resource] Button/fonts/font = SubResource( 6 ) Button/styles/disabled = ExtResource( 2 ) @@ -47,3 +59,10 @@ ItemList/constants/line_separation = 10 ItemList/fonts/font = SubResource( 10 ) ItemList/styles/bg = SubResource( 11 ) Label/fonts/font = SubResource( 8 ) +VScrollBar/styles/grabber = SubResource( 12 ) +VScrollBar/styles/grabber_highlight = SubResource( 12 ) +VScrollBar/styles/grabber_pressed = SubResource( 12 ) +VScrollBar/styles/scroll = SubResource( 17 ) +VScrollBar/styles/scroll_focus = SubResource( 17 ) +VSlider/styles/grabber_area = SubResource( 15 ) +VSlider/styles/grabber_area_highlight = SubResource( 16 ) diff --git a/Default_env.tres b/Default_env.tres index 8aa58d5d..0c7e2184 100644 --- a/Default_env.tres +++ b/Default_env.tres @@ -15,6 +15,9 @@ background_sky = SubResource( 1 ) background_sky_orientation = Basis( 0.513608, -0.748734, -0.419051, -0.00874038, 0.483799, -0.875135, 0.85798, 0.453139, 0.241939 ) background_sky_rotation = Vector3( 1.06572, -1.0472, -0.0180642 ) background_sky_rotation_degrees = Vector3( 61.061, -60, -1.035 ) +background_color = Color( 0.0392157, 0, 0.0784314, 1 ) background_energy = 0.0 tonemap_mode = 4 +glow_intensity = 0.0 glow_bicubic_upscale = true +adjustment_enabled = true diff --git a/Doc/Images/Progress.png b/Doc/Images/Progress.png index e9bde08a..ae057320 100644 Binary files a/Doc/Images/Progress.png and b/Doc/Images/Progress.png differ diff --git a/README.md b/README.md index 5b41ba51..56068f6d 100644 --- a/README.md +++ b/README.md @@ -2,12 +2,15 @@ ![Progress][Progress] A space game inspired by Freelancer, Orbiter and EVE Online. -Developed in Godot 3 for desktop and mobile (Android) platforms. +Developed in Godot 3 for desktop (Windows, Linux) and mobile (Android) platforms. [Progress]: Doc/Images/Progress.png "Progress" ## Recent changelog -### Since v0.7-alpha +### Since v0.8-alpha (current) +- A new release! + +### Since v0.7-alpha (previous) - A new star system! - Switched to full-scale stellar bodies (stars and planets are up to scale now). - Using `meters` instead of `units` now. Updated distance prefixes according to @@ -33,6 +36,7 @@ accelerate rapidly. - Fixed lag due to complex collision trimesh. - Autopilot added. - New UI elements. +- Some tweaks to superliminal velocity effects. ## TODO list: - Make primitive building blocks with simple collision shapes (performace). @@ -47,8 +51,11 @@ accelerate rapidly. - Make autopilot detect obstacles. - Add star sprites as LOD2. - Improve star shaders? -- Prevent camera orbiting from interrupting autopilot. +- Prevent camera orbiting from interrupting autopilot and warp effect adjustments. - Disable CD after some velocity threshold. +- Make "Orient only" autopilot feature. +- Nebula LODS. +- Procedural skybox distant light (to get rid of static effect due to warp). ## How to You can download one of the pre-compiled binary in the [releases](https://github.com/roalyr/GDTLancer/releases) section. diff --git a/Scenes/Main.tscn b/Scenes/Main.tscn index 8eb21f59..6ceffc74 100644 --- a/Scenes/Main.tscn +++ b/Scenes/Main.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=35 format=2] +[gd_scene load_steps=36 format=2] [ext_resource path="res://Scripts/Main.gd" type="Script" id=1] [ext_resource path="res://Scenes/Ships/Phoenix_heavy.tscn" type="PackedScene" id=2] @@ -28,6 +28,7 @@ [ext_resource path="res://Scripts/Common/Viewport.gd" type="Script" id=26] [ext_resource path="res://Scripts/Origin_rebase/Rebase_local_stellar.gd" type="Script" id=27] [ext_resource path="res://Scripts/Origin_rebase/Rebase_local_structure.gd" type="Script" id=28] +[ext_resource path="res://Scripts/Common/Constants.gd" type="Script" id=29] [ext_resource path="res://Scripts/Origin_rebase/Rebase_local_planetary.gd" type="Script" id=31] [ext_resource path="res://Scenes/Environment/Systems/Star_system_red.tscn" type="PackedScene" id=32] @@ -86,6 +87,9 @@ script = ExtResource( 16 ) [node name="Common" type="Node" parent="."] +[node name="Constants" type="Node" parent="Common"] +script = ExtResource( 29 ) + [node name="Engine" type="Node" parent="Common"] script = ExtResource( 12 ) @@ -125,7 +129,7 @@ stretch = true [node name="UI" parent="Container" instance=ExtResource( 3 )] [node name="Viewport" type="Viewport" parent="Container"] -size = Vector2( 1024, 600 ) +size = Vector2( 1280, 720 ) handle_input_locally = false render_target_update_mode = 3 script = ExtResource( 13 ) diff --git a/Scenes/UI/UI.tscn b/Scenes/UI/UI.tscn index b8ca8e83..e29e8623 100644 --- a/Scenes/UI/UI.tscn +++ b/Scenes/UI/UI.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=29 format=2] +[gd_scene load_steps=32 format=2] [ext_resource path="res://Scripts/UI.gd" type="Script" id=1] [ext_resource path="res://Assets/UI_styles/Button_red/Red_hover_focus.tres" type="StyleBox" id=2] @@ -36,6 +36,25 @@ font_data = ExtResource( 5 ) [sub_resource type="CanvasItemMaterial" id=3] +[sub_resource type="GDScript" id=8] +script/source = "extends ReferenceRect + + +func _ready(): + self.hide() +" + +[sub_resource type="GDScript" id=7] +script/source = "extends ReferenceRect + +func _ready(): + self.hide() +" + +[sub_resource type="DynamicFont" id=6] +size = 35 +font_data = ExtResource( 5 ) + [node name="UI" type="CanvasLayer"] script = ExtResource( 1 ) @@ -62,9 +81,6 @@ script = ExtResource( 21 ) [node name="Gameplay" type="Control" parent="."] anchor_right = 1.0 anchor_bottom = 1.0 -__meta__ = { -"_edit_use_anchors_": false -} [node name="Debug" type="Control" parent="Gameplay"] visible = false @@ -165,9 +181,9 @@ anchor_left = 0.5 anchor_top = 1.0 anchor_right = 0.5 anchor_bottom = 1.0 -margin_left = -192.0 +margin_left = -289.0 margin_top = -66.0 -margin_right = -4.0 +margin_right = -101.0 margin_bottom = -15.0 custom_colors/font_color = Color( 0.498039, 0.498039, 0.498039, 1 ) custom_fonts/font = SubResource( 4 ) @@ -176,14 +192,29 @@ align = 2 valign = 1 clip_text = true +[node name="Apparent_velocity_c" type="Label" parent="Gameplay"] +anchor_left = 0.5 +anchor_top = 1.0 +anchor_right = 0.5 +anchor_bottom = 1.0 +margin_left = -5.0 +margin_top = -66.0 +margin_right = 365.0 +margin_bottom = -15.0 +custom_colors/font_color = Color( 0.498039, 0.498039, 0.498039, 1 ) +custom_fonts/font = SubResource( 4 ) +text = "| c: 0.0" +valign = 1 +clip_text = true + [node name="Apparent_velocity_units" type="Label" parent="Gameplay"] anchor_left = 0.5 anchor_top = 1.0 anchor_right = 0.5 anchor_bottom = 1.0 -margin_left = 4.0 +margin_left = -93.0 margin_top = -67.0 -margin_right = 94.0 +margin_right = 85.0 margin_bottom = -16.0 custom_colors/font_color = Color( 0.498039, 0.498039, 0.498039, 1 ) custom_fonts/font = SubResource( 4 ) @@ -310,6 +341,7 @@ __meta__ = { } [node name="GUI_desktop" type="Control" parent="."] +visible = false material = SubResource( 3 ) anchor_right = 1.0 anchor_bottom = 1.0 @@ -416,6 +448,7 @@ margin_top = -292.0 margin_right = 316.0 margin_bottom = -75.0 border_color = Color( 0.501961, 0.501961, 0.501961, 0.501961 ) +script = SubResource( 8 ) __meta__ = { "_edit_lock_": true } @@ -436,7 +469,6 @@ anchor_right = 1.0 anchor_bottom = 1.0 focus_mode = 0 theme = ExtResource( 10 ) -auto_height = true script = ExtResource( 19 ) __meta__ = { "_edit_lock_": true @@ -559,7 +591,6 @@ __meta__ = { } [node name="GUI_touchscreen" type="Control" parent="."] -visible = false material = SubResource( 3 ) anchor_right = 1.0 anchor_bottom = 1.0 @@ -604,9 +635,9 @@ flat = true icon_align = 1 [node name="Button_options" type="Button" parent="GUI_touchscreen/Main"] -margin_left = 200.0 +margin_left = 192.0 margin_top = 64.0 -margin_right = 304.0 +margin_right = 296.0 margin_bottom = 168.0 focus_mode = 0 theme = ExtResource( 10 ) @@ -681,6 +712,76 @@ icon = ExtResource( 13 ) flat = true icon_align = 1 +[node name="Button_nav_touchscreen" type="Button" parent="GUI_touchscreen/Main"] +margin_left = 319.0 +margin_top = 64.0 +margin_right = 423.0 +margin_bottom = 168.0 +theme = ExtResource( 10 ) +keep_pressed_outside = true +icon = ExtResource( 18 ) +flat = true +icon_align = 1 + +[node name="Button_target_clear_touchscreen" type="Button" parent="GUI_touchscreen/Main"] +margin_left = 447.0 +margin_top = 64.0 +margin_right = 551.0 +margin_bottom = 168.0 +theme = ExtResource( 10 ) +keep_pressed_outside = true +icon = ExtResource( 23 ) +flat = true +icon_align = 1 + +[node name="Button_autopilot_disable_touchscreen" type="Button" parent="GUI_touchscreen/Main"] +margin_left = 578.0 +margin_top = 66.0 +margin_right = 678.0 +margin_bottom = 166.0 +theme = ExtResource( 10 ) +keep_pressed_outside = true +icon = ExtResource( 24 ) +flat = true +icon_align = 1 + +[node name="Popup_nav_touchscreen" type="ReferenceRect" parent="GUI_touchscreen/Main"] +anchor_left = 1.0 +anchor_right = 1.0 +margin_left = -703.0 +margin_top = 67.0 +margin_right = -200.0 +margin_bottom = 297.0 +border_color = Color( 0.501961, 0.501961, 0.501961, 0.501961 ) +script = SubResource( 7 ) +__meta__ = { +"_edit_lock_": true +} + +[node name="Button_autopilot_start_touchscreen" type="Button" parent="GUI_touchscreen/Main/Popup_nav_touchscreen"] +anchor_left = 1.0 +anchor_right = 1.0 +margin_left = 34.0 +margin_top = 130.0 +margin_right = 134.0 +margin_bottom = 230.0 +theme = ExtResource( 10 ) +keep_pressed_outside = true +icon = ExtResource( 20 ) +flat = true +icon_align = 1 + +[node name="ItemList_nav_touchscreen" type="ItemList" parent="GUI_touchscreen/Main/Popup_nav_touchscreen"] +anchor_right = 1.0 +anchor_bottom = 1.0 +focus_mode = 0 +theme = ExtResource( 10 ) +custom_fonts/font = SubResource( 6 ) +script = ExtResource( 19 ) +__meta__ = { +"_edit_lock_": true +} + [node name="Pad_base" type="Panel" parent="GUI_touchscreen/Main"] anchor_top = 1.0 anchor_bottom = 1.0 @@ -859,6 +960,12 @@ __meta__ = { [connection signal="pressed" from="GUI_touchscreen/Main/_Button_accel_minus" to="." method="_on_Button_accel_minus_pressed"] [connection signal="pressed" from="GUI_touchscreen/Main/_Button_ekill" to="." method="_on_Button_ekill_pressed"] [connection signal="pressed" from="GUI_touchscreen/Main/Button_hide_ui" to="." method="_on_Button_hide_ui_pressed"] +[connection signal="pressed" from="GUI_touchscreen/Main/Button_nav_touchscreen" to="." method="_on_Button_nav_touchscreen_pressed"] +[connection signal="pressed" from="GUI_touchscreen/Main/Button_target_clear_touchscreen" to="." method="_on_Button_target_clear_touchscreen_pressed"] +[connection signal="pressed" from="GUI_touchscreen/Main/Button_autopilot_disable_touchscreen" to="." method="_on_Button_autopilot_disable_touchscreen_pressed"] +[connection signal="pressed" from="GUI_touchscreen/Main/Popup_nav_touchscreen/Button_autopilot_start_touchscreen" to="." method="_on_Button_autopilot_start_touchscreen_pressed"] +[connection signal="item_selected" from="GUI_touchscreen/Main/Popup_nav_touchscreen/ItemList_nav_touchscreen" to="GUI_touchscreen/Main/Popup_nav_touchscreen/ItemList_nav_touchscreen" method="_on_ItemList_nav_item_selected"] +[connection signal="visibility_changed" from="GUI_touchscreen/Main/Popup_nav_touchscreen/ItemList_nav_touchscreen" to="GUI_touchscreen/Main/Popup_nav_touchscreen/ItemList_nav_touchscreen" method="_on_ItemList_nav_visibility_changed"] [connection signal="pressed" from="GUI_touchscreen/Main/Pad_base/Stick" to="." method="_on_Stick_pressed"] [connection signal="released" from="GUI_touchscreen/Main/Pad_base/Stick" to="." method="_on_Stick_released"] [connection signal="pressed" from="GUI_touchscreen/Main/Touch_buttons_container/Touch_ekill" to="." method="_on_Touch_ekill_pressed"] diff --git a/Scripts/Camera_rig.gd b/Scripts/Camera_rig.gd index bc507820..24ab3f07 100644 --- a/Scripts/Camera_rig.gd +++ b/Scripts/Camera_rig.gd @@ -19,8 +19,14 @@ var horiz = 0 var mouse_vector = Vector2(0,0) # TODO: move to common? -var camera_fov_velocity_factor = 1e-5 -var camera_fov_max_delta = 100 +# Those numbers are made to create a distortion effect +var camera_fov_velocity_factor = 1e-4 +var camera_fov_wrap_factor = 21.5 +# TODO: make this reliable +var camera_fov_max_delta = 179 - 60 +var camera_brightness_velocity_factor = 1e-5 +var camera_brightness_max_delta = 5.0 +# TODO: adjust background colors separatenly? var camera_z_near_velocity_factor = 1e-5 @@ -90,6 +96,7 @@ func chase_camera(mv, delta): var init_tilt = Vector2($Camera.rotation.x, $Camera.rotation.y) var init_push = Vector2(0.0, 0.0) var init_fov = Vector2(0.0, 0.0) + var init_brightness = Vector2(0.0, 0.0) var init_near = Vector2(0.0, 0.0) # $Camera.rotation.x - vertical, $Camera.rotation.y - horizontal # UP - DOWN @@ -115,6 +122,7 @@ func chase_camera(mv, delta): var fin_tilt = Vector2(vert, horiz) var fin_push = Vector2(p.ship_state.ship_linear_velocity, 0.0) var fin_fov = Vector2(p.ship_state.ship_linear_velocity, 0.0) + var fin_brightness = Vector2(p.ship_state.ship_linear_velocity, 0.0) var fin_near = Vector2(p.ship_state.ship_linear_velocity, 0.0) var tmp_tilt = init_tilt.linear_interpolate(fin_tilt, delta @@ -123,6 +131,10 @@ func chase_camera(mv, delta): *p.ship.camera_push_velocity_factor,3)) var tmp_fov = init_fov.linear_interpolate(fin_fov, delta * camera_fov_velocity_factor) + var tmp_brightness = init_brightness.linear_interpolate(fin_brightness, delta + * camera_brightness_velocity_factor) + + # Needed to prevent artifacts. var tmp_near = init_near.linear_interpolate(fin_near, delta * camera_z_near_velocity_factor) @@ -145,7 +157,11 @@ func chase_camera(mv, delta): # This simulates warp effect and hides ship model. p.camera.fov = p.common_camera.camera_fov \ - + clamp(5*log(tmp_fov.x), 0.0, camera_fov_max_delta) + + clamp(camera_fov_wrap_factor*log(tmp_fov.x), 0.0, camera_fov_max_delta) + + # Brightness adjustment for velocity. + p.environment.environment.adjustment_brightness = 1.0 \ + + clamp(tmp_brightness.x, 0.0, camera_brightness_max_delta) # Increasing camera Z near value prevents flickering. p.camera.near = p.common_camera.camera_near + tmp_near.x diff --git a/Scripts/Common/Constants.gd b/Scripts/Common/Constants.gd new file mode 100644 index 00000000..2696987a --- /dev/null +++ b/Scripts/Common/Constants.gd @@ -0,0 +1,3 @@ +extends Node + +const C = 299792458 # Speed of light in vacuum diff --git a/Scripts/Main.gd b/Scripts/Main.gd index aa2a9d2e..1c918fa5 100644 --- a/Scripts/Main.gd +++ b/Scripts/Main.gd @@ -1,6 +1,7 @@ extends Node var fps = 0 +var touchscreen_mode = false func _process(_delta): fps = Engine.get_frames_per_second() diff --git a/Scripts/Paths.gd b/Scripts/Paths.gd index 8d0023da..7187d518 100644 --- a/Scripts/Paths.gd +++ b/Scripts/Paths.gd @@ -13,10 +13,12 @@ onready var common_viewport = common.get_node("Viewport") onready var signals = common.get_node("Signals") onready var ship_state = common.get_node("Ship_state") onready var common_space_state = common.get_node("Space_state") +onready var common_constants = common.get_node("Constants") # VIEWPORT CONTAINER onready var container = main.get_node("Container") onready var viewport = container.get_node("Viewport") +onready var environment = viewport.get_node("Environment") # SPACE onready var global_space = viewport.get_node("Global_space") diff --git a/Scripts/Ship.gd b/Scripts/Ship.gd index 510bc1c0..625676aa 100644 --- a/Scripts/Ship.gd +++ b/Scripts/Ship.gd @@ -78,6 +78,7 @@ func _ready(): init_ship() # TODO: move it to dedicated script p.ui_paths.desktop_button_autopilot_disable.hide() + p.ui_paths.touchscreen_button_autopilot_disable.hide() func _integrate_forces(state): @@ -95,8 +96,12 @@ func _integrate_forces(state): # Limiting by engine ticks. It is a hard rebase_limits. # TODO: move capped velocity to constants. - #if vel > 2000000: - # p.signals.emit_signal("sig_accelerate", false) + if vel > p.common_constants.C*0.01 and self.continuous_cd: + self.continuous_cd = false + print("disable ship CCD due to high velocity") + elif vel < p.common_constants.C*0.01 and not self.continuous_cd: + self.continuous_cd = true + print("enable ship CCD") # AUTOPILOT @@ -125,6 +130,7 @@ func _integrate_forces(state): is_engine_kill() autopilot = false p.ui_paths.desktop_button_autopilot_disable.hide() + p.ui_paths.touchscreen_button_autopilot_disable.hide() # Steering. # Get deltas (multiply and clamp): @@ -134,7 +140,20 @@ func _integrate_forces(state): var autopilot_factor_y = clamp(autopilot_torque_factor*steering_vector.y, -1.0, 1.0) var autopilot_factor_z = clamp(autopilot_torque_factor*steering_vector.z, -1.0, 1.0) - if not (p.input.LMB_held or p.ship_state.mouse_flight) and autopilot: + + + # Due to difference in handling LMB and stick actuation, check those separately for + # different game modes. + var control_held = false + if not p.main.touchscreen_mode and p.input.LMB_held: + control_held = true + elif p.main.touchscreen_mode and p.ui.stick_held: + control_held = true + else: + control_held = false + + + if not (control_held or p.ship_state.mouse_flight) and autopilot: # Fix directions being flipped @@ -253,6 +272,7 @@ func is_engine_kill(): func is_autopilot_start(): p.ui_paths.desktop_button_autopilot_disable.show() + p.ui_paths.touchscreen_button_autopilot_disable.show() if p.ship_state.aim_target_locked: # To stop at a reasonable distance. # TODO: figure out a better way? @@ -263,3 +283,4 @@ func is_autopilot_start(): func is_autopilot_disable(): autopilot = false p.ui_paths.desktop_button_autopilot_disable.hide() + p.ui_paths.touchscreen_button_autopilot_disable.hide() diff --git a/Scripts/UI.gd b/Scripts/UI.gd index 9ad15553..954bb571 100644 --- a/Scripts/UI.gd +++ b/Scripts/UI.gd @@ -6,7 +6,6 @@ extends CanvasLayer # VARIABLES var stick_held = false var turret_view = false -var touchscreen_mode = false var update_debug_text_on = false var ui_hidden = false var ui_alpha = 1.0 @@ -14,9 +13,12 @@ var viewport_size = Vector2(1,1) onready var p = get_tree().get_root().get_node("Main/Paths") +# TODO: to paths onready var mouse_vector_debug = p.ui.get_node("Gameplay/Debug/Mouse_vector") +# TODO: to paths onready var apparent_velocity = p.ui.get_node("Gameplay/Apparent_velocity") +onready var apparent_velocity_c = p.ui.get_node("Gameplay/Apparent_velocity_c") onready var apparent_velocity_units = p.ui.get_node("Gameplay/Apparent_velocity_units") @@ -53,6 +55,7 @@ func _process(_delta): if result_s: apparent_velocity.text = str(result_s[0]) apparent_velocity_units.text = str(result_s[1])+"/s" + apparent_velocity_c.text = "| c: " + str(speed_val/p.common_constants.C) p.ui_paths.gameplay.get_node("Accel_ticks").text = str("Accel: ", p.ship_state.accel_ticks) # ================================== Other ==================================== @@ -72,7 +75,7 @@ func update_debug_text(): # UI SWITCHING func _on_Button_touchscreen_switch_pressed(): - touchscreen_mode = true + p.main.touchscreen_mode = true # Main GUI elements. p.ui_paths.gameplay.show() # Controls. @@ -86,7 +89,7 @@ func _on_Button_touchscreen_switch_pressed(): # DESKTOP # UI SWITCHING func _on_Button_cumputer_gui_switch_pressed(): - touchscreen_mode = false + p.main.touchscreen_mode = false # Main GUI elements. p.ui_paths.gameplay.show() # Controls. @@ -218,20 +221,42 @@ func _on_Button_hide_ui_pressed(): func _on_Button_ekill_pressed(): p.signals.emit_signal("sig_engine_kill") +# Navigation button # DESKTOP func _on_Button_nav_pressed(): p.signals.emit_signal("sig_fetch_markers") if not p.ui_paths.desktop_nav_popup.visible: p.ui_paths.desktop_nav_popup.show() else: p.ui_paths.desktop_nav_popup.hide() +# MOBILE +func _on_Button_nav_touchscreen_pressed(): + p.signals.emit_signal("sig_fetch_markers") + if not p.ui_paths.touchscreen_nav_popup.visible: p.ui_paths.touchscreen_nav_popup.show() + else: p.ui_paths.touchscreen_nav_popup.hide() + +# Autopilot controls # DESKTOP func _on_Button_autopilot_start_pressed(): p.signals.emit_signal("sig_autopilot_start") +# MOBILE +func _on_Button_autopilot_start_touchscreen_pressed(): + p.signals.emit_signal("sig_autopilot_start") -# DESKTOP +# DESKTOP func _on_Button_autopilot_disable_pressed(): p.signals.emit_signal("sig_autopilot_disable") + +# MOBILE +func _on_Button_autopilot_disable_touchscreen_pressed(): + p.signals.emit_signal("sig_autopilot_disable") +# Targeting # DESKTOP func _on_Button_target_clear_pressed(): p.signals.emit_signal("sig_target_clear") +# MOBILE +func _on_Button_target_clear_touchscreen_pressed(): + p.signals.emit_signal("sig_target_clear") + + + diff --git a/Scripts/UI/Pad.gd b/Scripts/UI/Pad.gd index 95231bde..38f41f1c 100644 --- a/Scripts/UI/Pad.gd +++ b/Scripts/UI/Pad.gd @@ -12,7 +12,7 @@ func pad_recenter_stick(): func pad_handle_stick(): # Process virtual stick input. - if p.ui.touchscreen_mode: + if p.main.touchscreen_mode: if p.ui.stick_held: stick.position.x = p.input_pad.pad_x_abs-100 stick.position.y = p.input_pad.pad_y_abs-100 diff --git a/Scripts/UI/Targeting.gd b/Scripts/UI/Targeting.gd index 72cac74f..a605ff45 100644 --- a/Scripts/UI/Targeting.gd +++ b/Scripts/UI/Targeting.gd @@ -7,7 +7,7 @@ onready var object_origin = p.ship.global_transform.origin onready var player = p.camera_rig.global_transform.origin var dist_val = 0 -var target_hidden = true +var target_controls_hidden = true func _ready(): # ============================= Connect signals =========================== @@ -17,16 +17,20 @@ func _ready(): p.ui_paths.target.hide() p.ui_paths.desktop_button_target_clear.hide() p.ui_paths.desktop_button_autopilot_start.hide() + p.ui_paths.touchscreen_button_target_clear.hide() + p.ui_paths.touchscreen_button_autopilot_start.hide() func _physics_process(_delta): if p.ship_state.aim_target_locked: - if target_hidden: + if target_controls_hidden: p.ui_paths.target.show() p.ui_paths.desktop_button_target_clear.show() p.ui_paths.desktop_button_autopilot_start.show() - target_hidden = false + p.ui_paths.touchscreen_button_target_clear.show() + p.ui_paths.touchscreen_button_autopilot_start.show() + target_controls_hidden = false # Get coordinates and distance. object_origin = p.ship_state.aim_target.global_transform.origin @@ -55,11 +59,13 @@ func _physics_process(_delta): p.ui_paths.target.get_node("Text_object").set_fit_content_height(true) p.ui_paths.target.get_node("Text_object").text = object_name - elif not p.ship_state.aim_target_locked and not target_hidden: + elif not p.ship_state.aim_target_locked and not target_controls_hidden: p.ui_paths.target.hide() p.ui_paths.desktop_button_target_clear.hide() p.ui_paths.desktop_button_autopilot_start.hide() - target_hidden = true + p.ui_paths.touchscreen_button_target_clear.hide() + p.ui_paths.touchscreen_button_autopilot_start.hide() + target_controls_hidden = true func is_target_clear(): # Clear target. diff --git a/Scripts/UI/Ui_paths.gd b/Scripts/UI/Ui_paths.gd index 5435f283..286eee0d 100644 --- a/Scripts/UI/Ui_paths.gd +++ b/Scripts/UI/Ui_paths.gd @@ -21,12 +21,20 @@ onready var desktop_nav_list = desktop_nav_popup.get_node("ItemList_nav") onready var desktop_button_target_clear = desktop_main.get_node("Button_target_clear") onready var desktop_button_autopilot_disable = desktop_main.get_node("Button_autopilot_disable") onready var desktop_button_autopilot_start = desktop_nav_popup.get_node("Button_autopilot_start") + # Touchscreen UI onready var controls_touchscreen = p.ui.get_node("GUI_touchscreen") onready var touchscreen_options = controls_touchscreen.get_node("Options") onready var touchscreen_main = controls_touchscreen.get_node("Main") onready var touchscreen_pad_base = touchscreen_main.get_node("Pad_base") onready var touchscreen_stick = touchscreen_pad_base.get_node("Stick") +# Touchscreen nav popup +onready var touchscreen_nav_popup = touchscreen_main.get_node("Popup_nav_touchscreen") +onready var touchscreen_nav_list = touchscreen_nav_popup.get_node("ItemList_nav_touchscreen") +# Touchscreen buttons +onready var touchscreen_button_target_clear = touchscreen_main.get_node("Button_target_clear_touchscreen") +onready var touchscreen_button_autopilot_disable = touchscreen_main.get_node("Button_autopilot_disable_touchscreen") +onready var touchscreen_button_autopilot_start = touchscreen_nav_popup.get_node("Button_autopilot_start_touchscreen") # Gameplay UI onready var gameplay = p.ui.get_node("Gameplay") onready var debug = gameplay.get_node("Debug") diff --git a/project.godot b/project.godot index a1f3fb3e..1f134a0a 100644 --- a/project.godot +++ b/project.godot @@ -15,11 +15,6 @@ _global_script_classes=[ { "path": "res://Scripts/Local_space_triggers/Local_space_galaxy.gd" }, { "base": "Area", -"class": "PlanetLocalSpace", -"language": "GDScript", -"path": "res://Scripts/Local_space_triggers/Local_space_planetary.gd" -}, { -"base": "Area", "class": "StellarLocalSpace", "language": "GDScript", "path": "res://Scripts/Local_space_triggers/Local_space_stellar.gd" @@ -36,7 +31,6 @@ _global_script_classes=[ { } ] _global_script_class_icons={ "GalaxyLocalSpace": "res://Assets/UI_images/SVG/icons/galaxy.svg", -"PlanetLocalSpace": "res://Assets/UI_images/SVG/icons/planet_rings.svg", "StellarLocalSpace": "res://Assets/UI_images/SVG/icons/star.svg", "StructureLocalSpace": "res://Assets/UI_images/SVG/icons/structure.svg", "SystemLocalSpace": "res://Assets/UI_images/SVG/icons/system.svg"