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; int mousex, mousey;
/*********************************************************************************************** /***********************************************************************************************
* GadgetClass::GadgetClass -- Constructor for gadget object. * * 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. ** rather the the mouse position at the time we get around to this function.
*/ */
// jmarshall // jmarshall
static int flags = 0; int flags = 0;
SDL_GetMouseState(&mousex, &mousey); SDL_GetMouseState(&mousex, &mousey);
if (flags == LEFTRELEASE || flags == RIGHTRELEASE) Keyboard->MouseQX = mousex;
flags = 0; Keyboard->MouseQY = mousey;
// if (flags == LEFTRELEASE || flags == RIGHTRELEASE)
// flags = 0;
SDL_Event event; SDL_Event event;
while (SDL_PollEvent(&event)) { while (SDL_PollEvent(&event)) {
@@ -550,12 +552,19 @@ KeyNumType GadgetClass::Input(void)
flags = LEFTPRESS; flags = LEFTPRESS;
key = KN_LMOUSE; key = KN_LMOUSE;
} }
else if (event.button.button == SDL_BUTTON_RIGHT) {
flags = RIGHTPRESS;
key = KN_LMOUSE;
}
break; break;
case SDL_MOUSEBUTTONUP: case SDL_MOUSEBUTTONUP:
if (event.button.button == SDL_BUTTON_LEFT) { if (event.button.button == SDL_BUTTON_LEFT) {
flags = LEFTRELEASE; flags = LEFTRELEASE;
} }
else if (event.button.button == SDL_BUTTON_RIGHT) {
flags = RIGHTRELEASE;
}
break; break;
} }
} }
+2 -2
View File
@@ -89,8 +89,8 @@ class WWKeyboardClass
/* Define the public access variables which are used with the */ /* Define the public access variables which are used with the */
/* Keyboard Class. */ /* Keyboard Class. */
/*===================================================================*/ /*===================================================================*/
int MouseQX; //int MouseQX;
int MouseQY; //int MouseQY;
unsigned char VKRemap[256]; // gives vk for any ascii char unsigned char VKRemap[256]; // gives vk for any ascii char
private: private: