Skip to content

Commit

Permalink
Downgrade minimum Cmake version and add verbose error messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
GnikDroy committed Dec 29, 2018
1 parent 38276ba commit 7105a2c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.7)
cmake_minimum_required(VERSION 3.5)

set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
Expand Down
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,8 @@ Make sure that the requirements are met.

`sudo apt-get update`

`sudo apt-get install cmake`
`sudo apt-get install cmake libsdl2-dev libsdl2ttf-dev`

`sudo apt-get install libsdl2-dev`

`sudo apt-get install libsdl2ttf-dev`

This installs the necessary libraries under linux.

Expand Down
10 changes: 5 additions & 5 deletions src/game.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ bool initSDL(SDL_Window **window,SDL_Renderer** renderer)
TTF_Init();
if( SDL_Init( SDL_INIT_VIDEO ) < 0 )
{
fprintf(stderr, "SDL could not initialize: %s\n", SDL_GetError());
fprintf(stderr, "SDL could not initialize. SDL_ERROR: %s\n", SDL_GetError());
return false;
}
*window = SDL_CreateWindow( "2048", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN );
if( window == NULL )
{
fprintf(stderr, "Window could not be created: %s\n", SDL_GetError());
fprintf(stderr, "Window could not be created. SDL_ERROR: %s\n", SDL_GetError());
return false;
}
*renderer = SDL_CreateRenderer( *window, -1, SDL_RENDERER_ACCELERATED );
if( renderer == NULL )
{
fprintf(stderr, "Renderer could not be created: %s\n", SDL_GetError());
fprintf(stderr, "Renderer could not be created. SDL_ERROR: %s\n", SDL_GetError());
closeSDL(window);
return false;
}
Expand Down Expand Up @@ -76,7 +76,7 @@ void display_text(SDL_Renderer* renderer,const char* text,int size)
font= TTF_OpenFont(FONT_PATH, size);
if(font==NULL)
{
fprintf(stderr,"The required font was not found");
fprintf(stderr,"The required font was not found. TTF_OpenFont: %s\n",TTF_GetError());
exit(EXIT_FAILURE);
}
SDL_Color black = {g_fg.r,g_fg.g, g_fg.b};
Expand Down Expand Up @@ -200,7 +200,7 @@ void game_loop(Board board,SDL_Renderer* renderer)
font= TTF_OpenFont(FONT_PATH, CELL_FONT_SIZE);
if(font==NULL)
{
fprintf(stderr,"The required font was not found");
fprintf(stderr,"The required font was not found. TTF_OpenFont: %s\n",TTF_GetError());
exit(EXIT_FAILURE);
}

Expand Down

0 comments on commit 7105a2c

Please sign in to comment.