Disable Filtering
-
Hey there,
so i was was playing arround with low resolutions and noticed that the screen is always filtered. wich means that you cant have low resolution games that look good. is there a way to disable that? -
Not sure if it helps, but you can disable filtering for any images you create with createImage(). It’s one of the parameters...
-
I've noticed this too, my Spectrum games look all fuzzy in their "natural" resolution - so instead I've been just using a draw target which I centre and scale in the middle of a "normal" framebuffer.
-
Just to expand on what @pobtastic said - explain how you are drawing your low resolution game? Because it absolutely IS possible to have fantasticly clear looking low resolution games. If you are not doing it already, look into draw targets.
The concept is simple, you create an image (use
myImage = createImage(width, height, false, IMAGE_RGBA)
) of whatever low resolution size you want. You usesetDrawTarget(myImage)
at the start of your draw loop and consequently draw your game to that image as though it was the main display. Before the end of your loop you do asetDrawTarget(frameBuffer)
and then transfer your image to the frame buffer using whatever scaling you want. By doing this you offload the scaling to the GPU and it comes up nice and clear. Obviously if you choose a resolution that works well with integer scaling (by maybe adding a border if needed) then you stand a much better chance of it looking good. -
This forms the basis for more or less everything I write - maybe useful?
float scale = 3.5 float tile_size = 8 * scale game = [ .active = false, .rows = 24, .cols = 32 // ... game stuff too... ] spectrum_buffer = createImage( game.cols * 8, game.rows * 8, false, IMAGE_RGBA ) offset_x = ( gWidth() - ( tile_size * game.cols ) ) / 2 offset_y = ( gHeight() - ( tile_size * game.rows ) ) / 2 loop if !game.active then show_splash() endIf initialise_variables() while game.active loop game_loop() repeat // If lives aren't zero then the game was quit prematurely. if game.player.lives == 0 then game_over() endIf repeat /** * Displays the intro/ "Pre-Game" screen. */ function show_splash() while !game.active loop setDrawTarget( spectrum_buffer ) clear() // This prints in "Spectrum font" obviously normal printing will be huge here. // My Spectrum font is 8x8 pixels as per the Spectrum (the "7, 3" is specific for West Bank - the font is double height and has an attribute value for top/ bottom). spectrum_print( 11, 0, "WEST BANK", 7, 3 ) // etc c = controls( 0 ) if old_c and !(c.a or c.b or c.x or c.y) then game.active = true endIf old_c = c.a or c.b or c.x or c.y setDrawTarget( framebuffer ) clear() drawImage( spectrum_buffer, offset_x, offset_y, scale ) update() repeat return void
I've simplified it somewhat for here, but I think that demos enough what I mean.