Custom Txt Box doesn't display over Inventory Gui

Started by Gold Dragon, Mon 19/05/2008 23:05:11

Previous topic - Next topic

Gold Dragon

ok I wrote my own custom Txt Box Code

Code: ags

function SpriteFont::display(String Txt,  int x,  int y){
.
.
(creates txt box)
.
.
Overlay *displayOverlay = Overlay.CreateGraphical(x, y, sprite.Graphic, false); // create our overlay
  sprite.Delete(); // delete our temporary sprite
  while (!WaitMouseKey(1)) {} // returns 0 if the time has elapsed, 1 if a mouse button or key was pressed
  displayOverlay.Remove();

}


Works perfect for to display text on background. But when I call it to in inventory


Code: ags

function iDullAxe_Look(){
  FontDk.display("A Fine Axe but it looks a bit dull from all the chopping.");
}


Incase your going to ask.. yes FontDk is created and imported as a SpriteFont class/struct

My Guess is that the over lay is being writen over the background which the Gui is written on top of that in this order...

Background...
Overlay text Box..
Inventory Gui..

How do I make it...

Background..
Inventory Gui..
Overlay Text box

Any Ideas?
Want to see how I am doing and how far I've gotten in my game? Visit my forum  http://www.freepowerboards.com/DragonKnight

Pumaman

Currently overlays are always drawn behind GUIs, so this isn't possible -- you'd need to use a GUI Button to display your sprite, or a GUI textbox instead.

There is an outstanding feature request on my to-do list to allow custom z-ordering between overlays and GUIs.

Have you considered using a GUI instead of an overlay for your custom text box? It might be more appropriate.

Gold Dragon

Sure I would if there was a way to dynamically build the GUI like I do with sprites.. I use 9 Text box tile sprites and A-Z, a-z, 0-9,  graphic sprite tiles.. is there a way to dynamically create a GUI using these tiles as I do with the Dynamicsprite class/struct??
Want to see how I am doing and how far I've gotten in my game? Visit my forum  http://www.freepowerboards.com/DragonKnight

Pumaman

Well, you can always construct your dynamic sprite the same way that you are doing already, but then set it onto a GUI.BackgroundGraphic rather than creating is as an overlay.

If that doesn't work perhaps you could provide more detail about what you're trying to do.

Gold Dragon

Want to see how I am doing and how far I've gotten in my game? Visit my forum  http://www.freepowerboards.com/DragonKnight

Gold Dragon

Quote
Well, you can always construct your dynamic sprite the same way that you are doing already, but then set it onto a GUI.BackgroundGraphic rather than creating is as an overlay.

If that doesn't work perhaps you could provide more detail about what you're trying to do.

GUI.BackgroundGraphic gets and set the graphic with a sprite number. At least what I can find in the manual. Is there a way to give a DynamicSprite a number to be use for GUI.BackgroundGraphic?  :(
Want to see how I am doing and how far I've gotten in my game? Visit my forum  http://www.freepowerboards.com/DragonKnight

GarageGothic

Quote from: Gold Dragon on Thu 22/05/2008 23:46:32GUI.BackgroundGraphic gets and set the graphic with a sprite number. At least what I can find in the manual. Is there a way to give a DynamicSprite a number to be use for GUI.BackgroundGraphic?  :(

DynamicSprites actually do have sprite slot numbers. Just use DynamicSprite.Graphic (so if you have a GUI names gTextBox and a DynamicSprite called TextBoxSprite, you would write "gTextBox.BackgroundGraphic = TextBoxSprite.Graphic;"

Gold Dragon

#7
AWWW SWEET!!!!! THX  ;D ;D ;D ;D

EDIT:

I have successfully implemented it. Works like a charm thanks guys!! Also Pumaman I noticed you added a similar thing that can be done in RC 1 with Text Window Gui's. VERY NICE!!

Now here is just another big problem I have....

Which one do I use!!  :o   LOL!!!   ;D ;D

Want to see how I am doing and how far I've gotten in my game? Visit my forum  http://www.freepowerboards.com/DragonKnight

SMF spam blocked by CleanTalk