Mouse Input test stuff

This commit is contained in:
PfandBoss
2023-11-02 14:53:04 +01:00
parent 047b913dfa
commit 741958d30b

View File

@@ -53,9 +53,14 @@ bool firstTime = true;
FFmpeg* g_pFFmpegVideoRecorder = nullptr; FFmpeg* g_pFFmpegVideoRecorder = nullptr;
// Input Stuff
float lastX;
float lastY;
void initTweakBar(){ void initTweakBar(){
g_pDUC->g_pTweakBar = TwNewBar("TweakBar"); g_pDUC->g_pTweakBar = TwNewBar("TweakBar");
TwDefine(" TweakBar color='0 128 128' alpha=128 "); TwDefine(" TweakBar color='128 128 128' alpha=128 ");
TwType TW_TYPE_TESTCASE = TwDefineEnumFromString("Test Scene", g_pSimulator->getTestCasesStr()); TwType TW_TYPE_TESTCASE = TwDefineEnumFromString("Test Scene", g_pSimulator->getTestCasesStr());
TwAddVarRW(g_pDUC->g_pTweakBar, "Test Scene", TW_TYPE_TESTCASE, &g_iTestCase, ""); TwAddVarRW(g_pDUC->g_pTweakBar, "Test Scene", TW_TYPE_TESTCASE, &g_iTestCase, "");
// HINT: For buttons you can directly pass the callback function as a lambda expression. // HINT: For buttons you can directly pass the callback function as a lambda expression.
@@ -202,10 +207,23 @@ void CALLBACK OnMouse( bool bLeftButtonDown, bool bRightButtonDown, bool bMiddle
if (bLeftButtonDown) if (bLeftButtonDown)
{ {
g_pSimulator->onClick(xPos,yPos); g_pSimulator->onClick(xPos,yPos);
int x = xPos;
int y = yPos;
} }
else else
{ {
g_pSimulator->onMouse(xPos, yPos); g_pSimulator->onMouse(xPos, yPos);
float deltaX = lastX - xPos;
float deltaY = lastY - yPos;
lastX = xPos;
lastY = yPos;
/*printf("X Delta: %f \n", deltaX);
printf("Y Delta: %f \n", deltaY);*/
} }
} }