Jump to content

  • Log In with Google      Sign In   
  • Create Account

XNA Keyboard input in Lua


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
No replies to this topic

#1 satsujin   Members   -  Reputation: 139

Like
0Likes
Like

Posted 30 November 2013 - 12:03 AM

Hi folks, I have been trying to move my xna input checks into Lua. It has worked for the most part but strangely while the speed is fine in C# when I move the script to Lua, the keyboard input seems to have a bug in it where it lags before responding. If I just press and release the Space key nothing comes in my output windows but it works if i hold it down for about 2-3 seconds and release it. This bug does not occur with mouse input. I don't know why.

 

Here is is my script which is run from a DoFile in my XNA Update loop. 

if (gameController.inputController:Pressed(Keys.Space))
then
Console.WriteLine("pressed");
    if (mainMenu.cursorState == "look")
    then
        mainMenu.cursorState = "talk";
        Console.WriteLine(mainMenu.cursorState);
    else
        mainMenu.cursorState = "look";
        Console.WriteLine(mainMenu.cursorState);
    end
end 

the Pressed function is used to just check the previous KeyboardState and the current Keyboard state so that we know the key has been pressed and released instead of just being pressed.



Sponsor:



Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS