WIP scaling
This commit is contained in:
parent
3680de0c12
commit
3027e4f080
3 changed files with 38 additions and 10 deletions
|
@ -1,17 +1,15 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://Scenes/Components/Card.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://Scenes/Scripts/Game.gd" type="Script" id=1]
|
||||
[ext_resource path="res://Scenes/Components/Card.tscn" type="PackedScene" id=2]
|
||||
|
||||
[node name="Node2D" type="Control"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Node2D2" parent="." instance=ExtResource( 1 )]
|
||||
position = Vector2( 412.914, 481.231 )
|
||||
rotation = -0.188775
|
||||
scale = Vector2( 0.479999, 0.479999 )
|
||||
[node name="Board" type="Node2D" parent="."]
|
||||
|
||||
[node name="Node2D3" parent="." instance=ExtResource( 1 )]
|
||||
position = Vector2( 459.073, 504.964 )
|
||||
rotation = -0.0665061
|
||||
scale = Vector2( 0.479999, 0.479999 )
|
||||
[node name="Node2D3" parent="Board" instance=ExtResource( 2 )]
|
||||
position = Vector2( 736.851, 566.497 )
|
||||
scale = Vector2( 0.3, 0.3 )
|
||||
|
|
15
Scenes/Scripts/Game.gd
Normal file
15
Scenes/Scripts/Game.gd
Normal file
|
@ -0,0 +1,15 @@
|
|||
extends Control
|
||||
|
||||
func _input(event: InputEvent):
|
||||
if event.is_action_pressed("zoom_in"):
|
||||
zoom(true)
|
||||
elif event.is_action_pressed("zoom_out"):
|
||||
zoom(false)
|
||||
|
||||
const SCALE_FACTOR := 0.1
|
||||
|
||||
func zoom(direction: bool):
|
||||
var scaleFactor := 1 + SCALE_FACTOR
|
||||
if not direction:
|
||||
scaleFactor = 1 - SCALE_FACTOR
|
||||
$Board.scale *= scaleFactor
|
|
@ -23,6 +23,21 @@ config/icon="res://icon.png"
|
|||
window/size/width=1280
|
||||
window/size/height=800
|
||||
|
||||
[input]
|
||||
|
||||
zoom_in={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"button_mask":0,"position":Vector2( 0, 0 ),"global_position":Vector2( 0, 0 ),"factor":1.0,"button_index":4,"pressed":false,"doubleclick":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":61,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
zoom_out={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":45,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"button_mask":0,"position":Vector2( 0, 0 ),"global_position":Vector2( 0, 0 ),"factor":1.0,"button_index":5,"pressed":false,"doubleclick":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[rendering]
|
||||
|
||||
quality/driver/driver_name="GLES2"
|
||||
|
|
Loading…
Reference in a new issue