Using DirectXTK Input for Keyboard, Mouse & Gamepad
For our game we have decided to make use of DirectXTK Toolkit that contains helper classes to work around with Direct3D 11with the help of DirectX SDK. We can utilize it for stuff like making audio using their Audio API, Sprite Batch & Font for rendering UI and text, finally game input through mouse, keyboard and gamepad class. This blog is going to be about using input singleton. You guys are ready, I'm about to blow your mind! Keyboard, Mouse & Gamepad // Resource Manager - Initializing at resource manager class std::unique_ptr<Keyboard>m_Keyboard; std::unique_ptr<Mouse>m_Mouse; std::unique_ptr<Gamepad>m_GamePad; // Call reset m_Keyboard.reset(new Keyboard()); m_Mouse.reset(new Mouse()); m_GamePad.reset(new GamePad()); ResourceManager* GetResource() { return m_refManager;} // Using it inside the player class - Object of the singleton Keyboard::State kb = GetResource()->m_Keyboard->GetState(); Mouse::State ms = GetResource()-...