Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Molin on Sat 16/08/2003 21:49:40

Title: Object name besides mousecursor
Post by: Molin on Sat 16/08/2003 21:49:40
Hi all...
dont know if anybody has done this before but here i  a snippet that puts the hotspot and object test besides the mousecursor in a offset. BASS like.

define globals:
int overlay = 0, olay1;

in repeatedly_execute():
if (IsGamePaused() != 1)
{
if (GetLocationType( mouse.x, mouse.y)!=0 ){
  string buffer;
  GetLocationName(mouse.x, mouse.y, buffer);
  if (overlay == 0)
  {
   
    olay1 = CreateTextOverlay (mouse.x+5,mouse.y-10,120,1,15,buffer);
    overlay = 1;
  }
  if (overlay == 1 && IsOverlayValid(olay1)==1)
  {
    SetTextOverlay (olay1,mouse.x+5,mouse.y-10,120,1,15,buffer);
  }
}
else {
overlay = 0;
if ( IsOverlayValid(olay1)==1 ) RemoveOverlay(olay1);
}
}


/Molin
Title: Re:Object name besides mousecursor
Post by: Necro on Sat 16/08/2003 22:16:46
Yeah Me and RobertEric were talking about this last month as I have the same thing in mine , ive gone for a bass look..

I went for the invisible GUI with a textbox approach that is positioned near the mouse cursor, and RobertEric went for the TextOverlay Approach, apparently they both are as good as each other according to CJ but you may have some trobles when next approaches the GUI as the text overlay DOESNT overlay any other GUI's, where as if you place a text label on a GUIand move it as long as the GUI number it is is higher then the ones you want it to overlay it works... ( I wanted Text beside mouse on my inv aswell you see)

I can give you my code if you wish , or RobertErics, tell me what you would prefer.

(screenie of mine)
(http://www.amazing-ebooks.co.uk/images/ags/current/demoroom2.gif)
Title: Re:Object name besides mousecursor
Post by: Captain Mostly on Sun 17/08/2003 07:50:53
I would be really interested to see your code necro, as this looks like a marvelous idea (In fact, I almost think it should be available as a standard feature in AGS: DisplayPoiterText() or something)

Would it be possible to post it here, so I can come back and look at it for reference?

Surly, if you did this with a GUI, the code would  have a lot in common with a CMI verb-coin... and there's ALWAYS someone asking how to do that (although I've never seen it implemented in a a game yet!)
Title: Re:Object name besides mousecursor
Post by: Necro on Sun 17/08/2003 13:58:14
Ok I knocked up a quick page with it all on because if I posted it here it would mess up the indentation...

http://www.amazing-ebooks.co.uk/ags/tutorials/guioverhotspot.html

You can also d/l what it looks like because I think it exists in my custom GUI tutorial and a demo game i made...

http://www.amazing-ebooks.co.uk/download/download.php?id=001

ok , well I hope that helps...