# Duane's Dungeon - a rogue-like game # Copyright (C) 2023 Duane Robertson # state_setup.gd - state of preparation # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . extends State class_name StateSetup const ANDR_SCALE = 0.8 const MAP_BD = 8 const WIN_SIZE = Vector2(1280, 720) var MAP_SZ = Vector2.ONE * (WIN_SIZE.y - MAP_BD * 2) var MAP_POS = Vector2(WIN_SIZE.x - WIN_SIZE.y + MAP_BD, MAP_BD) var map_pos = MAP_POS var portrait = false func _init(): pass func _ready(): super() # game.switches['android'] = true name = 'StateSetup' setup_gui() if game.switches.has('png'): stack(StateMaps) else: stack(StateTitle) Creature.load_species() func setup_gui(): var win_size = get_window().content_scale_size if game.switches.has('android'): # Fake a mobile screen. win_size = Vector2(win_size).orthogonal().abs() get_window().size = win_size * ANDR_SCALE get_window().content_scale_size = win_size if win_size.y > win_size.x: # Either faked or real mobile screen. portrait = true map_pos = map_pos.orthogonal().abs() ProjectSettings.set_setting('screen/immersive', false) # a stony background var back = TextureRect.new() back.texture = load('res://art/back_tex.png') back.size = win_size back.stretch_mode = TextureRect.STRETCH_TILE back.expand_mode = TextureRect.EXPAND_KEEP_SIZE add_child(back) game.background = back # title var title = TextureRect.new() title.texture = load('res://art/title.png') if win_size.x > win_size.y: title.rotation = PI * -0.5 title.position.x += title.size.y title.position.y += title.size.x title.stretch_mode = TextureRect.STRETCH_TILE title.expand_mode = TextureRect.EXPAND_KEEP_SIZE add_child(title) var text_container = VBoxContainer.new() game.text_container = text_container text_container.alignment = BoxContainer.ALIGNMENT_CENTER text_container.size = win_size text_container.mouse_filter = Control.MOUSE_FILTER_IGNORE text_container.z_index = 2 add_child(text_container)