Popup YPos: below position?

Started by stuh505, Tue 18/05/2004 00:12:53

Previous topic - Next topic

stuh505

I could have sworn some games had a GUI popup at the bottom of the screen...like maybe Apprentice...

anyway, I want my popup window to pop up at the bottom of the screen, but it seems by default to only count the above.  Can this be changed?  If so...please tell....it would be nice if it were POpupX position also and if there was just a checkbox for above/below left/right.

strazer

I guess there's no extra setting for this since it can already be done with scripting.
Here is my version:

Global script
#define YGUITRIGGER 20 // Popup YPos (pixels)
#define YGUIHEIGHT 30 // your gui's relative height
#define YGUIX 0 // x-position of the gui
int yguiy=239; // y start position of the gui*

repeatedly_execute(_always)

if ((mouse.y > system.viewport_height-YGUITRIGGER) || (mouse.y >= yguiy)) {
   if (yguiy > (system.viewport_height-YGUIHEIGHT)) {
      yguiy -= 1; // increase value to increase speed
   }
}
else if (mouse.y < yguiy) {
   if (yguiy < (system.viewport_height-1)) {
      yguiy += 1; // increase value to increase speed
   }
}
SetGUIPosition(YOURYGUINAMEHERE, YGUIX, yguiy);

*replace with (relative screen height-1) of your game, ie 239 at 640x480 and set your gui to this position in the editor

(This script requires AGS v2.61 because of the system.viewport_height variable.)

stuh505

ah, thanks   :) I should have thought of that.Ã,  i have strayed from ever using the repeatedly execute because i don't want to create a non-smooth mouse movement, how much have you found you can put there without noticeable difference?

strazer

No problem. :)

Well, it depends on what you are doing in the rep_ex.
The calculations themselves are very fast, but you will start noticing slowdowns when handling a lot of graphics, i.e. rawdrawing, moving multiple objects, overlays etc.

I always make sure to put a lot of basic conditions in there, so most of the code is only executed when needed.
For example, only move objects currently visible on the screen (in scrolling rooms) etc.

Darth Mandarb

In JP & Cosmo I have a GUI (the main GUI) which pops up only when your mouse moves to the left of the screen.

I did a more simple script than Strazer's ... but his is better!

Mine said basically:

If the gui is off and the mouse goes to the left side of the screen (less than 5) it turns the GUI on.  If the GUI is on (meaning you've moved to the left of the screen) the mouse.x position must be greater than 100 to shut the GUI off.

It works perfectly this way.

SMF spam blocked by CleanTalk