Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: DrewCCU on Sun 11/07/2010 06:08:57

Title: Textual Overlay question[SOLVED]
Post by: DrewCCU on Sun 11/07/2010 06:08:57
I need a textual overlay (or something similar) to appear on TOP of a GUI.  Something like:


int Power = 100;

Overlay* myOverlay = Overlay.CreateTextual(50,80,120, Game.SpeechFont, 15,"Power is at %d%", Power);


Obviously, this would display a textual overlay that says "Power is at 100%"

However, it is important that this overlay appears ABOVE a GUI.  Now, to my knowledge an overlay does not have a zOrder so can not be placed above a GUI.  I can't use a GUI button because you can't use string formatting when editing a button's text.

Also, i don't want to use the Display function obviously because it would pause the script - and that can't happen here.

This may not be possible but if it is at all i would prefer to keep the necessary coding inside the room script ... if possible.  If not - oh well.  But yeah, i need something like this but it needs to be over a GUI.

Any suggestions?
Title: Re: Textual Overlay question
Post by: GarageGothic on Sun 11/07/2010 06:22:12
You are correct that overlays can never be on top of GUIs. But use a GUI with a label instead (or button as you say, though labels seem more appropriate). Look up the String.Format function in the manual.

int Power = 100;
lblMyPowerLabel.Text = String.Format("Power is at %d%", Power);


Piece of cake :)
Title: Re: Textual Overlay question[SOLVED]
Post by: DrewCCU on Sun 11/07/2010 06:59:03
works like a charm ... i'd never experimented with labels much before - but i'm glad you introduced me to them. thanks.