Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: RenderWindow#EnableKeyRepeat does nothing  (Read 7309 times)

0 Members and 1 Guest are viewing this topic.

rpgmaker

  • Newbie
  • *
  • Posts: 38
    • View Profile
RenderWindow#EnableKeyRepeat does nothing
« 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

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
RenderWindow#EnableKeyRepeat does nothing
« Reply #1 on: March 05, 2009, 07:49:07 am »
I'll check this, thanks for your feedback :)
Laurent Gomila - SFML developer

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
RenderWindow#EnableKeyRepeat does nothing
« Reply #2 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, ...)?
Laurent Gomila - SFML developer

rpgmaker

  • Newbie
  • *
  • Posts: 38
    • View Profile
RenderWindow#EnableKeyRepeat does nothing
« Reply #3 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.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
RenderWindow#EnableKeyRepeat does nothing
« Reply #4 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.
Laurent Gomila - SFML developer

rpgmaker

  • Newbie
  • *
  • Posts: 38
    • View Profile
RenderWindow#EnableKeyRepeat does nothing
« Reply #5 on: March 06, 2009, 01:31:14 am »
What do you mean by "EnableKeyRepeat is for controlling the behaviour of KeyPressed events."

Astrof

  • Full Member
  • ***
  • Posts: 135
    • View Profile
RenderWindow#EnableKeyRepeat does nothing
« Reply #6 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.

rpgmaker

  • Newbie
  • *
  • Posts: 38
    • View Profile
RenderWindow#EnableKeyRepeat does nothing
« Reply #7 on: March 06, 2009, 05:19:24 am »
Thanks for the suggestion. It worked ^_^

 

anything