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: case kParameterTabletX:
parameter.name = "x"; parameter.name = "x";
parameter.symbol = "x"; parameter.symbol = "x";
parameter.ranges.min = 0; parameter.ranges.min = 0.0f;
parameter.ranges.max = 1024; parameter.ranges.max = 999.0f;
break; break;
case kParameterTabletY: case kParameterTabletY:
parameter.name = "y"; parameter.name = "y";
parameter.symbol = "y"; parameter.symbol = "y";
parameter.ranges.min = 0; parameter.ranges.min = 0.0f;
parameter.ranges.max = 1024; parameter.ranges.max = 999.0f;
break; break;
case kParameterTabletZ: case kParameterTabletZ:
parameter.name = "z"; parameter.name = "z";
parameter.symbol = "z"; parameter.symbol = "z";
parameter.ranges.min = 0; parameter.ranges.min = 0.0f;
parameter.ranges.max = 1024; parameter.ranges.max = 999.0f;
break; break;
case kParameterTabletPressure: case kParameterTabletPressure:
parameter.name = "p"; parameter.name = "p";
parameter.symbol = "p"; parameter.symbol = "p";
parameter.ranges.min = 0; parameter.ranges.min = 0.0f;
parameter.ranges.max = 1024; parameter.ranges.max = 999.0f;
break; break;
} }
} }

View File

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

View File

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