SOLVED Fade effect broke (surfaces problem?)

L

Lu9

Guest
So, in my game I have a custom window border where the game surface (application_surface) is put inside.
And everything looked fine, until probably GM Studio 2.3 came around and something wasn't right with anything related to alpha/opacity, even in the sequence editor as I first tested a while ago.
But right now I'm just trying to get a very simple fade effect to work, but while the alpha decreases the screen shows what seems like artifacts of scaling the game surface to the full window size (The "ghost" sprites definitely seem stretched)

here you can sort of see the problem. on the corners you see a bit of green - that's part of the border.
Here the game is in 1x window size, making the artifact more pronounced - in bigger sizes like 4x though, it is less noticeable but still there.
In full screen mode, which disables the border entirely, it functions normally without issues, so I'm fairly convinced something changed in the way surfaces and GUI stuff deal with transparency.
Any idea of what might be happening?

For better understanding, here's basically what I have going on in a persistent object's Draw GUI event:
GML:
//if any of these 2 functions function differently in GMS2.3 or anything else
//i should know about them please tell me
display_set_gui_size(-1, -1);
display_set_gui_maximise(1, 1, 0, 0);
//now here goes a lot of switch statements just deciding where (and the scale)
//that it should draw the surface depending on the setting
//but it all boils down to the function below
draw_surface(application_surface,4,20)
//when scaling is needed the ext version is used
draw_surface_ext(application_surface,4,20,2,2,0,c_white,1)
And all that the object doing the fade effect is doing is decreasing and increasing its image_alpha
 

lost

Member
It's not really clear to me why you:

a) want the green border
b) are using Draw GUI to draw sprites/entities

Reading this thread might help you understand better confusions and issues with the application surface and the Draw GUI event: https://forum.yoyogames.com/index.p...e-not-respected-while-drawing-outlines.30624/

display_set_gui_size isn't for defining an application surfaces. sending -1,-1 only resets it to the defaults, supposedly equal to the application surface size. however, you aren't showing us how you set up your application surface. let's assume it matches the size of the room.

the Draw GUI event shouldn't be used to draw your sprites. you could use Draw End event instead, perhaps, to "draw at the end of the rest of the things in Draw" ... but you really should be using layers, or some combination thereof.

The following link will discuss how you enable and disable the application_surface for drawing:


You may also wish to review the bottom part starting with "As mentioned above..." of this page:



Basically, I don't have enough information, but I think reviewing the above material may guide you in the right direction.
 

lost

Member
Here is some magical code that I use to set up my lo-fi rendering. Maybe it will also help you. This occurs in the creation code of my startup room. I never use Draw GUI anywhere in my code, so I do not interact with that feature at all. If I did, it would be at the default setting prior to creating this room, based on the Game settings or the Startup Room size.

GML:
global.plays=0;

if ( display_aa | 8 ) display_reset(8,false);
else if ( display_aa | 4 ) display_reset(4,false);
else if ( display_aa | 2 ) display_reset(2,false);

var going_fullscreen = !debug_mode;

var dheight = display_get_height();
var dwidth = display_get_width();

show_debug_message("Height and width read as: "+string(dwidth)+" x "+string(dheight));

window_set_size( max(512,512*floor(dwidth/512)), max(288,288*floor(dheight/288)) );

surface_resize(application_surface,2048,1152);

if ( going_fullscreen ) window_set_fullscreen(true);

room_goto(Title);
 
L

Lu9

Guest
It's not really clear to me why you:

a) want the green border
b) are using Draw GUI to draw sprites/entities

Reading this thread might help you understand better confusions and issues with the application surface and the Draw GUI event: https://forum.yoyogames.com/index.p...e-not-respected-while-drawing-outlines.30624/

display_set_gui_size isn't for defining an application surfaces. sending -1,-1 only resets it to the defaults, supposedly equal to the application surface size. however, you aren't showing us how you set up your application surface. let's assume it matches the size of the room.

the Draw GUI event shouldn't be used to draw your sprites. you could use Draw End event instead, perhaps, to "draw at the end of the rest of the things in Draw" ... but you really should be using layers, or some combination thereof.

The following link will discuss how you enable and disable the application_surface for drawing:


You may also wish to review the bottom part starting with "As mentioned above..." of this page:



Basically, I don't have enough information, but I think reviewing the above material may guide you in the right direction.
that is only part of the screenshot, showing the sides and not the full window, and i'm only using Draw GUI to draw the window elements and the application_surface inside of it.
That said, I was able to talk to a friend who knows about GML and was able to figure out a solution for my case in specific, although the way he put it, it probably happens more frequently than I'd imagine...
This is what worked for me:
On the Draw GUI event, before drawing the application surface:
GML:
if window_get_fullscreen() = false
draw_clear(c_black)
If you're not using fullscreen you can ignore the first line. But this should fix ghosting resulted from having transparency on things, when drawing application_surface in GUI.
So I'd say this issue is resolved.
 
Top