15 lines
No EOL
332 B
GDScript
15 lines
No EOL
332 B
GDScript
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 |