Change pixel resolution of a background_layer?

Adry

Member
Hi GM community! I'm fairly new to programming but was wondering if any one could help me out a bit with this conundrum of an issue..
I have a game that is 160 x 140. However I have set the window size to (380 x 340) which is a 3x magnification for the pixel art. now my question is this..
Is there any way to make my background display with the 160 x 140 resolution? Rather than being 3x magnified. Here is my code so far..

GML:
/// @description Insert description here
// You can write your code in this editor
BG_Random = choose(battle_bg_c, battle_bg_c,);
var lay_id = layer_get_id("Backgrounds_1");
var back_id = layer_background_get_id(lay_id);
layer_background_xscale(back_id, 1);
layer_background_yscale(back_id, 1);
layer_background_sprite(back_id, BG_Random);
P.S the xscale / yscale if set to .5 changes the size of the bg, but the pixels remain faithfully 3x magnified so it just comes out distorted.. Any advice?
 

sp202

Member
That's not a 3x magnification, that would be 480x420. If you want the background to maintain its size then set scale to 1/3.
 

TheouAegis

Member
If you don't resize the application surface, then it will get scaled up to fill the window. That means you can't draw the background to the application_surface. Otherwise you resize the application_surface to the size ofnthe window and have everything else other than the bg drawn at 3x scale.
 

Adry

Member
If you don't resize the application surface, then it will get scaled up to fill the window. That means you can't draw the background to the application_surface. Otherwise you resize the application_surface to the size ofnthe window and have everything else other than the bg drawn at 3x scale.
I think you are on the right track with this! how would I exclude the bg from being drawn to the application_surface?
I've run into surfaces before mostly when messing with shaders, but I'm still pretty unfamiliar with how exactly they function..
So I'm gonna' hit up YouTube to see if I can get a run down! I appreciate your comment :)
 

TheouAegis

Member
I don't know if the application surface can get cleared with zero opacity, but if I can, you could draw the background directly to the window itself in the predraw event. Keep in mind if you do this, it's using window coordinates, not room coordinates.
 
Top