SFML community forums

Bindings - other languages => DotNet => Topic started by: rpgmaker on March 05, 2009, 01:48:42 am

Title: RenderWindow#EnableKeyRepeat does nothing
Post 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
Title: RenderWindow#EnableKeyRepeat does nothing
Post by: Laurent on March 05, 2009, 07:49:07 am
I'll check this, thanks for your feedback :)
Title: RenderWindow#EnableKeyRepeat does nothing
Post by: Laurent on March 05, 2009, 05:44:54 pm
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, ...)?
Title: RenderWindow#EnableKeyRepeat does nothing
Post by: rpgmaker on March 05, 2009, 11:09:49 pm
I am currenting using windowxp home with sfml 1.4.

I did something similar to below

Code: [Select]
//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.
Title: RenderWindow#EnableKeyRepeat does nothing
Post by: Laurent on March 05, 2009, 11:22:21 pm
IsKeyDown is a state, it will be true as long as the key is down. EnableKeyRepeat is for controlling the behaviour of KeyPressed events.
Title: RenderWindow#EnableKeyRepeat does nothing
Post by: rpgmaker on March 06, 2009, 01:31:14 am
What do you mean by "EnableKeyRepeat is for controlling the behaviour of KeyPressed events."
Title: RenderWindow#EnableKeyRepeat does nothing
Post by: Astrof on March 06, 2009, 03:04:32 am
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.
Title: RenderWindow#EnableKeyRepeat does nothing
Post by: rpgmaker on March 06, 2009, 05:19:24 am
Thanks for the suggestion. It worked ^_^