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

Author Topic: isKeyHold for some time  (Read 965 times)

0 Members and 1 Guest are viewing this topic.

sensus12

  • Newbie
  • *
  • Posts: 6
    • View Profile
isKeyHold for some time
« on: September 14, 2014, 08:22:04 pm »
Hello. First of all i wanna say that, my english is not my native language so i may make many mistakes.

Ok, i have no idea how should i check if key was hold for some time, i mean i press space and i wanna to know if it was hold for some time or released, how am i supposed do that?

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: isKeyHold for some time
« Reply #1 on: September 14, 2014, 08:24:42 pm »
Every frame check if the key is pressed, if it is add the delta time to a variable to track how long it has been pressed, if it is not pressed then set the tracked time to zero.

Could you really not have tried to figure it out on your own before asking?
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

 

anything