mirror of
https://github.com/HarmonyHoney/ROTA.git
synced 2026-07-17 16:46:17 +00:00
user://override.cfg and window/fullscreen on startup! Player jump/grab will not trigger when unpausing the game!(: boot splash!
This commit is contained in:
parent
a6bc523b4d
commit
603c869b63
6 changed files with 73 additions and 33 deletions
BIN
media/image/UI/boot_splash.png
Normal file
BIN
media/image/UI/boot_splash.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
|
|
@ -67,8 +67,8 @@ config/description="by Harmony Honey"
|
|||
run/main_scene="res://src/menu/MenuTitle.tscn"
|
||||
config/use_custom_user_dir=true
|
||||
config/custom_user_dir_name="ROTA-Harmony"
|
||||
boot_splash/image="res://media/image/UI/title.png"
|
||||
boot_splash/fullsize=false
|
||||
config/project_settings_override="user://override.cfg"
|
||||
boot_splash/image="res://media/image/UI/boot_splash.png"
|
||||
boot_splash/bg_color=Color( 0, 0, 0, 1 )
|
||||
config/icon="res://media/image/gobot.png"
|
||||
|
||||
|
|
|
|||
|
|
@ -101,6 +101,9 @@ var squish_from := Vector2.ONE
|
|||
var squish_clock := 0.0
|
||||
var squish_time := 0.5
|
||||
|
||||
var is_unpause := false
|
||||
var unpause_tick := 0
|
||||
|
||||
func _enter_tree():
|
||||
if Engine.editor_hint: return
|
||||
Shared.player = self
|
||||
|
|
@ -164,6 +167,8 @@ func _ready():
|
|||
anim.play("jump")
|
||||
Cutscene.start_game.begin()
|
||||
Cutscene.is_start_game = false
|
||||
|
||||
MenuPause.connect("signal_close", self, "unpause")
|
||||
|
||||
func _physics_process(delta):
|
||||
if Engine.editor_hint: return
|
||||
|
|
@ -182,11 +187,19 @@ func _physics_process(delta):
|
|||
joy_last = joy
|
||||
joy = Input.get_vector("left", "right", "up", "down").round()
|
||||
|
||||
btn_jump = Input.is_action_pressed("jump")
|
||||
btnp_jump = Input.is_action_just_pressed("jump")
|
||||
btn_push = Input.is_action_pressed("grab")
|
||||
btnp_push = Input.is_action_just_pressed("grab")
|
||||
|
||||
# avoid jumping or grabbing when exiting menu
|
||||
if is_unpause:
|
||||
unpause_tick += 1
|
||||
if unpause_tick > 1 and (btnp_jump or btnp_push):
|
||||
is_unpause = false
|
||||
|
||||
if !is_unpause:
|
||||
btn_jump = Input.is_action_pressed("jump")
|
||||
btn_push = Input.is_action_pressed("grab")
|
||||
|
||||
# jump hold time
|
||||
holding_jump = (holding_jump + delta) if btn_jump else 0.0
|
||||
|
||||
|
|
@ -636,3 +649,13 @@ func release_anim():
|
|||
func enter_door():
|
||||
set_physics_process(false)
|
||||
anim.play("idle")
|
||||
|
||||
func unpause(arg):
|
||||
print("unpause")
|
||||
unpause_tick = 0
|
||||
is_unpause = true
|
||||
btn_jump = false
|
||||
btn_push = false
|
||||
|
||||
#btnp_jump = false
|
||||
#btnp_push = false
|
||||
|
|
|
|||
|
|
@ -40,6 +40,10 @@ signal signal_erase_slot(arg)
|
|||
var auto_save_clock := 0.0
|
||||
var auto_save_time := 60.0
|
||||
|
||||
var win_size := Vector2(1280, 720)
|
||||
var win_sizes := [Vector2(640, 360), Vector2(960, 540), Vector2(1280, 720), Vector2(1600, 900),
|
||||
Vector2(1920, 1080), Vector2(2560, 1440), Vector2(3840, 2160)]
|
||||
|
||||
func _ready():
|
||||
Wipe.connect("wipe_out", self, "wipe_out")
|
||||
#set_volume(0, 50)
|
||||
|
|
@ -54,8 +58,15 @@ func _ready():
|
|||
load_data()
|
||||
load_keys()
|
||||
|
||||
# setup window
|
||||
if OS.window_fullscreen:
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
|
||||
else:
|
||||
if OS.window_size in win_sizes:
|
||||
win_size = OS.window_size
|
||||
|
||||
# center window
|
||||
set_window_size()
|
||||
|
||||
func _input(event):
|
||||
if event is InputEventKey and event.pressed and !event.is_echo():
|
||||
|
|
@ -127,6 +138,14 @@ func change_scene():
|
|||
func toggle_fullscreen():
|
||||
OS.window_fullscreen = !OS.window_fullscreen
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN if OS.window_fullscreen else Input.MOUSE_MODE_VISIBLE)
|
||||
if !OS.window_fullscreen:
|
||||
set_window_size()
|
||||
|
||||
func set_window_size(arg : Vector2 = win_size):
|
||||
win_size = arg
|
||||
OS.window_size = arg
|
||||
|
||||
OS.window_position = (OS.get_screen_size() * 0.5) - (OS.window_size * 0.5)
|
||||
|
||||
func burst_screenshot():
|
||||
var dir := Directory.new()
|
||||
|
|
@ -175,6 +194,7 @@ func set_volume(bus = 0, vol = 0):
|
|||
|
||||
func quit():
|
||||
save_data()
|
||||
save_options()
|
||||
get_tree().quit()
|
||||
|
||||
func _notification(what):
|
||||
|
|
@ -325,13 +345,23 @@ func save_options():
|
|||
|
||||
o["sounds"] = int(volume[1] / 10)
|
||||
o["music"] = int(volume[2] / 10)
|
||||
o["fullscreen"] = int(OS.window_fullscreen)
|
||||
o["vsync"] = int(OS.vsync_enabled)
|
||||
if !OS.window_fullscreen:
|
||||
o["size_x"] = OS.window_size.x
|
||||
o["size_y"] = OS.window_size.y
|
||||
# o["fullscreen"] = int(OS.window_fullscreen)
|
||||
# o["vsync"] = int(OS.vsync_enabled)
|
||||
# if !OS.window_fullscreen:
|
||||
# o["size_x"] = OS.window_size.x
|
||||
# o["size_y"] = OS.window_size.y
|
||||
|
||||
file_save_json("user://options.json", o)
|
||||
|
||||
# override
|
||||
var s = "[display/window]\n\n"
|
||||
s += "size/test_width=" + str(win_size.x) + "\n"
|
||||
s += "size/test_height=" + str(win_size.y) + "\n"
|
||||
s += "size/fullscreen=" + str(OS.window_fullscreen).to_lower() + "\n"
|
||||
s += "vsync/use_vsync=" + str(OS.vsync_enabled).to_lower() + "\n"
|
||||
|
||||
file_save("user://override.cfg", s)
|
||||
|
||||
|
||||
func load_options():
|
||||
var d = file_load_json_dict("user://options.json")
|
||||
|
|
@ -340,12 +370,12 @@ func load_options():
|
|||
set_volume(1, int(d["sounds"]) * 10)
|
||||
if d.has("music"):
|
||||
set_volume(2, int(d["music"]) * 10)
|
||||
if d.has("fullscreen"):
|
||||
OS.window_fullscreen = bool(int(d["fullscreen"]))
|
||||
if d.has("vsync"):
|
||||
OS.vsync_enabled = bool(int(d["vsync"]))
|
||||
if d.has("size_x") and d.has("size_y"):
|
||||
OS.window_size = Vector2(float(d["size_x"]), float(d["size_y"]))
|
||||
# if d.has("fullscreen"):
|
||||
# OS.window_fullscreen = bool(int(d["fullscreen"]))
|
||||
# if d.has("vsync"):
|
||||
# OS.vsync_enabled = bool(int(d["vsync"]))
|
||||
# if d.has("size_x") and d.has("size_y"):
|
||||
# OS.window_size = Vector2(float(d["size_x"]), float(d["size_y"]))
|
||||
|
||||
func save_keys(path := "user://keys.tres"):
|
||||
var s_keys = SaveDict.new()
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
[ext_resource path="res://media/audio/sfx/jump2.wav" type="AudioStream" id=11]
|
||||
[ext_resource path="res://media/image/UI/Video.png" type="Texture" id=12]
|
||||
[ext_resource path="res://src/menu/options/Volume.tscn" type="PackedScene" id=13]
|
||||
[ext_resource path="res://src/menu/options/onoff/Fullscreen.gd" type="Script" id=14]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=18]
|
||||
bg_color = Color( 0.75, 0.375, 0.38125, 1 )
|
||||
|
|
@ -27,18 +28,6 @@ shader = ExtResource( 1 )
|
|||
shader_param/line_color = Color( 0, 0, 0, 1 )
|
||||
shader_param/line_thickness = 2.0
|
||||
|
||||
[sub_resource type="GDScript" id=24]
|
||||
script/source = "extends OnOff
|
||||
|
||||
func _ready():
|
||||
is_on = OS.window_fullscreen
|
||||
set_label()
|
||||
|
||||
func set_value():
|
||||
Shared.toggle_fullscreen()
|
||||
MenuOptions.fill_items()
|
||||
"
|
||||
|
||||
[sub_resource type="GDScript" id=25]
|
||||
script/source = "extends OnOff
|
||||
|
||||
|
|
@ -386,7 +375,7 @@ margin_top = 920.0
|
|||
margin_right = 640.0
|
||||
margin_bottom = 990.0
|
||||
rect_min_size = Vector2( 0, 70 )
|
||||
script = SubResource( 24 )
|
||||
script = ExtResource( 14 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,12 @@
|
|||
extends Control
|
||||
|
||||
var list := [Vector2(640, 360), Vector2(960, 540), Vector2(1280, 720), Vector2(1600, 900),
|
||||
Vector2(1920, 1080), Vector2(2560, 1440), Vector2(3840, 2160)]
|
||||
|
||||
var cursor := 1
|
||||
|
||||
onready var list : Array = Shared.win_sizes
|
||||
onready var res := $Resolution
|
||||
|
||||
func _ready():
|
||||
var f = list.find(OS.window_size)
|
||||
var f = list.find(Shared.win_size)
|
||||
if f != -1:
|
||||
cursor = f
|
||||
|
||||
|
|
@ -20,4 +18,4 @@ func show():
|
|||
func axis_x(arg := 1):
|
||||
cursor = clamp(cursor + arg, 0, list.size() - 1)
|
||||
show()
|
||||
OS.window_size = list[cursor]
|
||||
Shared.set_window_size(list[cursor])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue