Mouse Release?

Posted By: Dooley

Mouse Release? - 04/26/15 07:41

Is there function or variable built into the engine that recognized when a mouse button is released?

I'm really surprised that I have never looked this up, and that it's not in the manual...
Posted By: Denn15

Re: Mouse Release? - 04/26/15 09:29

im pretty sure that there is not however you can check it this way:

Code:
...
while(mouse_left)
{
   wait(1);
}
//mouse is released here
...

Posted By: DLively

Re: Mouse Release? - 04/26/15 12:54

Code:
var mouse_activated = 0;
...

if(mouse_left && !mouse_activated){
    mouse_activated = 1;//activate the switch
    //The rest of your code here:
}
if(!mouse_left && mouse_activated){
    //your on release code here
    //mouse_activated = 0;//reset te switch
}

Posted By: Superku

Re: Mouse Release? - 04/27/15 02:05

On top of that you can create a corresponding event yourself which gets triggered on mouse button release, for example as follows:

var mouse_left_off = 0;
Make a loop which deals with player input, then add something like this:
Code:
void handle_input()
{
while(1)
{
  ... keyboard input

  if(mouse_left) mouse_left_off = 0;
  else
  {
    if(!mouse_left_off) mouse_left_off_event(); // 
    mouse_left_off = 1;
  }
  wait(1);
}
}

© 2024 lite-C Forums