forked from team-sg/hero-mark-2
ThE GREAT SHATTERINGgit status! control.tscn is DEAD! LoNG LIVE CONTROL.TSCNgit statusgit status! MWAHAHAHAHAHAHAHA
This commit is contained in:
parent
6c22279e41
commit
c1a9ab7cdc
17 changed files with 253 additions and 270 deletions
|
@ -1,18 +0,0 @@
|
|||
extends CanvasLayer
|
||||
|
||||
signal fade_finished
|
||||
|
||||
func fade_in(time, reverse = false, color = Color.black):
|
||||
var rect = $TextureRect
|
||||
rect.material.set_shader_param("color", color)
|
||||
rect.material.set_shader_param("reverse", reverse)
|
||||
$AnimationPlayer.play("FadeIn", -1, 1.0 / time)
|
||||
|
||||
func fade_out(time, reverse = false, color = Color.black):
|
||||
var rect = $TextureRect
|
||||
rect.material.set_shader_param("color", color)
|
||||
rect.material.set_shader_param("reverse", reverse)
|
||||
$AnimationPlayer.play("FadeOut", -1, 1.0 / time)
|
||||
|
||||
func _fade_finished(anim_name):
|
||||
emit_signal("fade_finished")
|
|
@ -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
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue