nesrocks
Member
Problem 1: My GUI layer's resolution is matching the window resolution, not the real internal resolution. Since my game is a scaled low resolution, the game itself is pixelated (as it should), but the GUI is high res. I'm having trouble setting the GUI to be the same resolution as the game.
Game without any shader applied. The green box is on a Draw GUI event:
Problem 2: When using a shader for the application_surface, everything drawn on the Draw GUI events isn't getting drawn with the shader.
Both problems in one image:
That shader is a variation of this one (just tweaked some values): https://marketplace.yoyogames.com/assets/701/crt-pixel-shader
So, I understand this probably has to do with surfaces, but I have trouble with it. It feels like my GUI isn't being draw to the application surface?
init:
shader init:
And finally, at the Post-Draw event of a persistent "control" object:
Game without any shader applied. The green box is on a Draw GUI event:
Problem 2: When using a shader for the application_surface, everything drawn on the Draw GUI events isn't getting drawn with the shader.
Both problems in one image:
That shader is a variation of this one (just tweaked some values): https://marketplace.yoyogames.com/assets/701/crt-pixel-shader
So, I understand this probably has to do with surfaces, but I have trouble with it. It feels like my GUI isn't being draw to the application surface?
init:
Code:
global.shader_to_use = shr_bw_CRT;
global.zoom = 2;
global.gamewidth = 640;
global.gameheight = 360;
window_set_size(global.gamewidth * global.zoom, global.gameheight * global.zoom);
display_set_gui_size(global.gamewidth, global.gameheight);
display_set_gui_maximise(global.zoom,global.zoom,0,0)
Code:
application_surface_draw_enable(false);
crt_surface_scale = global.zoom;
crt_surface_width = global.gamewidth * crt_surface_scale;
crt_surface_height = global.gameheight * crt_surface_scale;
uni_crt_sizes = shader_get_uniform(global.shader_to_use, "u_crt_sizes");
distort = shader_get_uniform(global.shader_to_use, "distort");
distortion = shader_get_uniform(global.shader_to_use, "distortion");
border = shader_get_uniform(global.shader_to_use, "border");
var_distort = false;
var_border = true;
surface_resize(application_surface, global.gamewidth, global.gameheight);
Code:
shader_set(global.shader_to_use);
shader_set_uniform_f(uni_crt_sizes, global.gamewidth, global.gameheight, crt_surface_width, crt_surface_height);
shader_set_uniform_f(distort, var_distort);
shader_set_uniform_f(distortion, global.var_distortion_ammount);
shader_set_uniform_f(border, var_border);
draw_surface_part_ext(application_surface, 0, 0, global.gamewidth, global.gameheight, 0, 0, global.zoom, global.zoom, c_white, 1);
shader_reset();
Last edited: