This is exactly right. I'll detail the code I see in the event handler.vitek wrote:Violet,
You are totally off base here. CuteAlien is right, there is no way in hell that the compiler is generating bad code because you're using Irrlicht. The problem is that you are using Irrlicht incorrectly, and you are jumping to conclusions. Honestly.
From looking at your code I would guess that the problem is in the event receiver [as pointed to by CuteAlien]. You are misinterpreting the use of the KeyInput.Key member. That is the key code for the key that was pressed, but you are using it like it is an indicator to see if the key is pressed down or not.
Travis
Code: Select all
//at this point, you know a key is pressed, but not which one
switch(event.KeyInput.Key) //here you give what to do according to each different key
{
// Camera.
case KEY_UP://if the key is the up arrow key
inputUp = event.KeyInput.Key; //inputUp now equals KEY_UP
break; remember, you just used event.KeyInput.Key to say whether it is KEY_UP, KEY_DOWN, or KEY_ESCAPE, and now you just set the variable "inputUp" to equal whatever is in event.KeyInput.Key, which in this case is "KEY_UP"
case KEY_DOWN:
inputDown = event.KeyInput.Key;
break; //You did the same here except for it is KEY_DOWN now.
// Inputs.
case KEY_ESCAPE:
if (!event.KeyInput.PressedDown)
{
inputEsc = event.KeyInput.Key; //once again, see what you did.
}
break;
Hopefully, that should give you an idea what you are doing wrong. Also, don't take this wrong, but until you are more familiar with the engine and programming in C++, please don't assume a bug on the engine. Ask first, and preferably politely. I've never seen you post before, which is why I chose to help you even after seeing your rude posts from above. So please, be respectful, as it is much easier to give help to a respectable person who politely asks for the help instead of expecting us to do the homework. I personally appreciate the community here and I myself am no expert, but check my post history. Every request for help I've had resulted in good answers, mainly because I asked nicely.