add wacom support on Windows

This commit is contained in:
2017-05-17 00:33:02 +01:00
parent c987b19c83
commit 6d14ccd426
10 changed files with 1773 additions and 17 deletions

29
engine/wacom.h Normal file
View File

@@ -0,0 +1,29 @@
#pragma once
#include "WinTab/msgpack.h"
#include "WinTab/wintab.h"
#define PACKETDATA (PK_X | PK_Y | PK_BUTTONS | PK_NORMAL_PRESSURE)
#define PACKETMODE PK_BUTTONS
#include "WinTab/pktdef.h"
#include "WinTab/Utils.h"
class WacomTablet
{
HCTX g_hCtx = NULL;
AXIS TabletPressure = { 0 };
LOGCONTEXTA glogContext = { 0 };
glm::vec2 m_pen_pos{ 0 };
float m_pen_pres{ 1 };
bool m_pen_down = false;
int m_pen_idle = 0;
bool m_mouse_down = false;
HCTX TabletInit(HWND hWnd);
public:
static WacomTablet I;
bool init(HWND hWnd);
void terminate();
void handle_message(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam);
void set_focus(int activate);
float get_pressure() const;
};