Skip to content
Snippets Groups Projects
Commit 33d2238d authored by htoo-aung's avatar htoo-aung
Browse files

fixed bug: button would not resize to texture size

parent 79187622
No related branches found
No related tags found
No related merge requests found
......@@ -29,14 +29,14 @@ dock_5="Inspector,Node,History"
open_scenes=PackedStringArray("res://main.tscn", "res://scenes/scene_manager.tscn", "res://scenes/game.tscn", "res://scenes/ui/pop_up_label.tscn", "res://scenes/screens/title_screen.tscn", "res://scenes/screens/select_piece_screen.tscn", "res://scenes/ui/menu_button.tscn")
current_scene="res://main.tscn"
center_split_offset=-570
selected_default_debugger_tab_idx=1
selected_main_editor_idx=0
selected_default_debugger_tab_idx=0
selected_main_editor_idx=2
selected_bottom_panel_item=0
[ScriptEditor]
open_scripts=["res://scripts/Assassin.gd", "res://scripts/game.gd", "res://scripts/main/main.gd", "res://scripts/screens/menu_button.gd", "res://scripts/Pawn.gd", "res://scripts/Piece.gd", "res://scripts/ui/pop_up_label.gd", "res://scripts/Queen.gd", "res://scripts/Rook.gd", "res://scripts/run_data/run_data.gd", "res://scripts/scene_manager.gd", "res://scripts/screens/select_piece_screen.gd", "res://scripts/screens/title_screen.gd"]
selected_script="res://scripts/main/main.gd"
selected_script="res://scripts/screens/menu_button.gd"
open_help=[]
script_split_offset=70
list_split_offset=0
......
......@@ -20,3 +20,4 @@ res://scenes/screens/select_piece_screen.tscn
res://scripts/screens/select_piece_screen.gd
res://scenes/ui/menu_button.tscn
res://scripts/screens/title_screen.gd
res://scripts/screens/menu_button.gd
......@@ -147,7 +147,7 @@ state={
"folded_lines": Array[int]([]),
"h_scroll_position": 0,
"row": 17,
"scroll_position": 6.0,
"scroll_position": 0.0,
"selection": false,
"syntax_highlighter": "GDScript"
}
......@@ -157,10 +157,10 @@ state={
state={
"bookmarks": PackedInt32Array(),
"breakpoints": PackedInt32Array(),
"column": 1,
"column": 22,
"folded_lines": Array[int]([]),
"h_scroll_position": 0,
"row": 14,
"row": 6,
"scroll_position": 0.0,
"selection": false,
"syntax_highlighter": "GDScript"
......@@ -171,11 +171,11 @@ state={
state={
"bookmarks": PackedInt32Array(),
"breakpoints": PackedInt32Array(),
"column": 0,
"column": 1,
"folded_lines": Array[int]([]),
"h_scroll_position": 0,
"row": 18,
"scroll_position": 6.0,
"row": 15,
"scroll_position": 6.3,
"selection": false,
"syntax_highlighter": "GDScript"
}
......@@ -53,6 +53,12 @@ list=Array[Dictionary]([{
"language": &"GDScript",
"path": "res://scripts/Rook.gd"
}, {
"base": &"Control",
"class": &"SelectPieceScreen",
"icon": "",
"language": &"GDScript",
"path": "res://scripts/screens/select_piece_screen.gd"
}, {
"base": &"Button",
"class": &"TitleButton",
"icon": "",
......
......@@ -12,9 +12,8 @@ func _ready() -> void:
angle_x_max = deg_to_rad(angle_x_max)
angle_y_max = deg_to_rad(angle_y_max)
# Sets the size to any texture size so 3d effect works on all sizes
size.x = menu_btn_texture.size.x
size.y = menu_btn_texture.size.y
set_button_size()
menu_btn_texture.material = menu_btn_texture.material.duplicate()
func _on_gui_input(event: InputEvent) -> void:
......@@ -46,6 +45,11 @@ func _on_mouse_exited() -> void:
func get_texture_rect() -> TextureRect:
return $MenuTexture
func set_image(image_path: String) -> void:
$MenuTexture.texture = load(image_path)
# Sets the size to any texture size so 3d effect works on all sizes
func set_button_size() -> void:
await get_tree().process_frame
size = menu_btn_texture.texture.get_size()
extends Control
class_name SelectPieceScreen
@onready var scene_manager: Node = $"../SceneManager"
@onready var start_button: TitleButton = $StartButton
......@@ -7,9 +8,6 @@ func _ready() -> void:
# Temp image
start_button.set_image("res://assets/ui/title_screen/play_button.png")
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
func _on_start_pressed() -> void:
RunData.start_run()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment