From c5c53f1e2b55617ffecdcee4e146b9359177e96c Mon Sep 17 00:00:00 2001 From: Alexander Biryukov Date: Mon, 4 Jun 2018 13:10:07 +0500 Subject: [PATCH] Scale by mouse scroll --- .gitignore | 1 + game/main_code.cpp | 14 +++++++++++++- game/main_code.h | 3 +++ .../DoubleHitBalls-win/DoubleHitBalls-win.vcxproj | 7 ++++--- 4 files changed, 21 insertions(+), 4 deletions(-) mode change 100644 => 100755 game/main_code.cpp mode change 100644 => 100755 game/main_code.h diff --git a/.gitignore b/.gitignore index 9535ee2..57c4397 100644 --- a/.gitignore +++ b/.gitignore @@ -73,5 +73,6 @@ iOSInjectionProject/ /windows/DoubleHitBalls-win/DoubleHitBalls-win/log.txt /windows/DoubleHitBalls-win/DoubleHitBalls-win/progress.txt /windows/DoubleHitBalls-win/DoubleHitBalls-win/resources +/windows/DoubleHitBalls-win/**/*.user *.db *.opendb \ No newline at end of file diff --git a/game/main_code.cpp b/game/main_code.cpp old mode 100644 new mode 100755 index e9fc574..3b2e96b --- a/game/main_code.cpp +++ b/game/main_code.cpp @@ -86,7 +86,8 @@ void TMyApplication::InnerInit() #ifdef TARGET_WIN32 #ifdef NDEBUG - ST::PathToResources = "resources/"; + //ST::PathToResources = "resources/"; + ST::PathToResources = "../../../assets/"; #else ST::PathToResources = "../../../assets/"; #endif @@ -144,6 +145,14 @@ void TMyApplication::InnerDeinit() } } +void TMyApplication::OnMouseWheel(short int delta) +{ + scale += (delta > 0 ? 1 : -1) * 0.25; + if(scale < 0.25) { + scale = 0.25; + } +} + void TMyApplication::InnerOnTapDown(Vector2f p) { @@ -174,6 +183,8 @@ void TMyApplication::InnerDraw() //Render the frame Renderer->SetProjectionMatrix(512.f, 512.f); + Renderer->PushMatrix(); + Renderer->ScaleMatrix(scale); glClearColor(1.0f, 1.0f, 1.0f, 1.0f); glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); @@ -182,6 +193,7 @@ void TMyApplication::InnerDraw() TRenderParamsSetter params(lineRenderPair.first); Renderer->DrawTriangleList(lineRenderPair.second); + Renderer->PopMatrix(); CheckGlError(""); diff --git a/game/main_code.h b/game/main_code.h old mode 100644 new mode 100755 index 542643a..924f237 --- a/game/main_code.h +++ b/game/main_code.h @@ -32,6 +32,8 @@ protected: bool Inited; + float scale = 1.0; + public: TRenderPair lineRenderPair; @@ -51,6 +53,7 @@ public: bool IsInited(); + virtual void OnMouseWheel(short int delta); virtual void InnerOnTapDown(Vector2f p); diff --git a/windows/DoubleHitBalls-win/DoubleHitBalls-win/DoubleHitBalls-win.vcxproj b/windows/DoubleHitBalls-win/DoubleHitBalls-win/DoubleHitBalls-win.vcxproj index 4af150b..4cc9999 100755 --- a/windows/DoubleHitBalls-win/DoubleHitBalls-win/DoubleHitBalls-win.vcxproj +++ b/windows/DoubleHitBalls-win/DoubleHitBalls-win/DoubleHitBalls-win.vcxproj @@ -22,6 +22,7 @@ {1CC98EEE-BBCB-4D79-B6D7-8511789172C5} Win32Proj DoubleHitBallswin + 8.1 @@ -48,7 +49,7 @@ false true NotSet - v140 + v141 @@ -150,7 +151,7 @@ true true WIN32;NDEBUG;_WINDOWS;TARGET_WIN32;_WIN32_WINNT=0x0501;WIN32_LEAN_AND_MEAN;EIGEN_DONT_ALIGN_STATICALLY;%(PreprocessorDefinitions) - ../../../game;../../../../tes-engine;../../../../eigen;../../../../boost_1_63_0/;../../../../boost_1_63_0/bin.v2/libs/system/build/msvc-14.0/release/address-model-64/link-static/threading-multi;../../../../boost_1_63_0/bin.v2/libs/date_time/build/msvc-14.0/release/address-model-64/link-static/threading-multi/;../../../../boost_1_63_0/bin.v2/libs/regex/build/msvc-14.0/release/address-model-64/link-static/threading-multi;../../../../boost_1_63_0/bin.v2/libs/thread/build/msvc-14.0/release/address-model-64/link-static/threading-multi;../../../../boost_1_63_0/bin.v2/libs/chrono/build/msvc-14.0/release/address-model-64/link-static/threading-multi;../../../../boost_1_63_0/bin.v2/libs/signals/build/msvc-14.0/release/address-model-64/link-static/threading-multi;../../../../libs/boost-gil-extension;../../../../libs/jpeg-9;../../../../libs/jpeg-9/vc10;../../../../libs/lpng1510 + ../../../game;../../../../tes-engine;../../../../eigen;../../../../boost_1_67_0/;../../../../libs/boost-gil-extension;../../../../libs/jpeg-9;../../../../libs/jpeg-9/vc10;../../../../libs/lpng1510 4503 @@ -158,7 +159,7 @@ true true true - ../../../game;../../../../tes-engine;../../../../eigen;../../../../boost_1_63_0/stage/x64/lib;../../../../boost_1_63_0/bin.v2/libs/system/build/msvc-14.0/release/address-model-64/link-static/threading-multi;../../../../boost_1_63_0/bin.v2/libs/date_time/build/msvc-14.0/release/address-model-64/link-static/threading-multi/;../../../../boost_1_63_0/bin.v2/libs/regex/build/msvc-14.0/release/address-model-64/link-static/threading-multi;../../../../boost_1_63_0/bin.v2/libs/thread/build/msvc-14.0/release/address-model-64/link-static/threading-multi;../../../../boost_1_63_0/bin.v2/libs/chrono/build/msvc-14.0/release/address-model-64/link-static/threading-multi;../../../../boost_1_63_0/bin.v2/libs/signals/build/msvc-14.0/release/address-model-64/link-static/threading-multi;../../../../libs/boost-gil-extension;../../../../libs/jpeg-9;../../../../libs/jpeg-9/vc10;../../../../libs/lpng1510;../x64/Release + ../../../game;../../../../tes-engine;../../../../eigen;../../../../boost_1_67_0/stage/lib;../../../../libs/boost-gil-extension;../../../../libs/jpeg-9;../../../../libs/jpeg-9/vc10;../../../../libs/lpng1510;../x64/Release libjpeg.lib;libpng.lib;Engine.lib;opengl32.lib;glu32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)