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

View File

@@ -369,7 +369,8 @@ HGLRC hRC;
wchar_t* className;
bool keys[256];
#include <WbemCli.h>
#include <WbemCli.h>
#include "wacom.h"
int read_WMI_info()
{
@@ -585,6 +586,7 @@ int main()
App::I.init();
ShowWindow(hWnd, SW_NORMAL);
WacomTablet::I.init(hWnd);
MSG msg;
bool running = true;
@@ -618,6 +620,7 @@ int main()
}
// Clean up
WacomTablet::I.terminate();
DestroyWindow(hWnd);
UnregisterClass(className, hInst);
}
@@ -635,6 +638,15 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
App::I.update(0.f);
SwapBuffers(hDC);
break;
case WM_ACTIVATE:
{
int active = GET_WM_ACTIVATE_STATE(wp, lp);
WacomTablet::I.set_focus(active);
break;
}
case WT_PACKET:
WacomTablet::I.handle_message(hWnd, msg, wp, lp);
break;
case WM_KEYDOWN:
keys[wp] = true;
App::I.key_down(convert_key((int)wp));
@@ -647,10 +659,10 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
App::I.key_char((int)wp);
break;
case WM_MOUSEMOVE:
App::I.mouse_move((float)GET_X_LPARAM(lp), (float)GET_Y_LPARAM(lp));
App::I.mouse_move((float)GET_X_LPARAM(lp), (float)GET_Y_LPARAM(lp), WacomTablet::I.get_pressure());
break;
case WM_LBUTTONDOWN:
App::I.mouse_down(0, (float)GET_X_LPARAM(lp), (float)GET_Y_LPARAM(lp));
App::I.mouse_down(0, (float)GET_X_LPARAM(lp), (float)GET_Y_LPARAM(lp), WacomTablet::I.get_pressure());
SetCapture(hWnd);
break;
case WM_LBUTTONUP:
@@ -658,7 +670,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
ReleaseCapture();
break;
case WM_RBUTTONDOWN:
App::I.mouse_down(1, (float)GET_X_LPARAM(lp), (float)GET_Y_LPARAM(lp));
App::I.mouse_down(1, (float)GET_X_LPARAM(lp), (float)GET_Y_LPARAM(lp), 1.f);
SetCapture(hWnd);
break;
case WM_RBUTTONUP: