Sharing my method to get pixel-perfect pixel art rendering

I’m sharing with the community my method to render pixel-perfect pixel art.
That’s mean, all the drawn pixels (art) will have the same size (same number of pixels on the screen). Perfectly scaled, 2,3,4…

(Not so perfect when the parameter side bar is opened)

How is it different from what Codea does normally?

It’s more an helper than a different way to do it.
I’m using it because, I want perfectly squared big fat pixel art, that work for any resolutions and orientations with an easy coordinate system.

Do you have a comparison with normal drawing?

I’m sharing with the community my method to render pixel-perfect pixel art. That’s mean, all the drawn pixels (art) will have the same size (same number of pixels on the screen). Perfectly scaled, 2,3,4…

(Not so perfect when the parameter side bar is opened)

Try using:

if displaymode() == STANDARD then
displaymode(OVERLAY)
end

put that right under your draw function’s header like this:

function draw()
if displaymode() == STANDARD then
displaymode(OVERLAY)
end

That way even with the side bar out it will still read your graphics as if you’re using displaymode(FULLSCREEN).

@QMG That’s no different from just putting displayMode(OVERLAY) outside of setup. No need to for an if check every cycle.

@yojimbo2000 Bottomline he wants displaymode(OVERLAY). It does not negate the initial suggest solution of using displaymode(OVERLAY).

Sidebar or no sidebar it doesn’t matter.

No need to for an if check every cycle.

But there does need to be an if check every cycle though as far as orientation is concerned.

--[[
orientation key:
0 is portrait 
1 is portrait upside down

2 is landscape rightside down
3 is landscape leftside down

checking for these values in tandem with the variable CurrentOrientation you'd know 
exactly how someone is holding their screen 
(provided they don't have their screen orientation locked). 
]]

But there does need to be an if check every cycle though as far as orientation is concerned.

No there doesn’t. You can define the built-in function function orientationChanged(orientation), it will fire when the orientation changes, there’s no need to test for this every cycle.

In any case, orientation changing doesn’t affect the overlay status.

What I quite often do is this:

displayMode(OVERLAY)
displayMode(FULLSCREEN)

That way you launch in fullscreen, but if you do need to open the console (with the disclosure arrow in the top corner), it will open in overlay mode instead of standard mode, so it won’t affect the width and height of the display.