Skip to content

Commit

Permalink
better performance on loading wordlist
Browse files Browse the repository at this point in the history
  • Loading branch information
daviirodrig committed Aug 15, 2023
1 parent f477e83 commit 1a23e0c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions scripts/WordList.gd
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ extends Control
var shinyCount = 0
var pictureCount = 0

const pixelfont = preload("res://fonts/GnuUnifontFull-Pm9P.ttf")

# Called when the node enters the scene tree for the first time.
func _ready() -> void:
words_builder()
words_builder.call_deferred()
%ImageCounter.text = "Imagens encontradas: {a}/{b}".format(
{"a": pictureCount, "b": len(Consts.has_picture)}
)
Expand All @@ -19,7 +20,7 @@ func word_node(text: String, color: Color = Color.WHITE) -> Label:
var w = Label.new()
w.text = text
w.add_theme_font_size_override("font_size", 67)
w.add_theme_font_override("font", load("res://fonts/GnuUnifontFull-Pm9P.ttf"))
w.add_theme_font_override("font", pixelfont)
w.add_theme_color_override("font_color", color)
return w

Expand Down
3 changes: 2 additions & 1 deletion scripts/tec.gd
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
extends Node2D

var words_scene = preload("res://WordListScene.tscn")

# Called when the node enters the scene tree for the first time.
func _ready() -> void:
Expand Down Expand Up @@ -38,7 +39,7 @@ func _input(event):
elif event.keycode == KEY_ESCAPE:
get_tree().change_scene_to_file("res://initial.tscn")
elif event.keycode == KEY_TAB:
get_tree().change_scene_to_file("res://WordListScene.tscn")
get_tree().change_scene_to_packed(words_scene)
#print_debug("Current Matched Words: ", Consts.matched_words)
elif event.keycode == KEY_UP:
#print_debug("column ", %WordInput.caret_column)
Expand Down

0 comments on commit 1a23e0c

Please sign in to comment.