#pragma once #include "CmPrerequisites.h" #include #include "CmInt2.h" namespace CamelotFramework { /** * @brief Represents a specific way of acquiring OS input. InputManager (which provides a higher level input) * must have at least one OSInputHandler attached. Attach events handler to the provided signals to handle input. * * @note Unlike RawInputHandler this class receives input from the operating system, and is used for receiving * text input, cursor position and similar. */ class CM_EXPORT OSInputHandler { public: OSInputHandler(); virtual ~OSInputHandler(); boost::signal onCharInput; boost::signal onMouseMoved; /** * @brief Called every frame by InputManager. Capture input here if needed. */ virtual void update(); /** * @brief Called by InputManager whenever window in focus changes. */ virtual void inputWindowChanged(const RenderWindow& win) {} private: CM_MUTEX(mOSInputMutex); Int2 mLastMousePos; Int2 mMousePosition; float mMouseScroll; WString mInputString; boost::signals::connection mCharInputConn; boost::signals::connection mMouseMovedConn; boost::signals::connection mMouseWheelScrolledConn; /** * @brief Called from the message loop. */ void charInput(UINT32 character); /** * @brief Called from the message loop. */ void mouseMoved(const Int2& mousePos); /** * @brief Called from the message loop. */ void mouseWheelScrolled(float scrollPos); }; }