Use webp instead of jpg for cards

This commit is contained in:
Hamcha 2019-05-28 00:57:40 +02:00
parent 336ae08cd0
commit aed1a0b69f
Signed by: hamcha
GPG key ID: A40413D21021EAEE

View file

@ -32,10 +32,10 @@ onready var texture: Texture = cardImage.get_surface_material(0)
func set_cardid(val: String):
cardID = val
if ready:
Remote.fetch(Remote.IMGURL + val + ".jpg", self, "_card_fetched")
Remote.fetch(Remote.IMGURL + val + ".webp", self, "_card_fetched")
func _ready():
Remote.fetch(Remote.IMGURL + cardID + ".jpg", self, "_card_fetched")
Remote.fetch(Remote.IMGURL + cardID + ".webp", self, "_card_fetched")
ready = true
func _mouse_hover():
@ -85,7 +85,7 @@ func _check_drop_anim(anim_name):
func _card_fetched(result: int, response_code: int, headers: PoolStringArray, body: PoolByteArray):
assert(result == HTTPRequest.RESULT_SUCCESS)
var img = Image.new()
var err = img.load_jpg_from_buffer(body)
var err = img.load_webp_from_buffer(body)
assert(err == OK)
# Depending if card pic is a problem or not, rotate the card image mesh
if img.get_width() > img.get_height():