Scale by mouse scroll

This commit is contained in:
Alexander Biryukov 2018-06-04 13:10:07 +05:00
parent 747bfaba7c
commit c5c53f1e2b
4 changed files with 21 additions and 4 deletions

1
.gitignore vendored
View File

@ -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

14
game/main_code.cpp Normal file → Executable file
View File

@ -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("");

3
game/main_code.h Normal file → Executable file
View File

@ -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);

View File

@ -22,6 +22,7 @@
<ProjectGuid>{1CC98EEE-BBCB-4D79-B6D7-8511789172C5}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>DoubleHitBallswin</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
@ -48,7 +49,7 @@
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>NotSet</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
@ -150,7 +151,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;TARGET_WIN32;_WIN32_WINNT=0x0501;WIN32_LEAN_AND_MEAN;EIGEN_DONT_ALIGN_STATICALLY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../../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</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>../../../game;../../../../tes-engine;../../../../eigen;../../../../boost_1_67_0/;../../../../libs/boost-gil-extension;../../../../libs/jpeg-9;../../../../libs/jpeg-9/vc10;../../../../libs/lpng1510</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4503</DisableSpecificWarnings>
</ClCompile>
<Link>
@ -158,7 +159,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalLibraryDirectories>../../../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</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>../../../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</AdditionalLibraryDirectories>
<AdditionalDependencies>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)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>