Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Ytterbium on Sat 17/01/2004 04:19:36

Title: Minor suggestion that would help: SetPreviousCursorMode
Post by: Ytterbium on Sat 17/01/2004 04:19:36
I'd like there to be a SetPreviousCursorMode function. In my game, the player can change the cursor mode with the mouse wheel (there's another way for the mousewheelless, don't worry), but because the cursor mode only cycles in one direction, moving the wheel either way does the same thing. This is a minor issue, but it would be nice if it could be added.
Title: Re:Minor suggestion that would help: SetPreviousCursorMode
Post by: Ryukage on Sat 17/01/2004 06:54:36
I'll second this suggestion, since it should be a pretty easy thing for CJ to add.

In the meantime, here's a workaround:

function on_mouse_click(int button) {

 . . .

 if(button == WHEELNORTH) {  // reverse-cycle cursor
   // get current mode
   int mode = GetCursorMode();
   int i = mode - 1;
   
   // loop if we go past zero
   if(i < 0) {
     i = 5;  // change 5 to the highest standard mode number you use
   }
   
   // keep trying decreasing mode numbers until one is accepted
   while((GetCursorMode() == mode) && (i >= 0)) {
     SetCursorMode(i);
     i--;
   }
 }

. . .

}
Title: Re:Minor suggestion that would help: SetPreviousCursorMode
Post by: Ishmael on Sat 17/01/2004 12:08:23
function SetPreviousCursorMode () {
int curmode = GetCursorMode();
if (curmode == 0) curmode = 3; // change the 3 to the number of the LAST standard mode if you have more of them
else curomde --;
SetCursorMode(curmode);
}
Title: Re:Minor suggestion that would help: SetPreviousCursorMode
Post by: Pumaman on Sat 17/01/2004 12:37:31
While it can be scripted as Ryukage has demonstrated, it would be a handy feature to have - suggestion accepted, thanks.