From 0f88bd8f7b842c6bbf2378161c45912b0074b808 Mon Sep 17 00:00:00 2001 From: ShyProton Date: Wed, 23 Apr 2025 22:27:04 -0400 Subject: [PATCH] uses lanczos interpolation to make small cards not look terrible --- card.gd | 5 ++++- card.tscn | 2 -- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/card.gd b/card.gd index cd8dc98..00d0b3f 100644 --- a/card.gd +++ b/card.gd @@ -62,7 +62,7 @@ func _load_data() -> Error: func _load_image() -> Error: # NOTE: Assuming we're going with using the .png cards on board. - var cached_img = FileAccess.get_file_as_bytes("user://card_cache/" + card_id + "/card.jpg") + var cached_img = FileAccess.get_file_as_bytes("user://card_cache/" + card_id + "/card.png") if cached_img.is_empty(): push_error("%sCard on-board image was not found in cache" % _card_error("CACHE")) @@ -75,6 +75,9 @@ func _load_image() -> Error: push_error("%sCard on-board image failed to load correctly" % _card_error("IMAGE")) return FAILED + # TODO: Get the size from the node or some constant variable. + image.resize(125, 175, Image.INTERPOLATE_LANCZOS) + var image_texture = ImageTexture.new() image_texture.set_image(image) diff --git a/card.tscn b/card.tscn index cee634b..f9f50d2 100644 --- a/card.tscn +++ b/card.tscn @@ -7,6 +7,4 @@ offset_left = 794.0 offset_top = 79.0 offset_right = 919.0 offset_bottom = 254.0 -expand_mode = 5 -stretch_mode = 4 script = ExtResource("1_kikvd")