#pragma once #include "rbx/rbxTime.h" #include #include "v8datamodel/InputObject.h" using namespace Windows::Xbox::Input; class XboxGameController; class ControllerBuffer { public: typedef std::pair GamepadValue; typedef std::pair GamepadValueState; typedef std::vector GamepadValueStateHistoryVector; typedef boost::unordered_map GamepadValueBufferMap; private: GamepadValueBufferMap bufferedInput; boost::mutex changeInputBufferMutex; XboxGameController* xboxGameController; void bufferGamepadButtons(const int controllerIndex, IGamepadReading^& gamepadReading); void bufferGamepadAxis(const int controllerIndex, IGamepadReading^& gamepadReading); void processButton(RBX::InputObject::UserInputType userInputType, const RBX::KeyCode buttonCode, const int buttonState); void processAxis(RBX::InputObject::UserInputType userInputType, const RBX::KeyCode axisCode, const RBX::Vector3 axisValue); public: ControllerBuffer(); void setXboxGameController(XboxGameController* newController) {xboxGameController = newController;} void updateBuffer(); float getPollingMsec(); GamepadValueBufferMap getBufferedInput(); };