Fixed error in mouse key processing, mouse right click works, mouseQX/QY updated.

This commit is contained in:
Justin Marshall
2020-06-04 11:27:01 -07:00
parent 9e78a9f986
commit 5f0ca2d192
2 changed files with 15 additions and 6 deletions
+13 -4
View File
@@ -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;
}
}
+2 -2
View File
@@ -89,8 +89,8 @@ class WWKeyboardClass
/* Define the public access variables which are used with the */
/* Keyboard Class. */
/*===================================================================*/
int MouseQX;
int MouseQY;
//int MouseQX;
//int MouseQY;
unsigned char VKRemap[256]; // gives vk for any ascii char
private: