diff --git a/src/main.cpp b/src/main.cpp index 57db112..5ff9347 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -7,7 +7,9 @@ #include #include #include +#ifdef WITH_SDL2 #include +#endif #include "Board.h" #ifndef _WIN32 #include @@ -21,7 +23,9 @@ void handleSIGWINCH(int sig) #define MAX_TIME 60 +#ifdef WITH_SDL2 SDL_GameController *controller; +#endif void startGame(Board &board) { @@ -163,6 +167,7 @@ void startGame(Board &board) } c = getch(); +#ifdef WITH_SDL2 if (c == ERR) { if (controller != nullptr) @@ -270,6 +275,7 @@ void startGame(Board &board) } } } +#endif if (!(c == ERR)) { @@ -438,6 +444,7 @@ void startGame(Board &board) } } +#ifdef WITH_SDL2 SDL_GameController *findController() { for (int i = 0; i < SDL_NumJoysticks(); i++) @@ -450,6 +457,7 @@ SDL_GameController *findController() return nullptr; } +#endif int main() { @@ -466,6 +474,7 @@ int main() ioctl(STDOUT_FILENO, TIOCGWINSZ, &w); #endif +#ifdef WITH_SDL2 bool controllerSupport; if (SDL_Init(SDL_INIT_GAMECONTROLLER) < 0) @@ -481,6 +490,7 @@ int main() controller = findController(); if (controller != nullptr) controllerSupport = false; // no controller for you +#endif start_color(); init_pair(1, COLOR_BLUE, COLOR_BLACK);