I follow the tutorial here: Mouse and keyboard input
I don't get any error if i delete everything that has to do with DirectX. If i use pointer insted then i get a error that says my inputhandler constructor was deleted. Any ideas?
h
#pragma once
#include <Windows.h>
#include "DirectXTK-master\Inc\Keyboard.h"
#include "DirectXTK-master\Inc\Mouse.h"
class InputHandler
{
public:
InputHandler();
InputHandler(HWND wndHandle);
~InputHandler();
void updateInput();
private:
std::unique_ptr<DirectX::Keyboard> keyboard;
std::unique_ptr<DirectX::Mouse> mouse;
};
cpp
#include "InputHandler.h"
InputHandler::InputHandler()
{
}
InputHandler::InputHandler(HWND wndHandle)
{
keyboard = std::make_unique<DirectX::Keyboard>();
mouse = std::make_unique<DirectX::Mouse>();
mouse->SetWindow(wndHandle);
}
InputHandler::~InputHandler()
{
}
void InputHandler::updateInput()
{
auto kb = keyboard->GetState();
if (kb.Escape)
PostQuitMessage(0);
auto mouseState = mouse->GetState();
}
You still need to link to the DirectX Tool Kit static library. The tutorials assume you are making use of the NuGet package or have added a Reference to the DirectXTK project per the Adding the DirectX Tool Kit tutorial step which would add the static library to your project build.