Image & sprites

Can I show an image without using sprite?

I have plenty of images, and I'm encountering senarios where I just want to show an image without making it a sprite. Think background images or something. Can I just show the image?

I've heard around that sprites come with some overhead. And I'm trying to reduce my overhead by reducing my sprites... but everything I look at uses a sprite so... I'm left thinking is it even possible to just tell playdate.graphics to just show an image?

Yep, my game doesn't use a single sprite! You can just image:draw for instance. Or draw INTO an image (pushContext) and THEN draw the result to the screen. And you can apply all kinds of dither fades, rotations, tilings, centering options, transparencies, inversion, etc. when you draw.

image:draw docs

(My Playtime clocks app on the other hand DOES use some full-screen sprites, useful for a scrolling transition from one to another.)

The gfx.sprite.setBackgroundDrawingCallback(drawCallback) function is useful too, for background images

1 Like

I'm sorry I don't understand. I see the image:draw in the doc you provided. But it's not clear to me how to use it.

local pd <const> = playdate
local gfx <const> = pd.graphics

local yourImage = gfx.image.new("path/toYour/PNGfilename")

yourImage:draw(100, 100) 

<const>s optional. A way to save typing of playdate. etc. all the time.

Don't include the ".png" extension in the path.

1 Like