SFML community forums
Bindings - other languages => DotNet => Topic started by: rpgmaker on March 05, 2009, 01:48:42 am
-
When i tried disable key repeat, it does nothing. It keeps repeating key when i hold it down. Is there a solution to fix this problem? Thanks for the help
-
I'll check this, thanks for your feedback :)
-
It works for me.
Can you give me a minimal and complete example which reproduces the problem? And some information about your configuration(OS, version of SFML, ...)?
-
I am currenting using windowxp home with sfml 1.4.
I did something similar to below
//Create Render Window
MyRenderWindow.EnableKeyRepeat(false);
//Start Render Loop
while(true){
MyRenderWindow..DispatchEvents();
MyRenderWindow.Clear();
.....
if(MyRenderWindow.Input.IsKeyDown(KeyCode.A)){
//To something
}
MyRenderWindow.Display();
}
I guess want i am really looking for is IsKeyPressed because it seem like KeyDown would execute as long as the key is down. I thought that by setting KeyRepeat to false, that it only execute my code for each press rather than for the period of time which the key is down.
-
IsKeyDown is a state, it will be true as long as the key is down. EnableKeyRepeat is for controlling the behaviour of KeyPressed events.
-
What do you mean by "EnableKeyRepeat is for controlling the behaviour of KeyPressed events."
-
EnableKeyRepeat is used for Event Processing. Instead of using an sf::Input check out sf::Event
Look at the Tutorials sections over events:
http://www.sfml-dev.org/tutorials/1.5/window-events.php
and take a look at the KeyPressed part.
-
Thanks for the suggestion. It worked ^_^