SOLVED Are there conditions under which the mouse cursor disappears ?

Another odd one. I made a menu element that expands to selections. I use my own sprite via cursor_sprite for the mouse cursor. Both things are in use for about two years and worked well.

Until i placed them into a new room in which there are elements that use things like gpu_set_colorwriteenable (i mention this because it is the only unusual thing i can think of)

Now while it works fine in another room, here if i click twice on the element, the mouse cursor disappears. Its right back if i leave the room or restart it. Also the first click does not lead to this, only the second.

After the cursor is invisible, it still can be used. But you cannot see it.

I do not touch the mouse cursor in that room in any way other than checking for its position in some cases.

My question now is, are there any strange draw combinations, that can cause this ?
 

Cameron

Member
What are you doing with gpu_set_colorwriteenable, are you disabling the alpha channel? If so, do you restore the alpha channel when done? What happens when you comment out the gpu_set_colorwriteenable functions to test if that is the cause of the issue.

Also, what code is involved with the mouse left press, can you show it? Why do you suspect it happens on the second mouse press and does it happen with 100% reproducible accuracy?
 

Yal

šŸ§ *penguin noises*
GMC Elder
You could always just draw your own sprite at mouse_x,mouse_y... helps making the game look more consistent, and gives you more control over the cursor.
 
Thanks for your replies!

@Yal: I am not sure i understand what you mean - do you think i should create may own object to replace the windows mouse cursor ?

@CameronScottCreations:
If i comment out the gpu_set_colorwriteenable, nothing changes (it was a long shot in has to anything with it anyway). I had that checked before, i was just wondering if any draw event could interfere in that way on principle. So maybe there is a timing issue were it just happens to influence that sprite somehow because of some other draw sequence implemented in the menu. I know too little about the exact graphic handling (besides the obvious variations of draw events).

It happens on the second click every time. The code in that sequence works in another menu perfectly fine, the mouse cursor never vanished before in all the years, no matter in which context i used it.

The code is in the spoiler:

starty = 0;
spacey = 48;
entryno = global.DropperInst[thisdrop,2];
//Avoid overlapping beyond the border
bordercheck = y+entryno*spacey;
if (bordercheck > room_height)
{starty = room_height - bordercheck-5;}

if(global.DropperInst[thisdrop,5] = false)
{
for (i=0;i<entryno;i++)
{
(global.DropperInst[thisdrop,dropid+i]).visible = true; //Show choices
(global.DropperInst[thisdrop,dropid+i]).depth -=7000;//Set them above all other elements
(global.DropperInst[thisdrop,dropid+i]).y += starty + i*spacey; //List them below each other
(global.DropperInst[thisdrop,dropid+i]).active = true; //Set them active
(global.DropperInst[thisdrop,dropid+i]).thisfont = font0;
}
(global.DropperInst[thisdrop,1]).depth -= 6990;//Set background above all but the content
global.DropperInst[thisdrop,5] = true;//Mark this dropper as expanded
(global.DropperInst[thisdrop,1]).image_yscale = 0;//Remove background
(global.DropperInst[thisdrop,1]).y += 0;//Adjust position to new size
}
else
{
DropperClose(thisdrop,entryno);
}

But it only touches the element itself, it does not go near the cursor.

This is how it looks in the game before the second click:


Screen_9_1.jpg
 
Last edited:

Cameron

Member
Is this in the draw gui event?

I noticed that your depth changes are cumulative, so you might be drawing everything above the cursor after the second click. Not sure what depth level the cursor is drawn at but these two lines of code might be the problem:

GML:
(global.DropperInst[thisdrop,dropid+i]).depth -=7000;//Set them above all other elements
(global.DropperInst[thisdrop,1]).depth -= 6990;//Set background above all but the content
Try and set those to a fixed depth so they don't accumulate and see if that fixes the issue.
For example something like this:
GML:
(global.DropperInst[thisdrop,dropid+i]).depth = -7000;//Set them above all other elements
(global.DropperInst[thisdrop,1]).depth = -6990;//Set background above all but the content
Do you see the difference?

Edit: I just did some testing in my IDE and I'm fairly confident that this is the cause of your issue.
 
Last edited:
Indeed i see the difference and it solved the problem. So thank you very much for that.:banana:

