Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Kinoko on Fri 11/03/2005 06:38:32

Title: Z-order for text windows
Post by: Kinoko on Fri 11/03/2005 06:38:32
I just noticed there's no Z-order for text windows. Is there a workaround for this? Because I'd like to have my text window on top of some other GUIs. Otherwise, I guess the only solution is to remake the text window GUI AFTER all other GUIs...?
Title: Re: Z-order for text windows
Post by: strazer on Fri 11/03/2005 07:52:58
Have you actually tested it?
I assumed Display commands are always drawn on top of everything else.
And sure enough, using AGS v2.7 RC2, I couldn't make the custom text window gui NOT display on top of everything. Where it is in the gui list doesn't seem to matter.
Title: Re: Z-order for text windows
Post by: Radiant on Fri 11/03/2005 08:26:50
Yes, but DisplaySpeech is actually displayed below other GUIs, for some reason.
Title: Re: Z-order for text windows
Post by: strazer on Fri 11/03/2005 08:32:39
Well, if she indeed meant speech overlays, we have these tracker entries:

http://www.adventuregamestudio.co.uk/tracker.php?action=detail&id=126
http://www.adventuregamestudio.co.uk/tracker.php?action=detail&id=256
Title: Re: Z-order for text windows
Post by: Kinoko on Fri 11/03/2005 12:52:28
What I'm actually using is:


function TypeLineSay (string say, int xpos, int vpos, int width, int delay, int wait) {
StrCopy (line, say);

SetTextWindowGUI(1);
//declare local vars
  textid = 0;
//initialise vars , overdoing it a bit ;-)
  length = 0; 
  i=0;
  StrCopy(displayedline,"");
  textid = CreateTextOverlay(xpos, 100, 400, 1, 1, displayedline);

          //get string length, to know how long the loop must run
  length=StrLen(line); //set string length
         //start loop
while((i<length) && (1||(WaitKey(delay)==0))) {
         // pick character at position "i"and stick it at the end of string "displayed line"
    StrFormat(displayedline, "%s%c", displayedline, StrGetCharAt(line,i));
         //set textoverlay as displayedline
    SetTextOverlay(textid,xpos,vpos,width,1,1,displayedline);

         // if a space is added to the string do not play a sound, else play a 'tick'
    if (StrGetCharAt(line,i) == ' '){
   }
   else{
        PlaySound(1);
    }
           //increase the loop counter
    i++; 
   if (i==length) if (wait>0) WaitKey(wait);
   else if (wait == -1) while (IsKeyPressed(keyx) == 0) Wait(1);
   }
RemoveOverlay(textid);
Wait(5);
}


Erm, so an overlay, I guess. I just noticed that when I go to the GUI menu, there's no "Z-order" setting for a text window GUI.

Anyway, thanks for the info ^_^ I was a bit vague in my original post.
Title: Re: Z-order for text windows
Post by: Pumaman on Sat 12/03/2005 14:14:11
GUI text windows don't have a Z order because they're not actually GUIs in so far as the engine treats them -- the GUI editor was just a handy place to put them.

So using the Display command will always come up on top of everything else, even if it's using a text window GUI.

Currently, overlays are drawn beneath GUIs, which is why CreateTextOverlay/DisplaySpeech is displayed under any GUIs you have. As strazer points out, there are tracker requests to change this in future.