Please help with strange input problem (bug?) (mouse click related)

hi,

ive recently descovered a strange bug, and i hope someone here knows about it
and knows how to fix it. im working on a 2d RPG w / C++, SDL, and OpenGL. ive
been working on the level editor lately, and have discovered a strange bug.

basically, i could left click on something, and after that moment, its almost as
if the left click is constantly clicking. IE, i just hover over a button, and it
clicks that button automatically. its very strange. so basically i click once on
something, then all of a sudden ill go to click on another button, but it will
click for me, i only have to hover. i dont like this =).

so has anyone experianced anything like this before? thanks for any help!

hi,

ive recently descovered a strange bug, and i hope someone here knows about it
and knows how to fix it. im working on a 2d RPG w / C++, SDL, and OpenGL. ive
been working on the level editor lately, and have discovered a strange bug.

basically, i could left click on something, and after that moment, its almost as
if the left click is constantly clicking. IE, i just hover over a button, and it
clicks that button automatically. its very strange. so basically i click once on
something, then all of a sudden ill go to click on another button, but it will
click for me, i only have to hover. i dont like this =).

Yeah, I saw that once. I was setting a global variable when I saw a
mouse button press and forgetting to clear it when I saw the mouse
button release. So, once I had pressed the mouse button, the program
thought it was down forever.

It acted just like what you are describing.

	Bob PendletonOn Fri, 2004-09-10 at 15:13, Drew Ferraro wrote:

so has anyone experianced anything like this before? thanks for any help!


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

±-------------------------------------+

hey bob,

thanks for your reply. if you dont mind, could you please go into more detail on
exactly what was causing the problem and how you fixed it? thanks

hey bob,

thanks for your reply. if you dont mind, could you please go into more detail on
exactly what was causing the problem and how you fixed it? thanks

I had a global variable called something like buttonOnePressed that was
I set to true when ever I my event handling loop saw a button press
event for buttone one. When I got a buttone released event I was
planning to set buttoneOnePressed to false. The trouble is that I just
copied the code for the button press event to the button release event
and forgot to modify it. So, once a button press event was seen
buttonOnePessed was set to true, and when it was released, it was again
set to true. So, all my code that looked at the buttonOnePressed
variable always saw that it was pressed. Took me way to long to figure
out the problem.

It didn’t take long after that to realize that what I was doing was just
wrong. The way I had done it I was missing a lot of events. I was a
typing mistake heaped on top of a serious thinking mistake. I fixed the
problem thinking mistake and, of course, the typo got fixed too.

		Bob PendletonOn Fri, 2004-09-10 at 19:15, Drew Ferraro wrote:

SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

±-------------------------------------+