mirror of
https://github.com/jmarshall23/CnC_Remastered_Collection.git
synced 2026-08-17 08:50:29 +02:00
Fixed error in mouse key processing, mouse right click works, mouseQX/QY updated.
This commit is contained in:
+13
-4
@@ -86,7 +86,6 @@ RemapControlType * GadgetClass::ColorScheme = &_GreyScheme;
|
||||
|
||||
int mousex, mousey;
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* GadgetClass::GadgetClass -- Constructor for gadget object. *
|
||||
* *
|
||||
@@ -535,11 +534,14 @@ KeyNumType GadgetClass::Input(void)
|
||||
** rather the the mouse position at the time we get around to this function.
|
||||
*/
|
||||
// jmarshall
|
||||
static int flags = 0;
|
||||
int flags = 0;
|
||||
SDL_GetMouseState(&mousex, &mousey);
|
||||
|
||||
if (flags == LEFTRELEASE || flags == RIGHTRELEASE)
|
||||
flags = 0;
|
||||
Keyboard->MouseQX = mousex;
|
||||
Keyboard->MouseQY = mousey;
|
||||
|
||||
// if (flags == LEFTRELEASE || flags == RIGHTRELEASE)
|
||||
// flags = 0;
|
||||
|
||||
SDL_Event event;
|
||||
while (SDL_PollEvent(&event)) {
|
||||
@@ -550,12 +552,19 @@ KeyNumType GadgetClass::Input(void)
|
||||
flags = LEFTPRESS;
|
||||
key = KN_LMOUSE;
|
||||
}
|
||||
else if (event.button.button == SDL_BUTTON_RIGHT) {
|
||||
flags = RIGHTPRESS;
|
||||
key = KN_LMOUSE;
|
||||
}
|
||||
break;
|
||||
|
||||
case SDL_MOUSEBUTTONUP:
|
||||
if (event.button.button == SDL_BUTTON_LEFT) {
|
||||
flags = LEFTRELEASE;
|
||||
}
|
||||
else if (event.button.button == SDL_BUTTON_RIGHT) {
|
||||
flags = RIGHTRELEASE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user