chore: reorganize project structure
This commit is contained in:
parent
8983b84731
commit
8e0bcc51a3
14 changed files with 14 additions and 14 deletions
33
scenes/main.gd
Normal file
33
scenes/main.gd
Normal file
|
@ -0,0 +1,33 @@
|
|||
extends Node
|
||||
|
||||
|
||||
@export var dragon_template: PackedScene
|
||||
@export var dragon_spots: Array[Node2D]
|
||||
|
||||
var _instantiator: DragonInstantiator
|
||||
|
||||
|
||||
func _ready():
|
||||
_instantiator = DragonInstantiator.new(dragon_template, dragon_spots)
|
||||
|
||||
await get_tree().process_frame
|
||||
move_window_to_bottom_right()
|
||||
|
||||
|
||||
func move_window_to_bottom_right():
|
||||
var display_index: int = DisplayServer.window_get_current_screen()
|
||||
|
||||
var work_area_position: Vector2i = DisplayServer.screen_get_usable_rect(display_index).position
|
||||
var work_area_size: Vector2i = DisplayServer.screen_get_usable_rect(display_index).size
|
||||
|
||||
var window_size: Vector2i = DisplayServer.window_get_size()
|
||||
|
||||
var new_position: Vector2i = work_area_position + Vector2i(work_area_size.x - window_size.x, work_area_size.y - window_size.y)
|
||||
|
||||
DisplayServer.window_set_position(new_position)
|
||||
|
||||
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed("ui_accept"):
|
||||
var dragon = _instantiator.instantiate()
|
||||
add_child(dragon)
|
Loading…
Add table
Add a link
Reference in a new issue