Possible scale factor of 3?

Hi,
I'm trying to port a Arduboy project to the Playdate.
The Arduboy has a 128x64 resolution and atm. I'm working with a scale factor of 2 on the Playdate (simulator).
That means I center the picture in a 200x120 resolution on the Playdate.
That gives me pretty big borders, but a scale factor of 4 (resolution 100x60) is too small.
So my question is...
Would it be possible to allow a scale factor of 3?

(Sorry if that question is dumb - I know that the resulting resulution would be a bit wierd/off with 133x80, cuz we would loose some useable pixels on the side of the screen.^^)

1 Like

As you said, unlike scales or 2, 4, 8 when scaling the display to 3 doesn't fully fill the display. The system cannot make an assumption how you want to display the buffer.

However you can the scaling yourself. Simply create an image of 128 by 64 and use it as you own frame buffer. At the end of the update function, you just need to draw you image inside the frame buffer with a scaling factor.
I would imagine that this method is not as performant as using playdate.display.setScale() because the display scale might do some specific optimization, but since you render only in a small frame buffer I guess that you have a bit of margin.

local arduboy_framebuffer = playdate.graphics.image.new(128, 64)

function playdate.update()
  playdate.graphics.pushContext(arduboy_framebuffer)
    -- do your normal update there
  playdate.graphics.popContext()

  arduboy_framebuffer:drawScaled(400-64*3, 240-32*3, 3)
end
4 Likes

I wonder if it might even look pretty good scaled to the FULL Playdate screen (or else the full width with a little top/bottom margin), allowing the scaler to use a mix of 3- and 4-pixel blocks? It would make a nice big image.

You could even offer three options: "3x" "Full width" and "Full screen" (stretched a bit vertically) and let drawScaled handle the differences. (Maybe a fourth option "2x" just to offer something closer to the tininess of the actual Ardobuy?)

1 Like

Thank you guys very much for your suggestions!!!

@Nic That look pretty promising, but I have nearly zero experience with Lua and no clue on how to mix it with C (cuz my project is written in C). ;'D

So, I chose another obvious and easy solution, and I don't know why didn't see that in first place. >_<
I work now with pd->graphics->drawScaledBitmap() and it works pretty good!

playdate-20220527-202126

But again, thank you all for your ideas! :wink:

3 Likes