#pragma region CPL License /* Nuclex Native Framework Copyright (C) 2002-2013 Nuclex Development Labs This library is free software; you can redistribute it and/or modify it under the terms of the IBM Common Public License as published by the IBM Corporation; either version 1.0 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the IBM Common Public License for more details. You should have received a copy of the IBM Common Public License along with this library */ #pragma endregion // CPL License #ifndef NUCLEX_INPUT_WINDOWSINPUTMANAGER_H #define NUCLEX_INPUT_WINDOWSINPUTMANAGER_H #include "InputManager.h" #if !defined(NUCLEX_INPUT_WIN32) #error This header is intended for Win32 applications only #endif #define WIN32_LEAN_AND_MEAN #define VC_EXTRALEAN #include namespace Nuclex { namespace Input { // ------------------------------------------------------------------------------------------- // /// Handles input devices in a Microsoft Windows application /// /// The Windows input manager uses window messages and the DirectInput and XINPUT APIs /// to query the state of input devices and obtain state change notifications. /// class WindowsInputManager : public InputManager { /// Initializes a new windows input manager /// Handle of the game's main window /// /// Instance handle of the process that will be passed to DirectInput /// /// /// /// The specified window will be subclassed to allow the windows input manager to /// listen in on specific window messages such as WM_KEYDOWN, WM_MOUSEMOVE and so on, /// turning these over to the input devices. /// /// /// This window handle will also be passed to DirectInput (though DirectInput is only /// used for game pads - Microsoft discourages DirectInput for the keyboard and mouse, /// recommending WM_INPUT instead, which is what this library uses). /// /// public: NUCLEX_INPUT_API WindowsInputManager( HWND windowHandle, HINSTANCE instanceHandle = nullptr ); /// Destroys the windows input manager public: NUCLEX_INPUT_API virtual ~WindowsInputManager(); /// Counts the number of keyboards present /// The number of keyboards present on the system /// /// You are guaranteed at least 1 keyboard in all cases, including on mobile /// platforms, where you will be provided with a dummy. /// public: NUCLEX_INPUT_API std::size_t CountKeyboards() const; /// Accesses a keyboard /// Index of the keyboard that will be returned /// The keyboard with the specified index public: NUCLEX_INPUT_API const Devices::Keyboard &GetKeyboard(std::size_t index) const; /// Accesses a keyboard /// Index of the keyboard that will be returned /// The keyboard with the specified index public: NUCLEX_INPUT_API Devices::Keyboard &GetKeyboard(std::size_t index); /// Counts the number of mice present /// The number of mice present on the system /// /// You are guaranteed at least 1 mouse in all cases, including on mobile /// platforms, where you will be provided with a dummy. /// public: NUCLEX_INPUT_API std::size_t CountMice() const; /// Accesses a mouse /// Index of the mouse that will be returned /// The mouse with the specified index public: NUCLEX_INPUT_API const Devices::Mouse &GetMouse(std::size_t index) const; /// Accesses a mouse /// Index of the mouse that will be returned /// The mouse with the specified index public: NUCLEX_INPUT_API Devices::Mouse &GetMouse(std::size_t index); /// Counts the number of game pads present /// The number of game pads present on the system /// /// You are guaranteed at least 4 game pads in all cases, including on mobile /// platforms. If fewer than 4 game pads are connected, dummies will take /// the place of the missing devices. /// public: NUCLEX_INPUT_API std::size_t CountGamePads() const; /// Accesses a game pad /// Index of the game pad that will be returned /// The game pad with the specified index public: NUCLEX_INPUT_API const Devices::GamePad &GetGamePad(std::size_t index) const; /// Accesses a game pad /// Index of the game pad that will be returned /// The game pad with the specified index public: NUCLEX_INPUT_API Devices::GamePad &GetGamePad(std::size_t index); /// Counts the number of touch panels present /// The number of touch panels present on the system /// /// You are guaranteed at least 1 touch panel in all cases, including on /// gaming consoles, where you will be provided with a dummy. /// public: NUCLEX_INPUT_API std::size_t CountTouchPanels() const; /// Accesses a touch panel /// Index of the touch panel that will be returned /// The game pad with the specified index public: NUCLEX_INPUT_API const Devices::TouchPanel &GetTouchPanel(std::size_t index) const; /// Accesses a touch panel /// Index of the touch panel that will be returned /// The game pad with the specified index public: NUCLEX_INPUT_API Devices::TouchPanel &GetTouchPanel(std::size_t index); private: WindowsInputManager(const WindowsInputManager &); private: WindowsInputManager &operator =(const WindowsInputManager &); private: struct Impl; // hides private implementation details from the user /// Private implementation details of the input manager private: Impl *impl; }; // ------------------------------------------------------------------------------------------- // }} // namespace Nuclex::Input #endif // NUCLEX_INPUT_WINDOWSINPUTMANAGER_H