mirror of
https://github.com/w23/xash3d-fwgs
synced 2024-12-16 14:10:11 +01:00
engine: platform: sdl: Fix mousewheel in SDL2
- See issue 143 - Tested on SDL2 - Untested on SDL1.2
This commit is contained in:
parent
87340ceca8
commit
79a7b7b1a3
@ -25,8 +25,6 @@ GNU General Public License for more details.
|
|||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
#include "vid_common.h"
|
#include "vid_common.h"
|
||||||
|
|
||||||
static int wheelbutton;
|
|
||||||
|
|
||||||
#if ! SDL_VERSION_ATLEAST( 2, 0, 0 )
|
#if ! SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||||
#define SDL_SCANCODE_A SDLK_a
|
#define SDL_SCANCODE_A SDLK_a
|
||||||
#define SDL_SCANCODE_Z SDLK_z
|
#define SDL_SCANCODE_Z SDLK_z
|
||||||
@ -366,14 +364,6 @@ SDLash_EventFilter
|
|||||||
*/
|
*/
|
||||||
static void SDLash_EventFilter( SDL_Event *event )
|
static void SDLash_EventFilter( SDL_Event *event )
|
||||||
{
|
{
|
||||||
static int mdown;
|
|
||||||
|
|
||||||
if( wheelbutton )
|
|
||||||
{
|
|
||||||
Key_Event( wheelbutton, false );
|
|
||||||
wheelbutton = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch ( event->type )
|
switch ( event->type )
|
||||||
{
|
{
|
||||||
/* Mouse events */
|
/* Mouse events */
|
||||||
@ -421,9 +411,12 @@ static void SDLash_EventFilter( SDL_Event *event )
|
|||||||
break;
|
break;
|
||||||
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||||
case SDL_MOUSEWHEEL:
|
case SDL_MOUSEWHEEL:
|
||||||
wheelbutton = event->wheel.y < 0 ? K_MWHEELDOWN : K_MWHEELUP;
|
{
|
||||||
|
int wheelbutton = event->wheel.y < 0 ? K_MWHEELDOWN : K_MWHEELUP;
|
||||||
Key_Event( wheelbutton, true );
|
Key_Event( wheelbutton, true );
|
||||||
|
Key_Event( wheelbutton, false );
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* Touch events */
|
/* Touch events */
|
||||||
case SDL_FINGERDOWN:
|
case SDL_FINGERDOWN:
|
||||||
|
Loading…
Reference in New Issue
Block a user