diff --git a/autoloads/console.gd b/autoloads/console.gd new file mode 100644 index 0000000..0f090c0 --- /dev/null +++ b/autoloads/console.gd @@ -0,0 +1,29 @@ +extends CanvasLayer + +export var opacity: float = 0.5 + +var lines: int = 0 + +onready var label: Label = $Label + +func _ready() -> void: + label.visible = false + label.modulate.a = opacity + $Label/Panel.modulate.a = opacity + +func _physics_process(delta: float) -> void: + if Input.is_action_just_pressed("debug_show"): + label.visible = not label.visible + +func print(text) -> void: + lines += 1 + if lines > 1: + label.text += "\n" + if lines > 10: + var n = label.text.find("\n") + var t = label.text + t.erase(0, n+1) + lines -= 1 + label.text = t + str(text) + else: + label.text += str(text) diff --git a/autoloads/console.tscn b/autoloads/console.tscn new file mode 100644 index 0000000..20cf7ec --- /dev/null +++ b/autoloads/console.tscn @@ -0,0 +1,17 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://autoloads/console.gd" type="Script" id=1] + +[node name="Console" type="CanvasLayer"] +layer = 128 +script = ExtResource( 1 ) + +[node name="Label" type="Label" parent="."] +anchor_right = 1.0 +margin_bottom = 14.0 +size_flags_vertical = 2 + +[node name="Panel" type="Panel" parent="Label"] +show_behind_parent = true +anchor_right = 1.0 +anchor_bottom = 1.0 diff --git a/autoloads/debug.gd b/autoloads/debug.gd index 36dab58..14bd343 100644 --- a/autoloads/debug.gd +++ b/autoloads/debug.gd @@ -4,11 +4,9 @@ extends CanvasLayer #Const const ENTRY_SEQUENCE = ["4", "1", "5"] #Export -export var max_lines: int = 10 -export var opacity: float = 0.5 + #Onready -onready var console = $Console -onready var code_label = get_parent().get_node("Main/Control/ViewportContainer/Viewport/CheatLayer/CheatLabel") +onready var code_label = $CheatLabel ##Runtime var lines: int = 0 var time: float = 0.0 @@ -27,33 +25,26 @@ var code = "" func _ready(): #Auto do debug when playtesting if not OS.is_debug_build(): - console.visible = false debug = false else: - console.visible = false debug = true - $Console/Panel.modulate.a = opacity - console.modulate.a = opacity func _physics_process(delta): #DEBUG if debug == true && !entry && !entry_index > 0: - #Show console - if Input.is_action_just_pressed("debug_show"): - console.visible = !console.visible #Move player to mouse if Input.is_action_pressed("debug_move_player"): var nodes = get_tree().get_nodes_in_group("player") if not nodes.empty(): var player = nodes[0].get_parent() - var mouse_position = Game.viewport.get_mouse_position() / Game.viewport_container.rect_scale + var mouse_position = SceneManager.viewport.get_mouse_position() / SceneManager.viewport_container.rect_scale mouse_position.x = clamp(mouse_position.x, 8.0, Game.resolution.x - 8.0) mouse_position.y = clamp(mouse_position.y, 8.0, Game.resolution.y - 8.0) var world_position = mouse_position + Game.current_sector * Game.resolution player.position = world_position # Game.get_map().get_node("Player").position = get_viewport().get_mouse_position() -# Debug.print(get_viewport().get_mouse_position()) +# Console.print(get_viewport().get_mouse_position()) #Test room if Input.is_action_just_pressed("debug_testroom"): Game.change_map(load("res://maps/test_room.tscn")) @@ -64,25 +55,6 @@ func _physics_process(delta): if Input.is_action_just_pressed("debug_2"): Game.freeze_frame(1.0) -func print(text): - lines += 1 - if lines > 1: - console.text += "\n" - if lines > 10: - var n = console.text.find("\n") - var t = console.text - t.erase(0, n+1) - lines -= 1 - console.text = t + str(text) - else: - console.text += str(text) - -func _on_visible_toggled(button_pressed): - if button_pressed: - console.visible = true - else: - console.visible = false - func _input(event): if event is InputEventKey && event.is_pressed(): var character = OS.get_scancode_string(event.scancode) @@ -126,7 +98,7 @@ func _enter_code(): "DGSTEEZY": debug = true "6DOUBLOONS": - Debug.print(get_tree().get_nodes_in_group("gold").size()) + Console.print(get_tree().get_nodes_in_group("gold").size()) "EVILSBANE": allow_sword = true Input.action_press("sword") diff --git a/autoloads/debug.tscn b/autoloads/debug.tscn index 5d0acdc..c6263c9 100644 --- a/autoloads/debug.tscn +++ b/autoloads/debug.tscn @@ -1,36 +1,17 @@ [gd_scene load_steps=4 format=2] [ext_resource path="res://autoloads/debug.gd" type="Script" id=1] +[ext_resource path="res://ui/2ndpuberty_no_dropshadow.tres" type="Theme" id=2] +[ext_resource path="res://ui/2ndpuberty_outline.tres" type="Material" id=3] -[sub_resource type="InputEventAction" id=4] -action = "toggle_console" - -[sub_resource type="ShortCut" id=3] -shortcut = SubResource( 4 ) - -[node name="Debug" type="CanvasLayer"] +[node name="Debug" type="CanvasLayer" groups=["viewport_autoload"]] layer = 128 script = ExtResource( 1 ) -[node name="Console" type="Label" parent="."] -anchor_right = 1.0 -size_flags_vertical = 2 - -[node name="Panel" type="Panel" parent="Console"] -show_behind_parent = true +[node name="CheatLabel" type="Label" parent="."] +material = ExtResource( 3 ) anchor_right = 1.0 anchor_bottom = 1.0 - -[node name="VisibleToggle" type="CheckBox" parent="."] -visible = false -anchor_left = 1.0 -anchor_right = 1.0 -margin_left = -22.0 -margin_top = 173.0 -margin_right = 57.0 -margin_bottom = 197.0 -pressed = true -shortcut = SubResource( 3 ) -text = "Console" - -[connection signal="toggled" from="VisibleToggle" to="." method="_on_visible_toggled"] +theme = ExtResource( 2 ) +align = 2 +valign = 2 diff --git a/scripts/fade.gd b/autoloads/fade.gd similarity index 100% rename from scripts/fade.gd rename to autoloads/fade.gd diff --git a/autoloads/fade.tscn b/autoloads/fade.tscn new file mode 100644 index 0000000..46eb839 --- /dev/null +++ b/autoloads/fade.tscn @@ -0,0 +1,61 @@ +[gd_scene load_steps=7 format=2] + +[ext_resource path="res://graphics/fade_patterns/diamonds2.png" type="Texture" id=1] +[ext_resource path="res://autoloads/fade.gd" type="Script" id=2] +[ext_resource path="res://shaders/fade.gdshader" type="Shader" id=3] + +[sub_resource type="ShaderMaterial" id=6] +shader = ExtResource( 3 ) +shader_param/color = Color( 0, 0, 0, 1 ) +shader_param/smooth_mode = false +shader_param/reverse = false +shader_param/opacity = 0.0 + +[sub_resource type="Animation" id=7] +resource_name = "FadeIn" +tracks/0/type = "value" +tracks/0/path = NodePath("TextureRect:material:shader_param/opacity") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0, 1 ), +"transitions": PoolRealArray( 1, 1 ), +"update": 0, +"values": [ 1.0, 0.0 ] +} + +[sub_resource type="Animation" id=8] +resource_name = "FadeOut" +tracks/0/type = "value" +tracks/0/path = NodePath("TextureRect:material:shader_param/opacity") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0, 1 ), +"transitions": PoolRealArray( 1, 1 ), +"update": 0, +"values": [ 0.0, 1.0 ] +} + +[node name="Fade" type="CanvasLayer" groups=["viewport_autoload"]] +pause_mode = 2 +layer = 125 +script = ExtResource( 2 ) + +[node name="TextureRect" type="TextureRect" parent="."] +material = SubResource( 6 ) +margin_right = 256.0 +margin_bottom = 192.0 +texture = ExtResource( 1 ) +expand = true +stretch_mode = 6 + +[node name="AnimationPlayer" type="AnimationPlayer" parent="."] +anims/FadeIn = SubResource( 7 ) +anims/FadeOut = SubResource( 8 ) + +[connection signal="animation_finished" from="AnimationPlayer" to="." method="_fade_finished"] diff --git a/autoloads/game.gd b/autoloads/game.gd index 1c70e9b..4cce054 100644 --- a/autoloads/game.gd +++ b/autoloads/game.gd @@ -1,11 +1,8 @@ extends Node var resolution = Vector2(256,192) -onready var viewport = get_parent().get_node("Main/Control/ViewportContainer/Viewport") var current_sector = Vector2(0,0) #Onreadys -onready var fade = viewport.get_node("FadeLayer") -onready var viewport_container = get_parent().get_node("Main/Control/ViewportContainer") #Collectibles var golds = 0 var stars = [false,false,false,false,false] @@ -48,17 +45,15 @@ func get_map(): return get_tree().get_nodes_in_group("map")[0] #Go to new map -func change_map(map): +func change_map(map: PackedScene): get_tree().paused = true can_pause = false - fade.fade_out(0.4) - yield(fade, "fade_finished") + Fade.fade_out(0.4) + yield(Fade, "fade_finished") can_pause = true clear_collectibles() #Loop is so no more than one level is loaded at a time - for maps in get_tree().get_nodes_in_group("map"): - maps.queue_free() - instance_node(map,0,0,viewport) + SceneManager.current_scene = map.instance() #Clear data func clear_collectibles(): @@ -129,9 +124,3 @@ func freeze_frame(time): #Check if 100%ed func has_collection_bonus(): return shards == 5 && golds == 50 - -func _physics_process(delta): - if Debug.entry == false: - #CRT FILTER - if Input.is_action_just_pressed("crt"): - viewport_container.material.set_shader_param("enabled",!viewport_container.material.get_shader_param("enabled")) diff --git a/autoloads/scene_manager.gd b/autoloads/scene_manager.gd new file mode 100644 index 0000000..ccb8aa6 --- /dev/null +++ b/autoloads/scene_manager.gd @@ -0,0 +1,83 @@ +## manages current scene and viewport scaling +extends Node + +# methods of scaling viewport +enum ScalingMode { + INTEGER, # maintain aspect ratio and scale by whole numbers + ASPECT, # maintain aspect ratio + STRETCH, # stretch to fill screen +} + +## method used to scale game viewport +export (ScalingMode) var scaling_mode: int = ScalingMode.INTEGER + +# node references # +onready var viewport_container: ViewportContainer = $ViewportContainer +onready var viewport: Viewport = $ViewportContainer/Viewport + +var resolution: Vector2 + +var current_scene: Node setget change_scene + +## change the current scene +func change_scene(new_scene: Node) -> void: + # remove current scene if it exists + if current_scene != null: + viewport.remove_child(current_scene) + current_scene.queue_free() + # remove child from parent if it has one + if new_scene.is_inside_tree(): + new_scene.get_parent().call_deferred("remove_child", new_scene) + # add new scene to tree + viewport.call_deferred("add_child", new_scene) + current_scene = new_scene + +func _ready() -> void: + var tree := get_tree() + # capture initial scene + if tree.current_scene != self: + change_scene(tree.current_scene) + tree.current_scene = self + # capture autoloads in the group "viewport_autoload" + for node in tree.get_nodes_in_group("viewport_autoload"): + node.get_parent().call_deferred("remove_child", node) + viewport.call_deferred("add_child", node) + + # get design resolution from project settings + var project_resolution := Vector2( + ProjectSettings.get_setting("display/window/size/width"), + ProjectSettings.get_setting("display/window/size/height") + ) + viewport.size = project_resolution + resolution = project_resolution + # size container and pivot on center + viewport_container.rect_size = resolution + viewport_container.rect_pivot_offset = resolution / 2.0 + # fix viewportcontainer input bug + viewport.set_deferred("handle_input_locally", true) + # connect resized signal + tree.connect("screen_resized", self, "_on_screen_resized") + _on_screen_resized() + +func _process(delta: float) -> void: + if Debug.entry == false: + #CRT FILTER + if Input.is_action_just_pressed("crt"): + viewport_container.material.set_shader_param("enabled", not viewport_container.material.get_shader_param("enabled")) + +func _on_screen_resized() -> void: + var screen_size := OS.window_size + var scale_delta := screen_size / resolution + + match scaling_mode: + ScalingMode.INTEGER: + # find smaller scale difference, floor to integer + var scale = floor(min(scale_delta.x, scale_delta.y)) + viewport_container.rect_scale = Vector2(scale, scale) + ScalingMode.ASPECT: + # find smaller scale difference + var scale = min(scale_delta.x, scale_delta.y) + viewport_container.rect_scale = Vector2(scale, scale) + ScalingMode.STRETCH: + # simply use scale difference + viewport_container.rect_scale = scale_delta diff --git a/autoloads/scene_manager.tscn b/autoloads/scene_manager.tscn new file mode 100644 index 0000000..b98291f --- /dev/null +++ b/autoloads/scene_manager.tscn @@ -0,0 +1,34 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://autoloads/scene_manager.gd" type="Script" id=1] +[ext_resource path="res://shaders/lcd.gdshader" type="Shader" id=2] + +[sub_resource type="ShaderMaterial" id=1] +shader = ExtResource( 2 ) +shader_param/enabled = false +shader_param/resolution = Vector2( 256, 192 ) +shader_param/curvature = Vector2( 0, 0 ) +shader_param/scanline_opacity = Vector2( 0, 0 ) +shader_param/brightness = null + +[node name="SceneManager" type="Node"] +pause_mode = 2 +script = ExtResource( 1 ) + +[node name="ViewportContainer" type="ViewportContainer" parent="."] +material = SubResource( 1 ) +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +margin_left = -128.0 +margin_top = -96.0 +margin_right = 128.0 +margin_bottom = 96.0 +mouse_filter = 1 + +[node name="Viewport" type="Viewport" parent="ViewportContainer"] +size = Vector2( 256, 192 ) +handle_input_locally = false +usage = 0 +render_target_update_mode = 3 diff --git a/control.tscn b/control.tscn deleted file mode 100644 index 5cb46a3..0000000 --- a/control.tscn +++ /dev/null @@ -1,125 +0,0 @@ -[gd_scene load_steps=14 format=2] - -[ext_resource path="res://scripts/scaling.gd" type="Script" id=1] -[ext_resource path="res://graphics/borders/prideborder.png" type="Texture" id=2] -[ext_resource path="res://maps/level_select.tscn" type="PackedScene" id=3] -[ext_resource path="res://shaders/lcd.gdshader" type="Shader" id=4] -[ext_resource path="res://ui/2ndpuberty_no_dropshadow.tres" type="Theme" id=5] -[ext_resource path="res://ui/2ndpuberty_outline.tres" type="Material" id=6] -[ext_resource path="res://graphics/fade_patterns/diamonds2.png" type="Texture" id=7] -[ext_resource path="res://scripts/fade.gd" type="Script" id=8] -[ext_resource path="res://shaders/fade.gdshader" type="Shader" id=9] - -[sub_resource type="ShaderMaterial" id=1] -shader = ExtResource( 4 ) -shader_param/enabled = false -shader_param/resolution = Vector2( 256, 192 ) -shader_param/curvature = Vector2( inf, inf ) -shader_param/scanline_opacity = Vector2( 0.125, 0.125 ) -shader_param/brightness = 1.1 - -[sub_resource type="ShaderMaterial" id=6] -shader = ExtResource( 9 ) -shader_param/color = Color( 0, 0, 0, 1 ) -shader_param/smooth_mode = false -shader_param/reverse = false -shader_param/opacity = 0.0 - -[sub_resource type="Animation" id=7] -resource_name = "FadeIn" -tracks/0/type = "value" -tracks/0/path = NodePath("TextureRect:material:shader_param/opacity") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/keys = { -"times": PoolRealArray( 0, 1 ), -"transitions": PoolRealArray( 1, 1 ), -"update": 0, -"values": [ 1.0, 0.0 ] -} - -[sub_resource type="Animation" id=8] -resource_name = "FadeOut" -tracks/0/type = "value" -tracks/0/path = NodePath("TextureRect:material:shader_param/opacity") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/keys = { -"times": PoolRealArray( 0, 1 ), -"transitions": PoolRealArray( 1, 1 ), -"update": 0, -"values": [ 0.0, 1.0 ] -} - -[node name="Control" type="Control"] -pause_mode = 2 -anchor_right = 1.0 -anchor_bottom = 1.0 -margin_right = -16.0 -margin_bottom = -48.0 -rect_pivot_offset = Vector2( 128, 96 ) -size_flags_horizontal = 2 -size_flags_vertical = 2 -script = ExtResource( 1 ) - -[node name="TextureRect" type="TextureRect" parent="."] -anchor_right = 1.0 -anchor_bottom = 1.0 -texture = ExtResource( 2 ) -expand = true - -[node name="ViewportContainer" type="ViewportContainer" parent="."] -material = SubResource( 1 ) -anchor_left = 0.5 -anchor_top = 0.5 -anchor_right = 0.5 -anchor_bottom = 0.5 -margin_left = -120.0 -margin_top = -72.0 -margin_right = 136.0 -margin_bottom = 120.0 -rect_pivot_offset = Vector2( 128, 96 ) -mouse_filter = 1 - -[node name="Viewport" type="Viewport" parent="ViewportContainer"] -size = Vector2( 256, 192 ) -handle_input_locally = false -render_target_update_mode = 3 - -[node name="LevelSelect" parent="ViewportContainer/Viewport" instance=ExtResource( 3 )] - -[node name="CheatLayer" type="CanvasLayer" parent="ViewportContainer/Viewport"] -layer = 120 - -[node name="CheatLabel" type="Label" parent="ViewportContainer/Viewport/CheatLayer"] -material = ExtResource( 6 ) -anchor_right = 1.0 -anchor_bottom = 1.0 -margin_right = -1.0 -margin_bottom = -5.0 -theme = ExtResource( 5 ) -align = 2 -valign = 2 - -[node name="FadeLayer" type="CanvasLayer" parent="ViewportContainer/Viewport"] -pause_mode = 2 -layer = 125 -script = ExtResource( 8 ) - -[node name="TextureRect" type="TextureRect" parent="ViewportContainer/Viewport/FadeLayer"] -material = SubResource( 6 ) -margin_right = 256.0 -margin_bottom = 192.0 -texture = ExtResource( 7 ) -expand = true -stretch_mode = 6 - -[node name="AnimationPlayer" type="AnimationPlayer" parent="ViewportContainer/Viewport/FadeLayer"] -anims/FadeIn = SubResource( 7 ) -anims/FadeOut = SubResource( 8 ) - -[connection signal="animation_finished" from="ViewportContainer/Viewport/FadeLayer/AnimationPlayer" to="ViewportContainer/Viewport/FadeLayer" method="_fade_finished"] diff --git a/main.tscn b/main.tscn deleted file mode 100644 index 80d3180..0000000 --- a/main.tscn +++ /dev/null @@ -1,7 +0,0 @@ -[gd_scene load_steps=2 format=2] - -[ext_resource path="res://control.tscn" type="PackedScene" id=1] - -[node name="Main" type="Node2D"] - -[node name="Control" parent="." instance=ExtResource( 1 )] diff --git a/maps/level_select.gd b/maps/level_select.gd index c801253..bdb01df 100644 --- a/maps/level_select.gd +++ b/maps/level_select.gd @@ -31,7 +31,7 @@ export var target_time_any = 0 # Called when the node enters the scene tree for the first time. func _ready(): - Game.fade.fade_in(0.000000000000001) + Fade.fade_in(0.000000000000001) change_current_level(Game.current_level) Audio.ac_music.stop() diff --git a/maps/map.gd b/maps/map.gd index 4388271..892ceea 100644 --- a/maps/map.gd +++ b/maps/map.gd @@ -11,9 +11,9 @@ var collectible_bonus = false func _ready(): get_tree().paused = true Game.can_pause = false - Game.fade.fade_in(0.4) - Game.fade.connect("fade_finished", get_tree(), "set_pause", [false], CONNECT_ONESHOT) - Game.fade.connect("fade_finished", Game, "set", ["can_pause", true], CONNECT_ONESHOT) + Fade.fade_in(0.4) + Fade.connect("fade_finished", get_tree(), "set_pause", [false], CONNECT_ONESHOT) + Fade.connect("fade_finished", Game, "set", ["can_pause", true], CONNECT_ONESHOT) Audio.play_music(music) func _physics_process(delta): diff --git a/objects/hud/pause_screen.gd b/objects/hud/pause_screen.gd index 79cbc54..1fbe33d 100644 --- a/objects/hud/pause_screen.gd +++ b/objects/hud/pause_screen.gd @@ -13,7 +13,7 @@ func _physics_process(delta): queue_free() get_tree().paused = false - Debug.print(get_tree().paused) + Console.print(get_tree().paused) func _on_Resume_pressed(): get_tree().paused = false diff --git a/objects/npc/msx.gd b/objects/npc/msx.gd index 0e4bfe8..5d0c4a5 100644 --- a/objects/npc/msx.gd +++ b/objects/npc/msx.gd @@ -26,7 +26,7 @@ func _physics_process(delta): anims.play("walk") #Stop at the end of path and give shard if position.x <= 80: - Debug.print(Game.shards_collected) + Console.print(Game.shards_collected) is_moving = false velocity.x = 0 if is_holding_shard: diff --git a/project.godot b/project.godot index 5493c11..eb6ba88 100644 --- a/project.godot +++ b/project.godot @@ -21,7 +21,7 @@ _global_script_class_icons={ [application] config/name="Hero Mark 2" -run/main_scene="res://main.tscn" +run/main_scene="res://maps/level_select.tscn" config/use_custom_user_dir=true config/custom_user_dir_name="heromark2" config/icon="res://icon.png" @@ -35,11 +35,16 @@ Save="*res://autoloads/save.gd" Debug="*res://autoloads/debug.tscn" Options="*res://autoloads/options.gd" TouchControls="*res://autoloads/touch_controls.tscn" +SceneManager="*res://autoloads/scene_manager.tscn" +Console="*res://autoloads/console.tscn" +Fade="*res://autoloads/fade.tscn" [display] window/size/width=256 window/size/height=192 +window/size/test_width=512 +window/size/test_height=384 window/handheld/orientation="sensor_landscape" [editor_plugins] diff --git a/scripts/scaling.gd b/scripts/scaling.gd deleted file mode 100644 index ea1d754..0000000 --- a/scripts/scaling.gd +++ /dev/null @@ -1,56 +0,0 @@ -extends Control - -var multiple = 1 -onready var viewport = $ViewportContainer -onready var border = $TextureRect -onready var cheat_label = $ViewportContainer/Viewport/ - -# INTEGER SCALE SETTINGS -export var overscale = 0 -onready var root = get_tree().root -# RESOLUTION -onready var res = Game.resolution -onready var half_res = Vector2(res.x/2,res.y/2) - -func _ready(): - #SCREEN RESIZE SIGNAL - get_tree().connect("screen_resized", self, "_on_screen_resized") - root.set_attach_to_screen_rect(root.get_visible_rect()) - _on_screen_resized() - #STUPID VIEWPORT GODOT BUG FIX - $ViewportContainer/Viewport.set_deferred("handle_input_locally", true) - -func _on_screen_resized(): -# VARS - var window_size = OS.get_window_size() - match Options.scaling_mode: - Options.ScalingMode.INTEGER: - # CENTER THE VIEWPORT - viewport.rect_position.x = (window_size.x / 2) - half_res.x - viewport.rect_position.y = (window_size.y / 2) - half_res.y - # DETERMINE WHAT THE HIGHEST INTEGER MULTIPLE IS - multiple = (window_size / res).floor() - # SET THE HIGHEST SCALE AXIS TO THE LOWEST TO STAY SQUARE - if multiple.x < multiple.y: multiple.y = multiple.x - if multiple.x > multiple.y: multiple.x = multiple.y - # SCALE THE VIEWPORT (IF OVERSCALE IS ON, SCALE IT BY 1 EXTRA) - viewport.rect_scale = multiple + Vector2(overscale,overscale) - #viewport.rect_scale = Vector2(2,2) - Options.ScalingMode.ASPECT: - # CENTER THE VIEWPORT - viewport.rect_position.x = (window_size.x / 2) - half_res.x - viewport.rect_position.y = (window_size.y / 2) - half_res.y - # DETERMINE WHAT THE HIGHEST INTEGER MULTIPLE IS - multiple = window_size / res - # SET THE HIGHEST SCALE AXIS TO THE LOWEST TO STAY SQUARE - if multiple.x < multiple.y: multiple.y = multiple.x - if multiple.x > multiple.y: multiple.x = multiple.y - # SCALE THE VIEWPORT - viewport.rect_scale = multiple - Options.ScalingMode.STRETCH: - viewport.rect_position.x = (window_size.x / 2) - half_res.x - viewport.rect_position.y = (window_size.y / 2) - half_res.y - viewport.rect_scale = window_size / res -# BORDER - border.rect_size = window_size -