It is not in a draw event but in the left released event. I am still puzzled that the mouse sprite disappears due to this. I could understand if it would be hidden by the elements involved, but it was gone no matter where you moved it and after the element was closed.

This is why i did not suspect that passage.
 

Cameron

Member
Indeed i see the difference and it solved the problem. So thank you very much for that.:banana:

It is not in a draw event but in the left released event. I am still puzzled that the mouse sprite disappears due to this. I could understand if it would be hidden by the elements involved, but it was gone no matter where you moved it and after the element was closed.

This is why i did not suspect that passage.
In my testing I noticed the whole gui draw event was superseded, which I suspect is where the cursor was drawn. So I think the draw gui event is drawn somewhere around the -15000 depth and if an object has a lower depth than that then its regular draw event is drawn over that. Long story short, the cursor was there it was just behind the background art.
 
So it did not matter that the background depth was not changed, somehow the cursor was pushed behind it anyway ?
Edit: To clarify what i mean: the background in the comments is not the background of the room, but the one of the element.
 
Last edited:

Cameron

Member
So it did not matter that the background depth was not changed, somehow the cursor was pushed behind it anyway ?
Edit: To clarify what i mean: the background in the comments is not the background of the room, but the one of the element.
I'm not sure exactly what you mean. And it depends on how your background is being drawn. I'm assuming you are drawing it from the objects draw event and not a background layer, because in order for it to cover the cursor its depth would have to be changed. So I assume it was being drawn in the draw event of the object you changed the depth of. If this is true, then you didn't "push" the cursor behind anything but instead started drawing everything over the cursor.
 
I try to be more specific. The structure of the room is very much legacy 1.4 stuff. So there is a background layer and all other things are objects with their respective depth set individually to create the optic stack in the screenshot.

That background layer is not modified by this element. The "Background" is mention in the comment "6990;//Set background above all but the content" is only the background sprite of the element. So i could understand if the cursor would be hidden behind any item of that element. But i cannot see why it would be hidden by anything else, as those instances are not touched. Thus i concluded it was pushed back behind the rooms' background while still working.
But maybe there is something i do not understand about what you suggest ?
 

Cameron

Member
I try to be more specific. The structure of the room is very much legacy 1.4 stuff. So there is a background layer and all other things are objects with their respective depth set individually to create the optic stack in the screenshot.

That background layer is not modified by this element. The "Background" is mention in the comment "6990;//Set background above all but the content" is only the background sprite of the element. So i could understand if the cursor would be hidden behind any item of that element. But i cannot see why it would be hidden by anything else, as those instances are not touched. Thus i concluded it was pushed back behind the rooms' background while still working.
But maybe there is something i do not understand about what you suggest ?
Why does this line of code:
GML:
(global.DropperInst[thisdrop,1]).depth -= 6990;//Set background above all but the content
say something about "Set background"?
 
Because it means the background of the element, not the one of the room. The comment is not clear enough thats for sure.

This is a screenshot before the element is clicked (200 turns)
Screen_10_1.jpg

This is after it was clicked. The "backround" is now behind the elements that are opened.

Screen_11_1.jpg
 

Cameron

Member
Because it means the background of the element, not the one of the room. The comment is not clear enough thats for sure.

This is a screenshot before the element is clicked (200 turns)
View attachment 31219

This is after it was clicked. The "backround" is now behind the elements that are opened.

View attachment 31220
Okay, but those are different images. Were you having any problem in this room before? The room you were having a problem in has a different image.
 
Yeah, thanks again for your help. I was merely interested in what was going on exactly. But its not worth studying any further at this point. Life and the project continue ;)
 

Cameron

Member
Yeah, thanks again for your help. I was merely interested in what was going on exactly. But its not worth studying any further at this point. Life and the project continue ;)
Are you sure you aren't drawing that background from the object in that room? There has to be some reason the behavior in that room is different. What did you do differently in that room and where is the background art being drawn from?
 
Both rooms have a background layer, i do nothing fundamentally different in them at least nothing i am aware off. What is even stranger, the way i build this, it should have been buggy from the start with adding 7000 depth each time it's clicked.

Quote from the manual:

"Also note that the minimum and maximum layer depths are -16000 to 16000, and anything outside of those depths will not be rendered."

So the elements should have vanished during use. But only the mouse cursor did.
 
Top