unify main scene for mobile
This commit is contained in:
parent
89518f6aa5
commit
7249e00a92
4 changed files with 37 additions and 69 deletions
15
src/Main.gd
15
src/Main.gd
|
@ -1,8 +1,10 @@
|
|||
extends Control
|
||||
|
||||
onready var taquin = $HSplitContainer/Taquin
|
||||
onready var container = $GridContainer
|
||||
onready var taquin = $GridContainer/Taquin
|
||||
|
||||
func _ready():
|
||||
layout_reflow()
|
||||
load_game()
|
||||
print("Starting state: ", taquin.current_state_name())
|
||||
|
||||
|
@ -11,6 +13,17 @@ func _notification(what):
|
|||
save_game()
|
||||
get_tree().quit() # default behavior
|
||||
|
||||
func layout_reflow():
|
||||
if container == null:
|
||||
return
|
||||
|
||||
if container.rect_size.x < container.rect_size.y:
|
||||
# portrait
|
||||
container.columns = 1
|
||||
else:
|
||||
# landscape
|
||||
container.columns = 2
|
||||
|
||||
# https://docs.godotengine.org/en/3.2/tutorials/io/saving_games.html
|
||||
func save_game():
|
||||
var save_game = File.new()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue