Hello, guys!
I'm currently working on an basic inventory system, and currently I'm working on drawing it on screen. I have the following code:
extends Node2D
const Iconset = preload("res://scripts/Iconset.gd")
const Inventory = preload("res://scripts/Inventory.gd")
var font : Font
var iconset : Iconset
var inventory : Inventory
export (PackedScene) var player
func _ready():
var label = Label.new()
font = label.get_font("")
label.queue_free()
iconset = Iconset.new(24, 24, load("res://assets/iconset.png"))
func _draw():
for i in range(inventory.items.size()):
var item = inventory.items[i][0]
var qty = inventory.items[i][1]
draw_texture(iconset.get_icon(item.icon), Vector2(30 * i, 0)) # Draw item icon on screen
draw_string(font, Vector2(30 * i, 0), str(qty)) # (should) Draw item quantity on screen
The _draw() function successfully draw each item on inventory icon on screen with draw_texture(...), but draw_string(...) simply won't draw anything!
I think it's perhaps related with my font parameter passed. Actually, I wanted to use the default font to draw, and accordingly to this (a little old) question, this is the way to get the default font.
What am I doing wrong? Could someone please help me?
Thanks, in advance.