Z-order for text windows

Started by Kinoko, Fri 11/03/2005 06:38:32

Previous topic - Next topic

Kinoko

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...?

strazer

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.

Radiant

Yes, but DisplaySpeech is actually displayed below other GUIs, for some reason.


Kinoko

What I'm actually using is:

Code: ags

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.

Pumaman

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.

SMF spam blocked by CleanTalk