Input: Expose mouse X1 and X2 buttons
This commit is contained in:
		
							parent
							
								
									5d38b1f813
								
							
						
					
					
						commit
						e156421b3b
					
				
					 4 changed files with 14 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -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);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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  
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -34,7 +34,7 @@
 | 
			
		|||
#include <string.h>
 | 
			
		||||
#include <assert.h>
 | 
			
		||||
 | 
			
		||||
#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)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue