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 / Always false,

Author
Message
RoseOwnage
12
Years of Service
User Offline
Joined: 6th Dec 2011
Location:
Posted: 15th Dec 2011 21:48
it goes always false,

because:
when you press q and variable qPressed = true it turns to false.

and

when you press q and variable qPressed = false it turns to true.
(and it read the second line)
when you press q and variable qPressed = true it turns to false.

how can i prefend this and change it to true?

-RoseOwnage

Hi
vitinho444
14
Years of Service
User Offline
Joined: 12th Oct 2010
Location:
Posted: 15th Dec 2011 22:38
try a else or a else if

By logic it will be:

Was Q pressed? Yes? Then it's being pressed now? Yes? turn true

Else

Was Q pressed? No? Then it's being pressed now? No? Turn false


I think the best thing is you to make just:

if(dbKeyState(16)){ //ITS BEING PRESSED }
else {//ITS NOT BEING PRESSED}

C++ Medium 3.5/5
VB6 Advanced: 4/5
VB.NET Advanced: 4/5
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 16th Dec 2011 07:51
if you put an "else" for the second if then it will keep switching between the 2 while q is pressed, but that seems somewhat useless, are you trying to capture "Q" release? try
for the second if

RoseOwnage
12
Years of Service
User Offline
Joined: 6th Dec 2011
Location:
Posted: 18th Dec 2011 15:04
ok so i have added this but it just crashing so i maked a counter,
for the people who want this to i give just the code:


Hi
RoseOwnage
12
Years of Service
User Offline
Joined: 6th Dec 2011
Location:
Posted: 18th Dec 2011 21:28
but now, when you press your right mouse then the view change to?

Hi
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 18th Dec 2011 22:12
with these mysterious posts, don't expect much help
please give more information and be more specific with the problem

Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 19th Dec 2011 13:41 Edited at: 19th Dec 2011 13:47
I usually do something like this (forgive the java-ism):
Edit: apparently something in my code is considered "bad language". Have looked it through and can't figure out whatever that might be, but I put the source here for now.

That class features various input modes such as "hold key to 'activate' every x milliseconds", "was the key depressed in this very loop cycle (and not the previous one)" etc.
It's pretty simple logic if you take a look at it, hope it helps


"Why do programmers get Halloween and Christmas mixed up?"

Login to post a reply

Server time is: 2024-11-19 05:37:48
Your offset time is: 2024-11-19 05:37:48