From 741958d30b8a59a2995a711cbde93aefd3fb627d Mon Sep 17 00:00:00 2001 From: PfandBoss <68470553+PfandBoss@users.noreply.github.com> Date: Thu, 2 Nov 2023 14:53:04 +0100 Subject: [PATCH] Mouse Input test stuff --- Simulations/main.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/Simulations/main.cpp b/Simulations/main.cpp index dc2d07a..4c24a24 100644 --- a/Simulations/main.cpp +++ b/Simulations/main.cpp @@ -53,9 +53,14 @@ bool firstTime = true; FFmpeg* g_pFFmpegVideoRecorder = nullptr; +// Input Stuff +float lastX; +float lastY; + + void initTweakBar(){ 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()); 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. @@ -202,10 +207,23 @@ void CALLBACK OnMouse( bool bLeftButtonDown, bool bRightButtonDown, bool bMiddle if (bLeftButtonDown) { g_pSimulator->onClick(xPos,yPos); + + int x = xPos; + int y = yPos; } else { 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);*/ + } }