quick question mouse key

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
RizzleR
Posts: 15
Joined: Tue Jun 15, 2004 10:12 am

quick question mouse key

Post by RizzleR »

when i map this:

Keys[EPA_MOVE_FORWARD] = irr::KEY_RBUTTON;

i doesn't work ingame
Endar
Posts: 145
Joined: Mon Jun 14, 2004 7:59 am

Post by Endar »

Okay, are you trying to use an array of "SKeyMap"? If you are then each array element actually has two parts. I think it's a struct or like a struct, anyway, off track.

If you are using "SKeyMap" then each array element has an 'Action' part and a 'KeyCode' part.

Code: Select all

keyMap[0].Action = EKA_MOVE_FORWARD;
keyMap[0].KeyCode = KEY_UP;
keyMap[1].Action = EKA_MOVE_BACKWARD;
keyMap[1].KeyCode = KEY_DOWN;
keyMap[2].Action = EKA_STRAFE_LEFT;
keyMap[2].KeyCode = KEY_LEFT;
keyMap[3].Action = EKA_STRAFE_RIGHT;
keyMap[3].KeyCode = KEY_RIGHT;
http://irrlicht.sourceforge.net/docu/cl ... r.html#a12

Take a look. :D


EDIT:
I just realized that I might be wasting your time here. I used this for defining keys for a FPS camera. I don't know if it'll work for other things.
"The reputation of a thousand years may be determined by the conduct of one hour."
-Japanese Proverb
RizzleR
Posts: 15
Joined: Tue Jun 15, 2004 10:12 am

Post by RizzleR »

well its not the problem that i can't assign it
problem is if i asign a keyboard key it responds just as soon as i map
a mousekey it doesn't respond
Endar
Posts: 145
Joined: Mon Jun 14, 2004 7:59 am

Post by Endar »

Then its not just you. I tried with the defining for the FPS camera and the mouse button wouldn't work for that either.

Maybe there's some additional setting up that has be done for the mouse.
"The reputation of a thousand years may be determined by the conduct of one hour."
-Japanese Proverb
Endar
Posts: 145
Joined: Mon Jun 14, 2004 7:59 am

Post by Endar »

Take a look at the OnEvent function or write your own. Its quite possible that the function doens't take into account a possible mouse click.

Code: Select all

   // If event is mouse input
   if( event.EventType == irr::EET_MOUSE_INPUT_EVENT){
        // If mouse cursor moved
        if(event.MouseInput.Event == irr::EMIE_LMOUSE_PRESSED_DOWN){
             return true;
        }
   }
Take a look at http://irrlicht.sourceforge.net/docu/st ... Event.html and
http://irrlicht.sourceforge.net/docu/na ... .html#a179

particularly:

Code: Select all

  
struct { 
      s32   X 
      s32   Y 
      f32   Wheel 
      EMOUSE_INPUT_EVENT   Event 
   }  MouseInput 
"The reputation of a thousand years may be determined by the conduct of one hour."
-Japanese Proverb
RizzleR
Posts: 15
Joined: Tue Jun 15, 2004 10:12 am

Post by RizzleR »

thanx endar got it to work with ur notes
Post Reply