From 299da206ece46c4ba595aa34ad772c560917b294 Mon Sep 17 00:00:00 2001 From: Anton Petrov Date: Sat, 7 Feb 2026 19:59:03 +0200 Subject: [PATCH] fixed image.new() not trying to use provided path as is --- playdate/image.lua | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/playdate/image.lua b/playdate/image.lua index c20d64f..3b0bacc 100644 --- a/playdate/image.lua +++ b/playdate/image.lua @@ -14,10 +14,16 @@ function module.new(widthOrPath, height, bgcolor) if height then -- creating empty image with dimensions local imageData = love.image.newImageData(widthOrPath, height) - img.data = love.graphics.newImage(imageData) + img.data = love.graphics.newImage(imageData) else -- creating image from file - img.data = love.graphics.newImage(widthOrPath..".png") + if love.filesystem.getInfo(widthOrPath..".png") then + img.data = love.graphics.newImage(widthOrPath..".png") + elseif love.filesystem.getInfo(widthOrPath) then + img.data = love.graphics.newImage(widthOrPath) + else + return nil + end end return img @@ -65,7 +71,7 @@ function meta:draw(x, y, flip, qx, qy, qw, qh) y = y + h end end - + if qx and qy and qw and qh then local w, h = self:getSize() playbit.graphics.quad:setViewport(qx, qy, qw, qh, w, h)