Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions playdate/image.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down