summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon
diff options
context:
space:
mode:
authorShawn Hoffman <godisgovernment@gmail.com>2009-01-04 21:07:22 +0000
committerShawn Hoffman <godisgovernment@gmail.com>2009-01-04 21:07:22 +0000
commit34cad180e8a2124beb0a795998cda4d45ff8fe4f (patch)
tree00f454bdb2000bcbd95aa15fed10005baf08073a /Source/Core/InputCommon
parent96d6fc6e85f10fb5a5ac0a3f8d5c34c53669b4ec (diff)
add inputcommon and padsimpleEvnt to windows build. note: the plugin is disabled atm; it builds but isn't fit for general consumption. Also a bit of dolphin-style cleanup on inputcommon
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1768 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/InputCommon')
-rw-r--r--Source/Core/InputCommon/InputCommon.vcproj441
-rwxr-xr-xSource/Core/InputCommon/Src/Event.hpp448
-rw-r--r--Source/Core/InputCommon/Src/EventHandler.cpp66
-rw-r--r--Source/Core/InputCommon/Src/EventHandler.h8
-rw-r--r--Source/Core/InputCommon/Src/InputCommon.cpp21
-rw-r--r--Source/Core/InputCommon/Src/InputCommon.h7
6 files changed, 725 insertions, 266 deletions
diff --git a/Source/Core/InputCommon/InputCommon.vcproj b/Source/Core/InputCommon/InputCommon.vcproj
new file mode 100644
index 0000000000..7176f2bdd3
--- /dev/null
+++ b/Source/Core/InputCommon/InputCommon.vcproj
@@ -0,0 +1,441 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="InputCommon"
+ ProjectGUID="{C7E5D50A-2916-464B-86A7-E10B3CC88ADA}"
+ RootNamespace="VideoCommon"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="4"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../Core/Common/Src;../../PluginSpecs;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ BufferSecurityCheck="false"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ WarnAsError="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="4"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../Core/Common/Src;../../PluginSpecs;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_SECURE_SCL=0;_LIB;__WXMSW__;wxUSE_BASE=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ BufferSecurityCheck="false"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ WarnAsError="false"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="4"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="../../Core/Common/Src;../../PluginSpecs;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ BufferSecurityCheck="false"
+ EnableEnhancedInstructionSet="2"
+ FloatingPointModel="0"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ WarnAsError="false"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="4"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="false"
+ AdditionalIncludeDirectories="../../Core/Common/Src;../../PluginSpecs;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
+ RuntimeLibrary="0"
+ BufferSecurityCheck="false"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ WarnAsError="false"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="DebugFast|Win32"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="4"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../Core/Common/Src;../../PluginSpecs;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0"
+ RuntimeLibrary="0"
+ BufferSecurityCheck="false"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ WarnAsError="false"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="DebugFast|x64"
+ OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="4"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../Core/Common/Src;../../PluginSpecs;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_SECURE_SCL=0;__WXMSW__;wxUSE_BASE=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
+ RuntimeLibrary="0"
+ BufferSecurityCheck="false"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ WarnAsError="false"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\Src\Event.hpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Src\EventHandler.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Src\EventHandler.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Src\InputCommon.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Src\InputCommon.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Src\SConscript"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/Source/Core/InputCommon/Src/Event.hpp b/Source/Core/InputCommon/Src/Event.hpp
index 8da9399739..b7fd5c15aa 100755
--- a/Source/Core/InputCommon/Src/Event.hpp
+++ b/Source/Core/InputCommon/Src/Event.hpp
@@ -38,112 +38,112 @@ namespace sf
////////////////////////////////////////////////////////////
namespace Key
{
- enum Code
- {
- A = 'a',
- B = 'b',
- C = 'c',
- D = 'd',
- E = 'e',
- F = 'f',
- G = 'g',
- H = 'h',
- I = 'i',
- J = 'j',
- K = 'k',
- L = 'l',
- M = 'm',
- N = 'n',
- O = 'o',
- P = 'p',
- Q = 'q',
- R = 'r',
- S = 's',
- T = 't',
- U = 'u',
- V = 'v',
- W = 'w',
- X = 'x',
- Y = 'y',
- Z = 'z',
- Num0 = '0',
- Num1 = '1',
- Num2 = '2',
- Num3 = '3',
- Num4 = '4',
- Num5 = '5',
- Num6 = '6',
- Num7 = '7',
- Num8 = '8',
- Num9 = '9',
- Escape = 256,
- LControl,
- LShift,
- LAlt,
- LSystem, ///< OS specific key (left side) : windows (Win and Linux), apple (MacOS), ...
- RControl,
- RShift,
- RAlt,
- RSystem, ///< OS specific key (right side) : windows (Win and Linux), apple (MacOS), ...
- Menu,
- LBracket, ///< [
- RBracket, ///< ]
- SemiColon, ///< ;
- Comma, ///< ,
- Period, ///< .
- Quote, ///< '
- Slash, ///< /
- BackSlash,
- Tilde, ///< ~
- Equal, ///< =
- Dash, ///< -
- Space,
- Return,
- Back,
- Tab,
- PageUp,
- PageDown,
- End,
- Home,
- Insert,
- Delete,
- Add, ///< +
- Subtract, ///< -
- Multiply, ///< *
- Divide, ///< /
- Left, ///< Left arrow
- Right, ///< Right arrow
- Up, ///< Up arrow
- Down, ///< Down arrow
- Numpad0,
- Numpad1,
- Numpad2,
- Numpad3,
- Numpad4,
- Numpad5,
- Numpad6,
- Numpad7,
- Numpad8,
- Numpad9,
- F1,
- F2,
- F3,
- F4,
- F5,
- F6,
- F7,
- F8,
- F9,
- F10,
- F11,
- F12,
- F13,
- F14,
- F15,
- Pause,
+ enum Code
+ {
+ A = 'a',
+ B = 'b',
+ C = 'c',
+ D = 'd',
+ E = 'e',
+ F = 'f',
+ G = 'g',
+ H = 'h',
+ I = 'i',
+ J = 'j',
+ K = 'k',
+ L = 'l',
+ M = 'm',
+ N = 'n',
+ O = 'o',
+ P = 'p',
+ Q = 'q',
+ R = 'r',
+ S = 's',
+ T = 't',
+ U = 'u',
+ V = 'v',
+ W = 'w',
+ X = 'x',
+ Y = 'y',
+ Z = 'z',
+ Num0 = '0',
+ Num1 = '1',
+ Num2 = '2',
+ Num3 = '3',
+ Num4 = '4',
+ Num5 = '5',
+ Num6 = '6',
+ Num7 = '7',
+ Num8 = '8',
+ Num9 = '9',
+ Escape = 256,
+ LControl,
+ LShift,
+ LAlt,
+ LSystem, ///< OS specific key (left side) : windows (Win and Linux), apple (MacOS), ...
+ RControl,
+ RShift,
+ RAlt,
+ RSystem, ///< OS specific key (right side) : windows (Win and Linux), apple (MacOS), ...
+ Menu,
+ LBracket, ///< [
+ RBracket, ///< ]
+ SemiColon, ///< ;
+ Comma, ///< ,
+ Period, ///< .
+ Quote, ///< '
+ Slash, ///< /
+ BackSlash,
+ Tilde, ///< ~
+ Equal, ///< =
+ Dash, ///< -
+ Space,
+ Return,
+ Back,
+ Tab,
+ PageUp,
+ PageDown,
+ End,
+ Home,
+ Insert,
+ Delete,
+ Add, ///< +
+ Subtract, ///< -
+ Multiply, ///< *
+ Divide, ///< /
+ Left, ///< Left arrow
+ Right, ///< Right arrow
+ Up, ///< Up arrow
+ Down, ///< Down arrow
+ Numpad0,
+ Numpad1,
+ Numpad2,
+ Numpad3,
+ Numpad4,
+ Numpad5,
+ Numpad6,
+ Numpad7,
+ Numpad8,
+ Numpad9,
+ F1,
+ F2,
+ F3,
+ F4,
+ F5,
+ F6,
+ F7,
+ F8,
+ F9,
+ F10,
+ F11,
+ F12,
+ F13,
+ F14,
+ F15,
+ Pause,
- Count // For internal use
- };
+ Count // For internal use
+ };
}
@@ -152,16 +152,16 @@ namespace Key
////////////////////////////////////////////////////////////
namespace Mouse
{
- enum Button
- {
- Left,
- Right,
- Middle,
- XButton1,
- XButton2,
+ enum Button
+ {
+ Left,
+ Right,
+ Middle,
+ XButton1,
+ XButton2,
- Count // For internal use
- };
+ Count // For internal use
+ };
}
@@ -170,18 +170,18 @@ namespace Mouse
////////////////////////////////////////////////////////////
namespace Joy
{
- enum Axis
- {
- AxisX,
- AxisY,
- AxisZ,
- AxisR,
- AxisU,
- AxisV,
- AxisPOV,
+ enum Axis
+ {
+ AxisX,
+ AxisY,
+ AxisZ,
+ AxisR,
+ AxisU,
+ AxisV,
+ AxisPOV,
- Count // For internal use
- };
+ Count // For internal use
+ };
}
@@ -192,115 +192,115 @@ class Event
{
public :
- ////////////////////////////////////////////////////////////
- /// Keyboard event parameters
- ////////////////////////////////////////////////////////////
- struct KeyEvent
- {
- Key::Code Code;
- bool Alt;
- bool Control;
- bool Shift;
- };
+ ////////////////////////////////////////////////////////////
+ /// Keyboard event parameters
+ ////////////////////////////////////////////////////////////
+ struct KeyEvent
+ {
+ Key::Code Code;
+ bool Alt;
+ bool Control;
+ bool Shift;
+ };
- ////////////////////////////////////////////////////////////
- /// Text event parameters
- ////////////////////////////////////////////////////////////
- struct TextEvent
- {
- unsigned short Unicode;
- };
+ ////////////////////////////////////////////////////////////
+ /// Text event parameters
+ ////////////////////////////////////////////////////////////
+ struct TextEvent
+ {
+ unsigned short Unicode;
+ };
- ////////////////////////////////////////////////////////////
- /// Mouse move event parameters
- ////////////////////////////////////////////////////////////
- struct MouseMoveEvent
- {
- unsigned int X;
- unsigned int Y;
- };
+ ////////////////////////////////////////////////////////////
+ /// Mouse move event parameters
+ ////////////////////////////////////////////////////////////
+ struct MouseMoveEvent
+ {
+ unsigned int X;
+ unsigned int Y;
+ };
- ////////////////////////////////////////////////////////////
- /// Mouse buttons events parameters
- ////////////////////////////////////////////////////////////
- struct MouseButtonEvent
- {
- Mouse::Button Button;
- };
+ ////////////////////////////////////////////////////////////
+ /// Mouse buttons events parameters
+ ////////////////////////////////////////////////////////////
+ struct MouseButtonEvent
+ {
+ Mouse::Button Button;
+ };
- ////////////////////////////////////////////////////////////
- /// Mouse wheel events parameters
- ////////////////////////////////////////////////////////////
- struct MouseWheelEvent
- {
- int Delta;
- };
+ ////////////////////////////////////////////////////////////
+ /// Mouse wheel events parameters
+ ////////////////////////////////////////////////////////////
+ struct MouseWheelEvent
+ {
+ int Delta;
+ };
- ////////////////////////////////////////////////////////////
- /// Joystick axis move event parameters
- ////////////////////////////////////////////////////////////
- struct JoyMoveEvent
- {
- unsigned int JoystickId;
- Joy::Axis Axis;
- float Position;
- };
+ ////////////////////////////////////////////////////////////
+ /// Joystick axis move event parameters
+ ////////////////////////////////////////////////////////////
+ struct JoyMoveEvent
+ {
+ unsigned int JoystickId;
+ Joy::Axis Axis;
+ float Position;
+ };
- ////////////////////////////////////////////////////////////
- /// Joystick buttons events parameters
- ////////////////////////////////////////////////////////////
- struct JoyButtonEvent
- {
- unsigned int JoystickId;
- unsigned int Button;
- };
+ ////////////////////////////////////////////////////////////
+ /// Joystick buttons events parameters
+ ////////////////////////////////////////////////////////////
+ struct JoyButtonEvent
+ {
+ unsigned int JoystickId;
+ unsigned int Button;
+ };
- ////////////////////////////////////////////////////////////
- /// Size events parameters
- ////////////////////////////////////////////////////////////
- struct SizeEvent
- {
- unsigned int Width;
- unsigned int Height;
- };
+ ////////////////////////////////////////////////////////////
+ /// Size events parameters
+ ////////////////////////////////////////////////////////////
+ struct SizeEvent
+ {
+ unsigned int Width;
+ unsigned int Height;
+ };
- ////////////////////////////////////////////////////////////
- /// Enumeration of the different types of events
- ////////////////////////////////////////////////////////////
- enum EventType
- {
- Closed,
- Resized,
- LostFocus,
- GainedFocus,
- TextEntered,
- KeyPressed,
- KeyReleased,
- MouseWheelMoved,
- MouseButtonPressed,
- MouseButtonReleased,
- MouseMoved,
- JoyButtonPressed,
- JoyButtonReleased,
- JoyMoved
- };
+ ////////////////////////////////////////////////////////////
+ /// Enumeration of the different types of events
+ ////////////////////////////////////////////////////////////
+ enum EventType
+ {
+ Closed,
+ Resized,
+ LostFocus,
+ GainedFocus,
+ TextEntered,
+ KeyPressed,
+ KeyReleased,
+ MouseWheelMoved,
+ MouseButtonPressed,
+ MouseButtonReleased,
+ MouseMoved,
+ JoyButtonPressed,
+ JoyButtonReleased,
+ JoyMoved
+ };
- ////////////////////////////////////////////////////////////
- // Member data
- ////////////////////////////////////////////////////////////
- EventType Type; ///< Type of the event
+ ////////////////////////////////////////////////////////////
+ // Member data
+ ////////////////////////////////////////////////////////////
+ EventType Type; ///< Type of the event
- union
- {
- KeyEvent Key;
- TextEvent Text;
- MouseMoveEvent MouseMove;
- MouseButtonEvent MouseButton;
- MouseWheelEvent MouseWheel;
- JoyMoveEvent JoyMove;
- JoyButtonEvent JoyButton;
- SizeEvent Size;
- };
+ union
+ {
+ KeyEvent Key;
+ TextEvent Text;
+ MouseMoveEvent MouseMove;
+ MouseButtonEvent MouseButton;
+ MouseWheelEvent MouseWheel;
+ JoyMoveEvent JoyMove;
+ JoyButtonEvent JoyButton;
+ SizeEvent Size;
+ };
};
} // namespace sf
diff --git a/Source/Core/InputCommon/Src/EventHandler.cpp b/Source/Core/InputCommon/Src/EventHandler.cpp
index a8770fc153..50bf3715f2 100644
--- a/Source/Core/InputCommon/Src/EventHandler.cpp
+++ b/Source/Core/InputCommon/Src/EventHandler.cpp
@@ -4,43 +4,54 @@
#include <wx/wx.h>
#endif
-bool EventHandler::RegisterEventListener(listenFuncPtr func, Keys key) {
- if (key.inputType == KeyboardInput) {
- if (keys[key.keyCode][key.mods])
- return false;
- keys[key.keyCode][key.mods] = func;
- } else if (key.inputType == MouseInput) {
- if (mouse[key.mouseButton])
- return false;
- mouse[key.mouseButton] = func;
+bool EventHandler::RegisterEventListener(listenFuncPtr func, Keys key)
+{
+ if (key.inputType == KeyboardInput)
+ {
+ if (keys[key.keyCode][key.mods])
+ return false;
+ keys[key.keyCode][key.mods] = func;
+ }
+ else if (key.inputType == MouseInput)
+ {
+ if (mouse[key.mouseButton])
+ return false;
+ mouse[key.mouseButton] = func;
}
-
+
return true;
}
-bool EventHandler::RemoveEventListener(Keys key) {
- if (key.inputType == KeyboardInput) {
- if (! keys[key.keyCode][key.mods])
- return false;
- keys[key.keyCode][key.mods] = NULL;
- } else if (key.inputType == MouseInput) {
- if (! mouse[key.mouseButton])
- return false;
- mouse[key.mouseButton] = NULL;
+bool EventHandler::RemoveEventListener(Keys key)
+{
+ if (key.inputType == KeyboardInput)
+ {
+ if (! keys[key.keyCode][key.mods])
+ return false;
+ keys[key.keyCode][key.mods] = NULL;
+ }
+ else if (key.inputType == MouseInput)
+ {
+ if (! mouse[key.mouseButton])
+ return false;
+ mouse[key.mouseButton] = NULL;
}
-
+
return true;
}
-void EventHandler::Update() {
- for (unsigned int i = 0; i < eventQueue.size();i++) {
- sf::Event ev = eventQueue.front();
- eventQueue.pop();
- keys[ev.Key.Code][ev.Key.Alt+2*ev.Key.Shift+4*ev.Key.Control](ev);
+void EventHandler::Update()
+{
+ for (unsigned int i = 0; i < eventQueue.size();i++)
+ {
+ sf::Event ev = eventQueue.front();
+ eventQueue.pop();
+ keys[ev.Key.Code][ev.Key.Alt+2*ev.Key.Shift+4*ev.Key.Control](ev);
}
}
-bool EventHandler::addEvent(sf::Event *ev) {
+bool EventHandler::addEvent(sf::Event *ev)
+{
eventQueue.push(*ev);
return true;
}
@@ -151,7 +162,8 @@ sf::Key::Code EventHandler::wxCharCodeToSF(int id)
}
#endif
-void EventHandler::SFKeyToString(sf::Key::Code keycode, char *keyStr) {
+void EventHandler::SFKeyToString(sf::Key::Code keycode, char *keyStr)
+{
switch (keycode) {
/* case sf::Key::A = 'a': sprintf(keyStr, "UP"); break;
case sf::Key::B = 'b': sprintf(keyStr, "UP"); break;
diff --git a/Source/Core/InputCommon/Src/EventHandler.h b/Source/Core/InputCommon/Src/EventHandler.h
index a1f2b2374d..b5a21788d5 100644
--- a/Source/Core/InputCommon/Src/EventHandler.h
+++ b/Source/Core/InputCommon/Src/EventHandler.h
@@ -12,7 +12,8 @@ enum InputType
JoystickInput
};
-enum Modifiers {
+enum Modifiers
+{
UseAlt = 1,
UseShift = 2,
UseCtrl = 4
@@ -27,13 +28,14 @@ struct Keys
sf::Mouse::Button mouseButton;
};
-class EventHandler {
-
+class EventHandler
+{
private:
listenFuncPtr keys[sf::Key::Count][8];
listenFuncPtr mouse[sf::Mouse::Count];
listenFuncPtr joys[sf::Joy::Count];
std::queue<sf::Event> eventQueue;
+
public:
bool RegisterEventListener(listenFuncPtr func, Keys key);
bool RemoveEventListener(Keys key);
diff --git a/Source/Core/InputCommon/Src/InputCommon.cpp b/Source/Core/InputCommon/Src/InputCommon.cpp
index f34ccbb588..9d1c1910d3 100644
--- a/Source/Core/InputCommon/Src/InputCommon.cpp
+++ b/Source/Core/InputCommon/Src/InputCommon.cpp
@@ -2,16 +2,19 @@
EventHandler *eventHandler = NULL;
-namespace InputCommon {
- void Init() {
+namespace InputCommon
+{
+ void Init()
+ {
#if defined GLTEST && GLTEST
- // init the event handler
- eventHandler = new EventHandler();
+ // init the event handler
+ eventHandler = new EventHandler();
#endif
- }
+ }
- void Shutdown() {
- if (eventHandler)
- delete eventHandler;
- }
+ void Shutdown()
+ {
+ if (eventHandler)
+ delete eventHandler;
+ }
}
diff --git a/Source/Core/InputCommon/Src/InputCommon.h b/Source/Core/InputCommon/Src/InputCommon.h
index 6128e8cf5d..1981c10386 100644
--- a/Source/Core/InputCommon/Src/InputCommon.h
+++ b/Source/Core/InputCommon/Src/InputCommon.h
@@ -2,7 +2,8 @@
extern EventHandler *eventHandler;
-namespace InputCommon {
- void Init();
- void Shutdown();
+namespace InputCommon
+{
+ void Init();
+ void Shutdown();
}