Game Development Community

Terrible programmer has a question to enable completion of first game...

by Sean Brady · in General Discussion · 07/11/2011 (5:04 am) · 2 replies

Sorry to bother the community,

I am developing a small 2d game with C++ & DarkGDK (almost finished - first one ever) and there is one specific part of the logic I cannot work out. Basically when the left mouse button is pressed down (true/1) and when released (false/0). When the left mouse button is pressed down a function is called (just to randomise a variable). It randomises the variable until a release of the left mouse button. How could the logic be altered to say if true/1 then release (false/0) call function?

The realisation that it is a simple problem has hit home already but brain can't seem to process it.

Any advice would be appreciated.

Cheers.

#1
07/11/2011 (9:15 am)
unless your system tracks the transition of on to off and vice versa, rather than the state of the mouse button i think you are pretty stuck.

you need to see if theres an onMouseButtonUp callback or something to call a function, while i know all this stuff exists in the windows API i dont know if the GDK over-rides the default OS calls.

This is probably not the best forum either, the game creators community is at least as helpful as the torque community as far as ive read, and more experienced in GDK stuff :)

#2
07/14/2011 (8:03 am)
"unless your system tracks the transition of on to off and vice versa, rather than the state of the mouse button i think you are pretty stuck." - thank god someone else clocked that. I thought I had missed something.

"you need to see if theres an onMouseButtonUp callback or something to call a function, while i know all this stuff exists in the windows API i dont know if the GDK over-rides the default OS calls." - unfortunately it does override the winAPI controls.

"This is probably not the best forum either, the game creators community is at least as helpful as the torque community as far as ive read, and more experienced in GDK stuff :)" - pardon my ignorance. I thought it was a problem regarding my capability to think logically (gg members have always had a better logical clue than myself) and it turns out to be the fault of the api and my own lack of understanding an api's usefulness.

Thanks again for reply.