This commit is contained in:
yaw-man 2022-08-09 15:33:58 -03:00
parent dd7cac4e64
commit 8e1108d534
3 changed files with 26 additions and 18 deletions

View File

@ -35,26 +35,26 @@ protected:
case kParameterTabletX:
parameter.name = "x";
parameter.symbol = "x";
parameter.ranges.min = 0;
parameter.ranges.max = 1024;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 999.0f;
break;
case kParameterTabletY:
parameter.name = "y";
parameter.symbol = "y";
parameter.ranges.min = 0;
parameter.ranges.max = 1024;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 999.0f;
break;
case kParameterTabletZ:
parameter.name = "z";
parameter.symbol = "z";
parameter.ranges.min = 0;
parameter.ranges.max = 1024;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 999.0f;
break;
case kParameterTabletPressure:
parameter.name = "p";
parameter.symbol = "p";
parameter.ranges.min = 0;
parameter.ranges.max = 1024;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 999.0f;
break;
}
}

View File

@ -18,12 +18,11 @@ public:
return;
}
wintabAvailable = true;
NewContext(hwnd);
}
~Tablet() {
gpWTClose(hctx); //Chui pas certain s'il faut fermer le context.
if (hctx) { gpWTClose(hctx); }
UnloadWintab();
}
@ -52,8 +51,6 @@ private:
void NewContext(HWND hwnd) {
if (hctx) { gpWTClose(hctx); }
ctx.lcOptions |= CXO_SYSTEM;
gpWTInfoA(WTI_DEFCONTEXT, 0, &ctx);
ctx.lcOptions |= CXO_MESSAGES; //TODO: checker çela
ctx.lcPktData = PACKETDATA;
@ -65,24 +62,27 @@ private:
gpWTInfoA(WTI_DEVICES, DVC_Z, &TabletZ);
gpWTInfoA(WTI_DEVICES, DVC_NPRESSURE, &TabletPressure);
ctx.lcInOrgX = 0;
ctx.lcInOrgX = TabletX.axMin;
ctx.lcInExtX = TabletX.axMax;
ctx.lcOutOrgX = 0;
ctx.lcOutOrgX = TabletX.axMin;
ctx.lcOutExtX = TabletX.axMax;
ctx.lcInOrgY = 0;
ctx.lcInOrgY = TabletY.axMin;
ctx.lcInExtY = TabletY.axMax;
ctx.lcOutOrgY = 0;
ctx.lcOutOrgY = TabletY.axMin;
ctx.lcOutExtY = TabletY.axMax;
ctx.lcInOrgZ = 0;
ctx.lcInOrgZ = TabletZ.axMin;
ctx.lcInExtZ = TabletZ.axMax;
ctx.lcOutOrgZ = 0;
ctx.lcOutOrgZ = TabletZ.axMin;
ctx.lcOutExtZ = TabletZ.axMax;
hctx = gpWTOpenA(hwnd, &ctx, FALSE);
if (!hctx) { return; }
gpWTEnable(hctx, TRUE);
wintabAvailable = true;
}

View File

@ -62,8 +62,16 @@ protected:
fontSize(15.0f * fScale);
textLineHeight(lineHeight);
float x = 0.0f * fScale;
float y = 15.0f * fScale;
if (!tab.wintabAvailable) {
drawLeft(x, y, "Failed to connect to tablet.");
return;
}
drawLeft(x, y, "x:");
drawRight(x, y, getTextBufFloat(fParameters[kParameterTabletX]));
y += lineHeight;