diff --git a/binding-mri/input-binding.cpp b/binding-mri/input-binding.cpp index 41f3ce1..18e161a 100644 --- a/binding-mri/input-binding.cpp +++ b/binding-mri/input-binding.cpp @@ -156,7 +156,9 @@ static buttonCodes[] = { "MOUSELEFT", Input::MouseLeft }, { "MOUSEMIDDLE", Input::MouseMiddle }, - { "MOUSERIGHT", Input::MouseRight } + { "MOUSERIGHT", Input::MouseRight }, + { "MOUSEX1", Input::MouseX1 }, + { "MOUSEX2", Input::MouseX2 } }; static elementsN(buttonCodes); diff --git a/doc/extension_doc.md b/doc/extension_doc.md index 1e14f44..98085a8 100644 --- a/doc/extension_doc.md +++ b/doc/extension_doc.md @@ -19,6 +19,10 @@ returns: Integer Returns the cumulative amount of scroll events (negative if down, positive if up) inbetween the current and last `Input.update` call. +## Input::MOUSEX1 / ::MOUSEX2 + +These two constants representing two extra mouse buttons can be passed to the familiar #press?/#trigger?/#repeat? functions. + ## MKXP.data_directory() returns: String diff --git a/src/input.cpp b/src/input.cpp index f025b5c..1dcbe55 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -34,7 +34,7 @@ #include #include -#define BUTTON_CODE_COUNT 24 +#define BUTTON_CODE_COUNT 26 struct ButtonState { @@ -237,7 +237,7 @@ static const int mapToIndex[] = 0, 16, 17, 18, 19, 20, 0, 0, 0, 0, 0, 0, 0, 0, - 21, 22, 23 + 21, 22, 23, 24, 25 }; static elementsN(mapToIndex); @@ -465,12 +465,14 @@ struct InputPrivate void initMsBindings() { - msBindings.resize(3); + msBindings.resize(5); size_t i = 0; msBindings[i++] = MsBinding(SDL_BUTTON_LEFT, Input::MouseLeft); msBindings[i++] = MsBinding(SDL_BUTTON_MIDDLE, Input::MouseMiddle); msBindings[i++] = MsBinding(SDL_BUTTON_RIGHT, Input::MouseRight); + msBindings[i++] = MsBinding(SDL_BUTTON_X1, Input::MouseX1); + msBindings[i++] = MsBinding(SDL_BUTTON_X2, Input::MouseX2); } void pollBindings(Input::ButtonCode &repeatCand) diff --git a/src/input.h b/src/input.h index 1433855..a181919 100644 --- a/src/input.h +++ b/src/input.h @@ -43,7 +43,8 @@ public: F5 = 25, F6 = 26, F7 = 27, F8 = 28, F9 = 29, /* Non-standard extensions */ - MouseLeft = 38, MouseMiddle = 39, MouseRight = 40 + MouseLeft = 38, MouseMiddle = 39, MouseRight = 40, + MouseX1 = 41, MouseX2 = 42 }; void update();