WWKeyboardClass::Down now goes through the SDL system for mouse up and down, needs work for other keys.

This commit is contained in:
Justin Marshall
2020-06-25 17:24:06 -07:00
parent c7e4870048
commit 012a5c2d60
4 changed files with 14 additions and 6 deletions
+2 -3
View File
@@ -499,10 +499,9 @@ KeyNumType GadgetClass::Input(void)
** know the position of the mouse at the exact instant when the click occurred
** rather the the mouse position at the time we get around to this function.
*/
// jmarshall
// jmarshall
UserInput.Process_Input( g_globalKeyNumType, g_globalKeyFlags);
int flags = g_globalKeyFlags;
UserInput.Process_Input( g_globalKeyNumType, flags );
// jmarshall end
/*
+3 -2
View File
@@ -65,7 +65,7 @@ void UserInputClass::Process_Input(KeyNumType& key, int& flags)
Keyboard->Put_Element(KN_RMOUSE);
key = KN_RMOUSE;
key = KN_RMOUSE;
flags |= GadgetClass::RIGHTPRESS;
numFramesLMouse = 0;
@@ -75,13 +75,14 @@ void UserInputClass::Process_Input(KeyNumType& key, int& flags)
case SDL_MOUSEBUTTONUP:
if (event.button.button == SDL_BUTTON_LEFT) {
Mouse.Button_Left == MouseButtonState::MOUSE_BUTTON_RELEASE;
flags &= GadgetClass::LEFTPRESS;
flags |= GadgetClass::LEFTRELEASE;
numFramesLMouse = 0;
}
else if (event.button.button == SDL_BUTTON_RIGHT) {
Mouse.Button_Right == MouseButtonState::MOUSE_BUTTON_RELEASE;
flags &= GadgetClass::RIGHTPRESS;
flags |= GadgetClass::RIGHTRELEASE;
numFramesLMouse = 0;
}
+8
View File
@@ -364,6 +364,14 @@ char WWKeyboardClass::To_ASCII(unsigned short key)
*=============================================================================================*/
bool WWKeyboardClass::Down(unsigned short key)
{
if (key == KN_LMOUSE) {
return g_globalKeyFlags & GadgetClass::LEFTPRESS;
}
if (key == KN_RMOUSE) {
return g_globalKeyFlags & GadgetClass::RIGHTPRESS;
}
return(GetAsyncKeyState(key & 0xFF) == 0 ? false : true);
}
+1 -1
View File
@@ -535,7 +535,7 @@ void MapEditClass::AI(KeyNumType & input, int x, int y)
** Check for mouse motion while left button is down.
*/
rc = Mouse_Moved();
if (LMouseDown && rc) {
if (Keyboard->Down(KN_LMOUSE) && rc) {
/*
** "Paint" mode: place current object, and restart placement