Just as an extra thing on how that's useful ... I tend to write clones of ZX Spectrum games, and rather than using setMode( 256, 192 ) for the screen display (which is the Spectum resolution) it's better for me to do something like this;
float scale = 3.5
// As in ... each byte occupies 8 bits/ pixels * how much we want to enlarge the display.
float tile_size = 8 * scale
struct game
bool active
int frame_count
int rows
int cols
endStruct
game game
game.active = false
game.frame_count = 0
// https://en.wikipedia.org/wiki/ZX_Spectrum
game.rows = 24
game.cols = 32
offset_x = ( gWidth() - ( tile_size * game.cols ) ) / 2
offset_y = ( gHeight() - ( tile_size * game.rows ) ) / 2
spectrum_buffer = createimage( game.cols * 8, game.rows * 8, false, image_rgba )
loop
// Clear down the Spectrum frame buffer.
setDrawTarget( spectrum_buffer )
clear()
// DO SOME STUFF!
// Clear down the main frame buffer.
setDrawTarget( framebuffer )
clear()
// Output the Spectrum buffer scaled appropriately.
drawImage( spectrum_buffer, offset_x, offset_y, scale )
update()
game.frame_count += 1
repeat
...reasons being;
If I draw/ print to an area, it's then the same as it is on a Spectrum so all the coordinates match (looking at you
https://skoolkit.ca)
I can then "emulate" the ZX Spectrum border command, as the centered Spectrum image has an area around it