BsGamepad.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include "BsCorePrerequisites.h"
  5. namespace bs
  6. {
  7. struct GamepadInfo;
  8. /** Represents a single hardware gamepad. Used by the Input to report gamepad input events. */
  9. class BS_CORE_EXPORT Gamepad
  10. {
  11. public:
  12. struct Pimpl;
  13. Gamepad(const String& name, const GamepadInfo& gamepadInfo, Input* owner);
  14. ~Gamepad();
  15. /** Returns the name of the device. */
  16. String getName() const { return mName; }
  17. /** Captures the input since the last call and triggers the events on the parent Input. */
  18. void capture();
  19. /** Minimum allowed value as reported by the axis movement events. */
  20. static constexpr int MIN_AXIS = -32768;
  21. /** Maximum allowed value as reported by the axis movement events. */
  22. static constexpr int MAX_AXIS = 32767;
  23. private:
  24. friend class Input;
  25. /** Changes the capture context. Should be called when focus is moved to a new window. */
  26. void changeCaptureContext(UINT64 windowHandle);
  27. String mName;
  28. Input* mOwner;
  29. Pimpl* m;
  30. };
  31. }