[2.0]-Clear Mouse Button Down Events At App Start? |
[2.0]-Clear Mouse Button Down Events At App Start? |
MrOzBarry
|
You could just run a loop like:
SDL_Event discard; while (SDL_PollEvent(&discard)) {} That will clear the event buffer, and stop once the first few events are fired. You shouldn't, however, be getting a mouse down unless you're clicking. Can you try starting your app from the command line; the app might be registering a click from double clicking the executable or something odd like that. If the command line fixes that, then at least you know where the click is coming from. -Alex On Mon, Mar 2, 2015 at 11:06 AM, JeZ-l-Lee wrote:
|
|||||||||||||
|
[2.0]-Clear Mouse Button Down Events At App Start? |
MrOzBarry
|
I should mention that loop should be placed before your main application loop.
On Mon, Mar 2, 2015 at 11:23 AM, Alex Barry wrote:
|
|||||||||||||||
|
Re: [2.0]-Clear Mouse Button Down Events At App Start? |
JeZ-l-Lee
|
I tried adding what you suggested right before the main loop of the game. Still getting a mouse button down event right when the game starts? I know it's a mouse button down event because my company screen skips immediately to title screen. Only occurs when double-clicking the EXE and not when run from command prompt or Code::Blocks IDE. Any other ideas? |
|||||||||||||
|
JeZ-l-Lee
|
Hi,
Still have issue with mouse button down at app start. Here is my code:
Am I doing something wrong? |
|||||||||||||
|
Sparks
|
What is before your for loop? You need a SDL_PumpEvents(); right before it, so the values of SDL_GetMouseState make sense. BTW, why do you have MouseButtonPressed[index] = true; MouseButtonWasClicked[index] = true;? Seems redundant. |
|||||||||||||||
|
[2.0]-Clear Mouse Button Down Events At App Start? |
Ryan C. Gordon
Guest
|
It looks like in this case, one means "the button is pressed" the other means "the button was pressed for the first time during this frame," I think. Jesse, is this only happening Windows (and is this source code somewhere I can see?). I'd like to verify if this is an SDL bug before 2.0.4 is finalized. Thanks, --ryan. _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||
|
Re: [2.0]-Clear Mouse Button Down Events At App Start? |
JeZ-l-Lee
|
I was not doing "SDL_PumpEvents();" before the mouse button code so the problem might have been that? The development desktop with Windows 8.1 Pro 64Bit blew a PCI network adapter and I am waiting for a replacement. On my test desktop with Windows 8.1 Pro 64Bit native this issue is not occurring. I should note that the problem was only on my broken desktop with Win 8.1 Pro 64Bit running in a VMWare Player 7 virtual machine under a Linux Mint 17.1 KDE 64Bit host. When I have the dev desktop back up and running I'll see if adding "SDL_PumpEvents();"to the source fixes the issue... Thanks! |
|||||||||||||
|
JeZ-l-Lee
|
Hi,
"SDL_PumpEvents();" does not solve the problem. On Win 8.1 Pro 64Bit VMWare Player guest on Linux Mint 17.1 KDE 64Bit host SDL2 registers a mouse button down when application is 1st run. (only occurs when EXE is double-clicked) Hope this can be fixed in 2.0.4, thanks! |
|||||||||||
|
JeZ-l-Lee
|
Here is the source code to "TetriCrisis 4 110% A.I. Turbo":
http://16bitsoft.com/TC4T/TetriCrisis4110PercentAITurbo.htm (this web page is private from my Internet portfolio, please don't distribute it) Hope this issue can be fixed, thanks! |
|||||||||||
|
macrofeet
|
Same issue with left click starting app with double click
changed if(event.button.button == SDL_BUTTON_LEFT) GoGame(); to if(event.button.button == SDL_BUTTON_RIGHT) GoGame(); works correctly so seems like its registering the 2nd click as a click while (SDL_PollEvent(&discard)) { SDL_Delay(100);} // This worked bit lame tho |
|||||||||||
|
JeZ-l-Lee
|
I tried what you typed and it does not work for me? |
|||||||||||||
|
macrofeet
|
SDL_Event event;
while (SDL_PollEvent(&event)) { SDL_Delay(1);} weird I'm using it on the following game it works fine http://gamejolt.com/games/asteroids-flackroid-hd/52501 |
|||||||||||
|