Mouse mode enums

Started by Alynn, Wed 26/07/2006 06:26:05

Previous topic - Next topic

Alynn

Ok what I'm trying to do is when certain GUI's are up the cursor will change to the pointer. This I can get done with no problem, the issue lies with the cursor turning back into the last cursor used before the GUI was displayed.

The first thing I tried was to create my own Mouse variable, that would just store the Mouse.mode of the current mode and then give it back once the gui's are closed. This of course throws an error.

Code: ags
Mouse *lastMouse;
function repeatedly_execute_always(){
  if ((gOptions.Visible) || (gSavelist.Visible)){
    if (Mouse.Mode != eModePointer){
      lastMouse.Mode = Mouse.Mode;
      Mouse.Mode = eModePointer;
    }
  }
  else {
    if (Mouse.Mode == eModePointer){
      Mouse.Mode = lastMouse.Mode;
    }
  }
}


Cannot declare pointer to a non managed type. Ok fine.

I know about UseModeGraphic and UseDefaultGraphic, however, since the cursor mode doesn't change and I can't seem to find a way for the game to know that I'm not using the default graphic, and I want to be sure it goes back to the correct graphic for it's current mode, but only if the options and save gui are not active.

I've searched the manual, but I didn't see anything on what the enum name is to try to store the last mode as a Mouse enum value, which is what I tried to do next. I even tried to use mouse instead of Mouse, but that didn't work either.

So am I missing something? Is it not possible to store the current mouse mode in order to restore it later?

Sorry if this seems simple, but I've been messing with it for 20 minutes, it's 6 in the morning, and I haven't had any coffee yet.

SSH

Just declare an int and store mouse.Mode in it...
12

Alynn

Oh wow, why didn't I frickin think of that...

Too early in the morning for code I guess... For some reason I was thinking that you couldn't set it as an int it had to be of the same enum type...

I think that might be a Java thing, which is why I was thinking that way... who knows...

Thanks SSH I feel like a total moron.

SSH

I was too lazy to look it up before, but the type you want is CursorMode, but int also works

Code: ags

CursorMode lastMouse;
function repeatedly_execute_always(){
  if ((gOptions.Visible) || (gSavelist.Visible)){
    if (Mouse.Mode != eModePointer){
      lastMouse = Mouse.Mode;
      Mouse.Mode = eModePointer;
    }
  }
  else {
    if (Mouse.Mode == eModePointer){
      Mouse.Mode = lastMouse;
    }
  }
}

12

SMF spam blocked by CleanTalk