S
some_entity
Guest
I’ve been changing the way my game is drawn to be manually drawn through surfaces. I have a global.GUI_surface variable that I draw to in Draw GUI events. While drawing to this surface works fine, the entire surface has a black screen beneath the GUI elements - which completely covers the application surface, where the “game world” is drawn (everything that’s not GUI).
I believe it has something to do with opacity, but I can’t seem to use gpu_set_colorwriteenable(true, true, true, false) to disable the alpha channel for the surface. Also, when a GUI element leaves the screen, it leaves a "smear" of sorts where you can see each frame it was visible. I’m not sure how to go about it.
application_surface_draw_enable is set to false at all times.
One object draws both surfaces in the post-draw event:
I believe it has something to do with opacity, but I can’t seem to use gpu_set_colorwriteenable(true, true, true, false) to disable the alpha channel for the surface. Also, when a GUI element leaves the screen, it leaves a "smear" of sorts where you can see each frame it was visible. I’m not sure how to go about it.
application_surface_draw_enable is set to false at all times.
One object draws both surfaces in the post-draw event:
GML:
/// @description Draw Surfaces
// * res_width & res_height are macros, which are set to 1152 & 648.
if(!surface_exists(global.GUI_surface)){
global.GUI_surface = surface_create(res_width, res_height);
}
// Prepare Vars
var c = c_white;
var col_ar = [c, c, c, c];
// Prepare Surface
draw_clear(c_black);
gpu_set_blendenable(false);
gpu_set_colorwriteenable(true, true, true, false);
// --- DRAW SURFACES ---
// Overworld / Game World Surface
if(surface_exists(application_surface))
draw_surface_general(application_surface, 0, 0, res_width, res_height,
0, 0, 1, 1, 0, col_ar[0], col_ar[1], col_ar[2], col_ar[3], 1);
// GUI Surface
if(surface_exists(global.GUI_surface))
draw_surface_general(global.GUI_surface, 0, 0, res_width, res_height,
0, 0, 1, 1, 0, col_ar[0], col_ar[1], col_ar[2], col_ar[3], 1);
// Reset Drawing Mode for All Other Instances
gpu_set_colorwriteenable(true, true, true, false);
gpu_set_blendenable(true);
scr_reset_draw_settings(); // just does things like draw_set_color(c_white) and draw_set_halign(fa_left);