Skip to content

Commit

Permalink
✨ Add controls for zooming on text size with ctrl +/-
Browse files Browse the repository at this point in the history
  • Loading branch information
realkotob committed Sep 3, 2021
1 parent 1479f21 commit 0919e49
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Main.tscn
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
[gd_scene load_steps=7 format=2]
[gd_scene load_steps=8 format=2]

[ext_resource path="res://BookOfShaders.gd" type="Script" id=1]
[ext_resource path="res://DarkTheme.tres" type="Theme" id=2]
[ext_resource path="res://shaders/chapter_12/2d-voronoise.shader" type="Shader" id=3]
[ext_resource path="res://Inconsolata.otf" type="DynamicFontData" id=4]
[ext_resource path="res://TextEdit.gd" type="Script" id=5]

[sub_resource type="ShaderMaterial" id=1]
shader = ExtResource( 3 )
Expand Down Expand Up @@ -109,6 +110,7 @@ smooth_scrolling = true
minimap_draw = true
caret_block_mode = true
caret_blink = true
script = ExtResource( 5 )
__meta__ = {
"_edit_use_anchors_": false
}
Expand Down
17 changes: 17 additions & 0 deletions TextEdit.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
extends TextEdit



# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
if Input.is_action_just_pressed("zoom_in"):
var font_resource = get("custom_fonts/font")
font_resource.set_size(font_resource.get_size() + 1)
if Input.is_action_just_pressed("zoom_out"):
var font_resource = get("custom_fonts/font")
font_resource.set_size(font_resource.get_size() - 1)
13 changes: 13 additions & 0 deletions project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,16 @@ run/main_scene="res://Main.tscn"

window/size/width=1280
window/size/height=720

[input]

zoom_in={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":true,"meta":false,"command":true,"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":true,"meta":false,"command":true,"pressed":false,"scancode":45,"unicode":0,"echo":false,"script":null)
]
}

0 comments on commit 0919e49

Please sign in to comment.