summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/Src/ControllerInterface/DirectInput/DirectInputMouse.h
diff options
context:
space:
mode:
authorJordan Woyak <jordan.woyak@gmail.com>2010-06-21 03:12:16 +0000
committerJordan Woyak <jordan.woyak@gmail.com>2010-06-21 03:12:16 +0000
commit9e3b65368873fd26f21e2568b2c67d00ec96d6a5 (patch)
treeb5eff0d77ae7e4327069116f6440dcc2a70a1a5f /Source/Core/InputCommon/Src/ControllerInterface/DirectInput/DirectInputMouse.h
parentfde15c1bc633792bead817b2f87faf54477765b5 (diff)
GCPad/New Wiimote Plugin: Individual keyboard and mouse devices are now listed on Windows(2 player with 2 keyboards possible). Improved the ability to map multiple inputs to the same control. Inputs from different devices can be mapped to the same button (example: Mouse Left and XInput A). More advanced mappings such as "Button 1 or 2 and NOT button 3" are possible. I hope the GUI after right clicking a button isn't too confusing(may change it to be a bit more user friendly). Hopefully, I didn't break OSX stuff by 'const'ing a few functions.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5757 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/InputCommon/Src/ControllerInterface/DirectInput/DirectInputMouse.h')
-rw-r--r--Source/Core/InputCommon/Src/ControllerInterface/DirectInput/DirectInputMouse.h83
1 files changed, 83 insertions, 0 deletions
diff --git a/Source/Core/InputCommon/Src/ControllerInterface/DirectInput/DirectInputMouse.h b/Source/Core/InputCommon/Src/ControllerInterface/DirectInput/DirectInputMouse.h
new file mode 100644
index 0000000000..c645d02727
--- /dev/null
+++ b/Source/Core/InputCommon/Src/ControllerInterface/DirectInput/DirectInputMouse.h
@@ -0,0 +1,83 @@
+#ifndef _CIFACE_DIRECTINPUT_MOUSE_H_
+#define _CIFACE_DIRECTINPUT_MOUSE_H_
+
+#include "../ControllerInterface.h"
+
+#define DIRECTINPUT_VERSION 0x0800
+#define WIN32_LEAN_AND_MEAN
+#define NOMINMAX
+#include <Windows.h>
+#include <dinput.h>
+
+namespace ciface
+{
+namespace DirectInput
+{
+
+void InitMouse(IDirectInput8* const idi8, std::vector<ControllerInterface::Device*>& devices);
+
+class Mouse : public ControllerInterface::Device
+{
+ friend class ControllerInterface;
+ friend class ControllerInterface::ControlReference;
+
+protected:
+
+ class Input : public ControllerInterface::Device::Input
+ {
+ friend class Mouse;
+ protected:
+ virtual ControlState GetState(const DIMOUSESTATE2* const boardstate) const = 0;
+ };
+
+ class Button : public Input
+ {
+ friend class Mouse;
+ public:
+ std::string GetName() const;
+ protected:
+ Button(const unsigned int index) : m_index(index) {}
+ ControlState GetState(const DIMOUSESTATE2* const state) const;
+ private:
+ const unsigned int m_index;
+ };
+
+ class Axis : public Input
+ {
+ friend class Mouse;
+ public:
+ std::string GetName() const;
+ protected:
+ Axis(const unsigned int index, const LONG range) : m_index(index), m_range(range) {}
+ ControlState GetState(const DIMOUSESTATE2* const state) const;
+ private:
+ const unsigned int m_index;
+ const LONG m_range;
+ };
+
+ bool UpdateInput();
+ bool UpdateOutput();
+
+ ControlState GetInputState( const ControllerInterface::Device::Input* const input ) const;
+ void SetOutputState( const ControllerInterface::Device::Output* const input, const ControlState state );
+
+public:
+ Mouse(const LPDIRECTINPUTDEVICE8 mo_device, const int index);
+ ~Mouse();
+
+ std::string GetName() const;
+ int GetId() const;
+ std::string GetSource() const;
+
+private:
+ const LPDIRECTINPUTDEVICE8 m_mo_device;
+ const int m_index;
+
+ DWORD m_last_update;
+ DIMOUSESTATE2 m_state_in;
+};
+
+}
+}
+
+#endif