diff --git a/Flappy.sln b/Flappy.sln index 8c10d58..ad53b71 100644 --- a/Flappy.sln +++ b/Flappy.sln @@ -7,16 +7,22 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Flappy", "Flappy\Flappy.vcx EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 + Release|Win32 = Release|Win32 Release|x64 = Release|x64 Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9035B83C-F117-480E-9DEB-435AA0EBEA3F}.Debug|Win32.ActiveCfg = Debug|Win32 + {9035B83C-F117-480E-9DEB-435AA0EBEA3F}.Debug|Win32.Build.0 = Debug|Win32 {9035B83C-F117-480E-9DEB-435AA0EBEA3F}.Debug|x64.ActiveCfg = Debug|x64 {9035B83C-F117-480E-9DEB-435AA0EBEA3F}.Debug|x64.Build.0 = Debug|x64 {9035B83C-F117-480E-9DEB-435AA0EBEA3F}.Debug|x86.ActiveCfg = Debug|Win32 {9035B83C-F117-480E-9DEB-435AA0EBEA3F}.Debug|x86.Build.0 = Debug|Win32 + {9035B83C-F117-480E-9DEB-435AA0EBEA3F}.Release|Win32.ActiveCfg = Release|Win32 + {9035B83C-F117-480E-9DEB-435AA0EBEA3F}.Release|Win32.Build.0 = Release|Win32 {9035B83C-F117-480E-9DEB-435AA0EBEA3F}.Release|x64.ActiveCfg = Release|x64 {9035B83C-F117-480E-9DEB-435AA0EBEA3F}.Release|x64.Build.0 = Release|x64 {9035B83C-F117-480E-9DEB-435AA0EBEA3F}.Release|x86.ActiveCfg = Release|Win32 diff --git a/Flappy/Flappy.vcxproj b/Flappy/Flappy.vcxproj index e95a82e..59861ec 100644 --- a/Flappy/Flappy.vcxproj +++ b/Flappy/Flappy.vcxproj @@ -79,6 +79,8 @@ false + Z:\Cpp_Libs\SFML-Visual_Studio2015RCx32\include;$(IncludePath) + Z:\Cpp_Libs\SFML-Visual_Studio2015RCx32\lib;$(LibraryPath) false @@ -125,12 +127,14 @@ true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true + Z:\Cpp_Libs\SFML-Visual_Studio2015RCx32\include;%(AdditionalIncludeDirectories) Console true true true + sfml-graphics.lib;sfml-audio.lib;sfml-network.lib;sfml-system.lib;sfml-window.lib;%(AdditionalDependencies) diff --git a/Flappy/main.cpp b/Flappy/main.cpp index c2f8bcf..9e7e753 100644 --- a/Flappy/main.cpp +++ b/Flappy/main.cpp @@ -55,6 +55,7 @@ int main() float step_size = 0.005f; double frame_time = 0.0, instant_fps = 0.0, render_fps = 0.0, physics_fps = 0.0, elapsed_time = 0.0, delta_time = 0.0, accumulator_time = 0.0, current_time = 0.0; int render_frame_count = 0, physics_frame_count = 0; + float speed = 250; while (window.isOpen()) { @@ -63,6 +64,11 @@ int main() if (event.type == sf::Event::Closed) { window.close(); } + if (event.type == sf::Event::MouseWheelScrolled) { + if (event.mouseWheelScroll.wheel == sf::Mouse::VerticalWheel) { + speed += event.mouseWheelScroll.delta * 20; + } + } } elapsed_time = elap_time(); @@ -83,22 +89,22 @@ int main() pipe_up_sprite.setPosition(WINDOW_X, pipe_down_sprite.getPosition().y + pipe_dist); } else { - pipe_up_sprite.setPosition(pipe_up_sprite.getPosition().x - step_size * 250, pipe_up_sprite.getPosition().y); - pipe_down_sprite.setPosition(pipe_down_sprite.getPosition().x - step_size * 250, pipe_down_sprite.getPosition().y); + pipe_up_sprite.setPosition(pipe_up_sprite.getPosition().x - step_size * speed, pipe_up_sprite.getPosition().y); + pipe_down_sprite.setPosition(pipe_down_sprite.getPosition().x - step_size * speed, pipe_down_sprite.getPosition().y); } if (background_sprite.getPosition().x + background_sprite.getGlobalBounds().width < WINDOW_X) { background_sprite.setPosition(0, 0); } else { - background_sprite.setPosition(background_sprite.getPosition().x - step_size * 150, background_sprite.getPosition().y); + background_sprite.setPosition(background_sprite.getPosition().x - step_size * (speed - 100), background_sprite.getPosition().y); } if (land_sprite.getPosition().x + 10 + land_sprite.getGlobalBounds().width < WINDOW_X) { land_sprite.setPosition(14, land_sprite.getPosition().y); } else { - land_sprite.setPosition(land_sprite.getPosition().x - step_size * 250, land_sprite.getPosition().y); + land_sprite.setPosition(land_sprite.getPosition().x - step_size * speed, land_sprite.getPosition().y); } // Check collisions