Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK .NET / Input help

Author
Message
StartCoder
14
Years of Service
User Offline
Joined: 16th Oct 2009
Location:
Posted: 8th Nov 2009 22:59
Hello Guys,

I need little help on input controle !.

how can i make someone hold key (so not press but hold?).

here is the part of press but i need HOLD....


Thank you in advance.
Chess
17
Years of Service
User Offline
Joined: 25th Mar 2007
Location: Québec, Canada
Posted: 9th Nov 2009 02:24
I am using form events to do it. On KeyDown, I do set a variable to true and on KeyUp, I do set it to false, with validation for the input key, of course, and it does work fine.
StartCoder
14
Years of Service
User Offline
Joined: 16th Oct 2009
Location:
Posted: 9th Nov 2009 06:49
Chess,

Thank you for ur reply, verry smart idea .
But.. i dont use any forms.
Chess
17
Years of Service
User Offline
Joined: 25th Mar 2007
Location: Québec, Canada
Posted: 9th Nov 2009 15:05 Edited at: 9th Nov 2009 15:06
If you hold the key, what happens? The condition is true only one time? If not, maybe you don't need to detect if it's hold?

Sorry if my questions seem useless And sorry for my bad english, too; I'm french canadian.
StartCoder
14
Years of Service
User Offline
Joined: 16th Oct 2009
Location:
Posted: 9th Nov 2009 16:49
Chess,

Np my English is bad too haha.

Yes that is what i am looking for ,, to detect if key is hold

because now it repeats if you hold any key.
StartCoder
14
Years of Service
User Offline
Joined: 16th Oct 2009
Location:
Posted: 9th Nov 2009 23:16 Edited at: 9th Nov 2009 23:17
Chess,

I have temporary solution to my problem.
I dont know why i did not came up with it at beginning,, meaby i was thinking 2 hard haha.

So what i have done is made little counter .
it counts if you hold key and when no keys are pressed it will Reset to 0 .

so if the counter is bigger then 5 then i see that as hold
if it is smaller then 5 then it is pressed.

Anyway it works now,,, if someone knows better and faster way please let me know.
Chess
17
Years of Service
User Offline
Joined: 25th Mar 2007
Location: Québec, Canada
Posted: 9th Nov 2009 23:30
Glad to know you have found a solution
Yoda Master
16
Years of Service
User Offline
Joined: 23rd Feb 2008
Location: Genova
Posted: 13th Nov 2009 14:02
A counter? You don't have to know how long the key is hold, do you? So maybe a boolean variable is better, isn't?

Fear leads to anger
Anger leads to hate
Hate leads to suffering
StartCoder
14
Years of Service
User Offline
Joined: 16th Oct 2009
Location:
Posted: 13th Nov 2009 18:23
Yoda master,

i know boolean is possible, but if you want to let someone hold the key for a while then counter is better.
Yoda Master
16
Years of Service
User Offline
Joined: 23rd Feb 2008
Location: Genova
Posted: 13th Nov 2009 20:37
You are right, I didn't understand what you wanted to do! But a counter is not "frame-rate proof"! Maybe a timestamp is better, isn't?

Fear leads to anger
Anger leads to hate
Hate leads to suffering

Login to post a reply

Server time is: 2024-04-17 00:27:02
Your offset time is: 2024-04-17 00:27:02