Minor suggestion that would help: SetPreviousCursorMode

Started by Ytterbium, Sat 17/01/2004 04:19:36

Previous topic - Next topic

Ytterbium

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.

Currently in production: Septigon

Ryukage

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--;
   }
 }

. . .

}
Ninja Master Ryukage
"Flipping out and kicking off heads since 1996"

Ishmael

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);
}
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

Pumaman

While it can be scripted as Ryukage has demonstrated, it would be a handy feature to have - suggestion accepted, thanks.

SMF spam blocked by CleanTalk