🔒 Locked
err, console problem
Advertisement
Original Post
hi,
i've created a console ( hmm, not bad )
but seems i got a problem, all keys are inserted twice!
if i type "quit"
it would be on the console as "qQuUiItT".
and of course the enter key enters two commands into the console
did i missed somthin overhere?
this is how i do it:
1) switch (Msg)
2) case WM_CHAR:
3) console.insert(wParam);
if this is a silly question, please help me i am not a programmer, i am a mechanical engineering student.
( and this is my hobby )
... :'(
"The Railgun Master"
DaHeR
Edited by - DaHeR on January 15, 2002 10:21:01 AM
It is because your game is checking keypresses too quickly. The console is checking keys at what, once every millisecond (or even more), and when you press down a key, you hold it down long enough for it to process 2 keydown messages for that key you pressed.
Either you can limit the speed, or just set that key''s flag to false after you''ve processed it the first time.
Either you can limit the speed, or just set that key''s flag to false after you''ve processed it the first time.
whatabout WM_KEYDOWN instead of WM _CHAR?
quote:
Original post by alargeduck
whatabout WM_KEYDOWN instead of WM _CHAR?
quote:
Original post by wAVaRiaN
just set that key''s flag to false after you''ve processed it the first time.
thanx for replying...
but are u saying that i have to process all the keys being held and turn off the keys processed?
dont u think that this idea makes my game very slow?
and heh, if the user pressed ''a'' i have to check the shift status to determin ''a'' or ''A''...
there should be a problem with that, belive me
does any one else gorra better idea?
"The Railgun Master"
DaHeR
Hey
I''ve got a working console and all I did was when a key was input I got the current time (using GetTickCount. The next time a key was pressed if the currenttime - previoustime < 100 (milliseconds?) then I don''t input it else I enter that key.
Works for me
"To err is human, to really mess up requires a computer"
I''ve got a working console and all I did was when a key was input I got the current time (using GetTickCount. The next time a key was pressed if the currenttime - previoustime < 100 (milliseconds?) then I don''t input it else I enter that key.
Works for me
"To err is human, to really mess up requires a computer"
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement