TheCheeseMaster
Member
Hello,
I'm trying to figure out how to fix the seemingly lower framerate as well as objects jumping around a tiny bit when surfaces are being drawn. Here's an example:
Here's my code:
Draw GUI Begin:
Any tips or ideas would be much appreciated. I've tried moving the code around to different draw events, and splitting up when the draw_surface functions are being done, but I can't seem to figure it out.
Thanks
Dan
I'm trying to figure out how to fix the seemingly lower framerate as well as objects jumping around a tiny bit when surfaces are being drawn. Here's an example:
Here's my code:
Draw GUI Begin:
Code:
if(tea_active == true)
{
/// @description Draw Tea Effect
if(!surface_exists(base_surf))
{
base_surf = surface_create(camera_get_view_width(view_camera[0]),camera_get_view_height(view_camera[0]));
tea_surf = surface_create(camera_get_view_width(view_camera[0]),camera_get_view_height(view_camera[0]));
}
//sets the view to be drawn in the tea surf
if(view_surface_id[0] != base_surf)
{
view_surface_id[0] = base_surf;
}
surface_set_target(tea_surf);
//clear the surface
draw_clear_alpha(c_black,0);
//draw the white tea sprite
draw_sprite(spr_tea_vision_sprite,0,0,0);
//set the alpha to false so you only draw on non-transparent areas
gpu_set_colorwriteenable(true,true,true,false);
if(shader_is_compiled(sh_greyscale))
{
shader_set(sh_greyscale);
//draw application surface
draw_surface(base_surf,0,0);
shader_reset();
}
//reset the drawing mode
gpu_set_colorwriteenable(true,true,true,true);
surface_reset_target();
//draw the regular layer
draw_surface(base_surf,0,0);
draw_surface(tea_surf,0,0);
}
else
{
if(view_surface_id[0] != -1)
{
view_surface_id[0] = -1;
}
}
Thanks
Dan