From 99c5c7fb9e55d947de49c05a5a466c3ff129e082 Mon Sep 17 00:00:00 2001 From: zvon Date: Sat, 12 Sep 2020 13:09:20 +0200 Subject: [PATCH] Add windows specific changes --- sdlpp.cpp | 4 ++++ sdlpp.hpp | 6 ++++++ tetris/tetris.cpp | 12 ++++++++++++ 3 files changed, 22 insertions(+) diff --git a/sdlpp.cpp b/sdlpp.cpp index 9ddbe6b..a5fd500 100644 --- a/sdlpp.cpp +++ b/sdlpp.cpp @@ -1,6 +1,10 @@ #include "sdlpp.hpp" +#ifdef _WIN32 +#include "SDL2/SDL_image.h" +#else #include +#endif #include bool SDLPP::init() { diff --git a/sdlpp.hpp b/sdlpp.hpp index 1f8a723..79155ac 100644 --- a/sdlpp.hpp +++ b/sdlpp.hpp @@ -2,9 +2,15 @@ #ifndef SDLPP_HPP #define SDLPP_HPP +#ifdef _WIN32 +#include "SDL2/SDL.h" +#include "SDL2/SDL_image.h" +#include "SDL2/SDL_ttf.h" +#else #include #include #include +#endif // UNIX #include #include #include diff --git a/tetris/tetris.cpp b/tetris/tetris.cpp index b7b7170..2c24f85 100644 --- a/tetris/tetris.cpp +++ b/tetris/tetris.cpp @@ -7,7 +7,14 @@ #include #include #include +#ifdef _WIN32 +#include "../SDL2/SDL2_framerate.h" +#include +#include +#include +#else #include +#endif // UNIX std::vector< std::shared_ptr< SDLPP::RenderObject > > line_coliders{}; @@ -35,7 +42,11 @@ void prepareShadowColider(std::shared_ptr r) { g_shadow_colider->centerX(); } +#ifdef _WIN32 +int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR szCmdLine, int nCmdShow) { +#else int main() { +#endif SDLPP::init(); SDLPP::Window w( "Tetris clone!" ); w.setResizable(true); @@ -74,6 +85,7 @@ int main() { g_input_functions.push_back(mainSceneInput); while ( !g_quit ) { + SDL_PumpEvents(); SDL_framerateDelay( &gFPS ); if ( !g_cur_object && g_checked_line ) { std::lock_guard< std::mutex > guard( g_movement_mutex );