Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ptitSeb committed Apr 23, 2016
2 parents 9bc1700 + 5a51b43 commit c1651f6
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 16 deletions.
22 changes: 9 additions & 13 deletions Sources/Engine/Base/SDL/SDLInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

/* rcg10072001 Moved stuff into this file. */

#define __STDC_LIMIT_MACROS 1
#include "SDL.h"

#include <Engine/Base/Timer.h>
Expand Down Expand Up @@ -251,6 +252,10 @@ static int _iMouseZ = 0;
static BOOL _bWheelUp = FALSE;
static BOOL _bWheelDn = FALSE;

// emulate Win32: A single mouse wheel rotation
// is +120 (upwards) or -120 (downwards)
#define MOUSE_SCROLL_INTERVAL 120

CTCriticalSection csInput;

// which keys are pressed, as recorded by message interception (by KIDs)
Expand Down Expand Up @@ -327,10 +332,7 @@ static void sdl_event_handler(const SDL_Event *event)
break;

case SDL_MOUSEWHEEL:
if (event->wheel.y > 0)
_abKeysPressed[KID_MOUSEWHEELUP] = TRUE;
else if (event->wheel.y < 0)
_abKeysPressed[KID_MOUSEWHEELDOWN] = TRUE;
_iMouseZ += event->wheel.y * MOUSE_SCROLL_INTERVAL;
break;

case SDL_KEYDOWN:
Expand Down Expand Up @@ -753,10 +755,6 @@ void CInput::GetInput(BOOL bPreScan)
}
}

// reset this every frame (since we explicitly ignore the button-up events).
_abKeysPressed[KID_MOUSEWHEELUP] = FALSE;
_abKeysPressed[KID_MOUSEWHEELDOWN] = FALSE;

// read mouse position
#ifdef USE_MOUSEWARP
int iMx, iMy;
Expand Down Expand Up @@ -825,17 +823,16 @@ void CInput::GetInput(BOOL bPreScan)
}
#endif

/*
// if not pre-scanning
if (!bPreScan) {
// detect wheel up/down movement
_bWheelDn = FALSE;

if (_iMouseZ>0) {
if (_bWheelUp) {
inp_ubButtonsBuffer[KID_MOUSEWHEELUP] = 0x00;
} else {
inp_ubButtonsBuffer[KID_MOUSEWHEELUP] = 0xFF;
_iMouseZ = ClampDn(_iMouseZ-120, 0);
_iMouseZ = ClampDn(_iMouseZ-MOUSE_SCROLL_INTERVAL, 0);
}
}
_bWheelUp = inp_ubButtonsBuffer[KID_MOUSEWHEELUP];
Expand All @@ -844,12 +841,11 @@ void CInput::GetInput(BOOL bPreScan)
inp_ubButtonsBuffer[KID_MOUSEWHEELDOWN] = 0x00;
} else {
inp_ubButtonsBuffer[KID_MOUSEWHEELDOWN] = 0xFF;
_iMouseZ = ClampUp(_iMouseZ+120, 0);
_iMouseZ = ClampUp(_iMouseZ+MOUSE_SCROLL_INTERVAL, 0);
}
}
_bWheelDn = inp_ubButtonsBuffer[KID_MOUSEWHEELDOWN];
}
*/

inp_bLastPrescan = bPreScan;

Expand Down
1 change: 1 addition & 0 deletions Sources/Engine/Base/SDL/SDLTimer.cpp
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* Copyright (c) 2002-2012 Croteam Ltd. All rights reserved. */

/* rcg10072001 Moved stuff into this file. */
#define __STDC_LIMIT_MACROS 1

#include "SDL.h"
#include <Engine/Engine.h>
Expand Down
1 change: 0 additions & 1 deletion Sources/Engine/Base/Types.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ typedef uint32_t UINT;
#error "Unknown CPU-Architecture, adapt this code to detect 32/64bitness of your system!"
#endif


// if the compiler complains about the typedef created by MY_STATIC_ASSERT being invalid
// (because of array with negative size), it means the check for cond has failed
#define MY_STATIC_ASSERT(namesuffx, cond) \
Expand Down
2 changes: 0 additions & 2 deletions Sources/Engine/Engine.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
// set this to 1 to enable checks whether somethig is deleted while iterating some array/container
#define CHECKARRAYLOCKING 0



#include <Engine/Base/SystemSpecificInclude.h>

#include <Engine/Base/Types.h>
Expand Down
1 change: 1 addition & 0 deletions Sources/Engine/Graphics/SDL/SDLAdapter.cpp
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* Copyright (c) 2002-2012 Croteam Ltd. All rights reserved. */
#define __STDC_LIMIT_MACROS 1

#include <stdio.h>

Expand Down
1 change: 1 addition & 0 deletions Sources/Engine/StdH.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#define ENGINE_INTERNAL 1
#define ENGINE_EXPORTS 1

#define __STDC_LIMIT_MACROS 1
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
Expand Down

0 comments on commit c1651f6

Please sign in to comment.