get Ink pen data like pressure, buttons
This commit is contained in:
@@ -534,12 +534,12 @@ void App::init()
|
||||
LOG("GL vendor: %s", glGetString(GL_VENDOR));
|
||||
LOG("GL renderer: %s", glGetString(GL_RENDERER));
|
||||
|
||||
GLint n_exts;
|
||||
glGetIntegerv(GL_NUM_EXTENSIONS, &n_exts);
|
||||
for (int i = 0; i < n_exts; i++)
|
||||
{
|
||||
LOG("%s", glGetStringi(GL_EXTENSIONS, i));
|
||||
}
|
||||
// GLint n_exts;
|
||||
// glGetIntegerv(GL_NUM_EXTENSIONS, &n_exts);
|
||||
// for (int i = 0; i < n_exts; i++)
|
||||
// {
|
||||
// LOG("%s", glGetStringi(GL_EXTENSIONS, i));
|
||||
// }
|
||||
|
||||
LOG("Screen Resolution: %dx%d", (int)width, (int)height);
|
||||
|
||||
|
||||
@@ -221,6 +221,10 @@ void ui::Canvas::resize(int width, int height)
|
||||
m_tmp.create(width, height);
|
||||
m_tex.create(width, height);
|
||||
m_tex2.create(width, height);
|
||||
for (auto& l : m_layers)
|
||||
{
|
||||
l.m_rtt.create(width, height);
|
||||
}
|
||||
}
|
||||
bool ui::Canvas::create(int width, int height)
|
||||
{
|
||||
|
||||
@@ -1929,12 +1929,12 @@ public:
|
||||
|
||||
glm::vec2 sz = { m_canvas->m_width, m_canvas->m_height };
|
||||
m_canvas->m_mvp = glm::ortho(0.f, box.z, 0.f, box.w, -1.f, 1.f) *
|
||||
glm::translate(glm::vec3(m_pan + m_size * 0.5f, 0)) * // pan
|
||||
glm::translate(glm::vec3(m_pan + m_size * 0.5f * zoom, 0)) * // pan
|
||||
glm::scale(glm::vec3(zoom * m_zoom_canvas, zoom * m_zoom_canvas, 1)) *
|
||||
glm::translate(glm::vec3(-sz/2.f, 0));
|
||||
|
||||
auto plane_mvp = glm::ortho(0.f, box.z, 0.f, box.w, -1.f, 1.f) *
|
||||
glm::translate(glm::vec3(m_pan + m_size * 0.5f, 0)) * // pan
|
||||
glm::translate(glm::vec3(m_pan + m_size * 0.5f * zoom, 0)) * // pan
|
||||
glm::scale(glm::vec3(sz * zoom * m_zoom_canvas, 1));
|
||||
|
||||
m_sampler.bind(0);
|
||||
@@ -1971,11 +1971,11 @@ public:
|
||||
}
|
||||
virtual void handle_resize(glm::vec2 old_size, glm::vec2 new_size) override
|
||||
{
|
||||
// if (new_size.x > m_canvas->m_width)
|
||||
// {
|
||||
// m_canvas->resize((int)new_size.x, (int)new_size.y);
|
||||
// m_canvas->clear();
|
||||
// }
|
||||
if (new_size.x > m_canvas->m_width)
|
||||
{
|
||||
m_canvas->resize((int)new_size.x, (int)new_size.y);
|
||||
m_canvas->clear();
|
||||
}
|
||||
}
|
||||
virtual kEventResult handle_event(Event* e) override
|
||||
{
|
||||
|
||||
@@ -516,7 +516,7 @@ int main()
|
||||
wglDeleteContext(hRC);
|
||||
DestroyWindow(hWnd);
|
||||
|
||||
hWnd = CreateWindow(wc.lpszClassName, L"UI Layout Engine - OpenGL 3.1", WS_OVERLAPPEDWINDOW,
|
||||
hWnd = CreateWindow(wc.lpszClassName, L"PanoPainter 0.1.2 alpha - OpenGL 3.1", WS_OVERLAPPEDWINDOW,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT, clientRect.right - clientRect.left,
|
||||
clientRect.bottom - clientRect.top, 0, 0, hInst, 0);
|
||||
|
||||
@@ -617,8 +617,11 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
|
||||
break;
|
||||
case WM_POINTERUPDATE:
|
||||
{
|
||||
POINTER_TOUCH_INFO touchInfo;
|
||||
POINTER_PEN_INFO penInfo;
|
||||
POINTER_INFO pointerInfo;
|
||||
UINT32 pointerId = GET_POINTERID_WPARAM(wp);
|
||||
POINTER_INPUT_TYPE pointerType = PT_POINTER;
|
||||
|
||||
// Retrieve common pointer information
|
||||
if (!GetPointerInfo(pointerId, &pointerInfo))
|
||||
@@ -628,7 +631,53 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
|
||||
else
|
||||
{
|
||||
// success, process pointerInfo
|
||||
int i = 0;
|
||||
if (!GetPointerType(pointerId, &pointerType))
|
||||
{
|
||||
// failure, call GetLastError()
|
||||
// set PT_POINTER to fall to default case below
|
||||
pointerType = PT_POINTER;
|
||||
}
|
||||
switch (pointerType)
|
||||
{
|
||||
case PT_TOUCH:
|
||||
// Retrieve touch information
|
||||
if (!GetPointerTouchInfo(pointerId, &touchInfo))
|
||||
{
|
||||
// failure, call GetLastError()
|
||||
}
|
||||
else
|
||||
{
|
||||
// success, process touchInfo
|
||||
// mark as handled to skip call to DefWindowProc
|
||||
//fHandled = TRUE;
|
||||
}
|
||||
break;
|
||||
case PT_PEN:
|
||||
// Retrieve pen information
|
||||
if (!GetPointerPenInfo(pointerId, &penInfo))
|
||||
{
|
||||
// failure, call GetLastError()
|
||||
}
|
||||
else
|
||||
{
|
||||
// success, process penInfo
|
||||
// mark as handled to skip call to DefWindowProc
|
||||
//fHandled = TRUE;
|
||||
//penInfo.pressure
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (!GetPointerInfo(pointerId, &pointerInfo))
|
||||
{
|
||||
// failure.
|
||||
}
|
||||
else
|
||||
{
|
||||
// success, proceed with pointerInfo.
|
||||
//fHandled = HandleGenericPointerInfo(&pointerInfo);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user