About Store Forum Documentation Contact
Donations:
309$/mo



Post Reply 
Gui drawing order problem
Author Message
Kiekos Offline
Member

Post: #1
Gui drawing order problem
Hey there!

I've just stumbled across another problem... I'm at the point of creating teleporting function for one of the NPCs and I came up with something which I called "back shade" which is supposed to make everything apart from the NPC's window blurred and dark so that the player focuses on only that one thing.

I did this:
Code:
Gui += back_shade;
Gui += tp1; //teleporting window 1
Gui += tp2; //teleporting window 2
so that all the elements are added to the Gui in desired order.

Then I disable all of them:
Code:
back_shade.hide();
tp1.hide();
tp2.hide();

And now when you talk to an NPC this happens:
Code:
back_shade.show();
tp1.show();

So now "back shade" and "tp window 1" are drawn like this:
(bottom) BackShade -> TP1 (top)

Then when you keep talking and clicking buttons, "tp window 1" disappears and "tp window 2" appears:
Code:
tp2.show();
tp1.hide();

I don't know why, the drawing order at this point looks like this:
(bottom) TP2 -> BackShade (top)

I thought the "tp window 2" should be on top of "back shade" while it's below... Any ideas what I did wrong?

Thanks,
Kiekos

EDIT: I've figured out where the problem is - when you click on a Gui window it's instantly being moved to the top of the pile, so when "back shade" and "tp window 1" are drawn and you keep clicking buttons in the window, you also click "back shade", so these two things are moved to the top of the pile and that's why "tp window 2" is drawn below "back shade" later on.

Is it possible to disable that feature just for one gui object or do I have to find another way to achieve that efect?
(This post was last modified: 10-14-2013 05:38 PM by Kiekos.)
10-14-2013 02:04 PM
Find all posts by this user Quote this message in a reply
para Offline
Member

Post: #2
RE: Gui drawing order problem
you can use the 'level' member of back_shade and set it to -1 so it's always drawn below. 0 is default, 1 is always on top.

I think the game menu tutorial does this for the main menu window..
10-14-2013 07:20 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Kiekos Offline
Member

Post: #3
RE: Gui drawing order problem
You're right - it does, but I didn't see that part as I'm going to use my own way of creating menu smile

I used that level feature to lock Gui Objects in this order:
user interface gui -> back_shade -> teleport windows (and other chat windows with NPC)

Everything works now, thanks!
10-14-2013 09:05 PM
Find all posts by this user Quote this message in a reply
Post Reply