Add windows specific changes

This commit is contained in:
zvon 2020-09-12 13:09:20 +02:00
parent dc819016a6
commit 99c5c7fb9e
3 changed files with 22 additions and 0 deletions

View File

@ -1,6 +1,10 @@
#include "sdlpp.hpp"
#ifdef _WIN32
#include "SDL2/SDL_image.h"
#else
#include <SDL2/SDL_image.h>
#endif
#include <iostream>
bool SDLPP::init() {

View File

@ -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 <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include <SDL2/SDL_ttf.h>
#endif // UNIX
#include <algorithm>
#include <cmath>
#include <iostream>

View File

@ -7,7 +7,14 @@
#include <thread>
#include <chrono>
#include <mutex>
#ifdef _WIN32
#include "../SDL2/SDL2_framerate.h"
#include <ctime>
#include <string>
#include <windows.h>
#else
#include <SDL2/SDL2_framerate.h>
#endif // UNIX
std::vector< std::shared_ptr< SDLPP::RenderObject > > line_coliders{};
@ -35,7 +42,11 @@ void prepareShadowColider(std::shared_ptr<SDLPP::Renderer> 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 );