From 55ca7028b55513f28a7aeaea099445bd20128f60 Mon Sep 17 00:00:00 2001 From: King_DuckZ Date: Mon, 25 May 2015 01:38:00 +0200 Subject: [PATCH] New game project. --- CMakeLists.txt | 2 ++ game/CMakeLists.txt | 33 +++++++++++++++++++++++++++++++++ game/gameConfig.h.in | 9 +++++++++ game/main.cpp | 15 +++++++++++++++ 4 files changed, 59 insertions(+) create mode 100644 game/CMakeLists.txt create mode 100644 game/gameConfig.h.in create mode 100644 game/main.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 95e5af5..993b3f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,5 @@ cmake_minimum_required(VERSION 2.8 FATAL_ERROR) +cmake_policy(SET CMP0040 NEW) #add_custom_command's target must exist set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=c++11 -g -O0 -Wall -Wextra") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++11 -O3 -Wall -Wextra") @@ -18,3 +19,4 @@ include_directories( add_subdirectory(src) add_subdirectory(test) +add_subdirectory(game) diff --git a/game/CMakeLists.txt b/game/CMakeLists.txt new file mode 100644 index 0000000..09480ad --- /dev/null +++ b/game/CMakeLists.txt @@ -0,0 +1,33 @@ +cmake_minimum_required(VERSION 2.8 FATAL_ERROR) +cmake_policy(SET CMP0048 NEW) #to use VERSION in project() +project(game VERSION 0.1.0 LANGUAGES CXX) + +include(FindPkgConfig) +pkg_search_module(SDL2 REQUIRED sdl2) +pkg_search_module(SDL2IMAGE REQUIRED SDL2_image>=2.0.0) + +configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}Config.h.in" + "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.h" +) + +include_directories( + . + "${CMAKE_CURRENT_BINARY_DIR}" + ${SDL2_INCLUDE_DIR} +) + +add_executable(${PROJECT_NAME} + main.cpp +) + +target_link_libraries(${PROJECT_NAME} + doorkeeper + ${SDL2_LIBRARIES} + ${SDL2IMAGE_LIBRARIES} +) + +#add_custom_command( +# TARGET game POST_BUILD +# COMMAND ln -sf ${CMAKE_CURRENT_BINARY_DIR}/game game +#) diff --git a/game/gameConfig.h.in b/game/gameConfig.h.in new file mode 100644 index 0000000..ebd67be --- /dev/null +++ b/game/gameConfig.h.in @@ -0,0 +1,9 @@ +#ifndef idCEA37B5347F14CCF96AFC7ED83C9DE4F +#define idCEA37B5347F14CCF96AFC7ED83C9DE4F + +#define GAME_NAME "@PROJECT_NAME@" +#define GAME_VER_MAJOR @PROJECT_VERSION_MAJOR@ +#define GAME_VER_MINOR @PROJECT_VERSION_MINOR@ +#define GAME_VER_PATCH @PROJECT_VERSION_PATCH@ + +#endif diff --git a/game/main.cpp b/game/main.cpp new file mode 100644 index 0000000..925cfea --- /dev/null +++ b/game/main.cpp @@ -0,0 +1,15 @@ +#include "doorkeeper/doorkeeper2d.hpp" +#include "gameConfig.h" +#include + +int main() { + using dk::Tyler2d; + using dk::coords2; + using dk::Viewport2d; + using dk::Layer2d; + + std::cout << "Welcome to " GAME_NAME " v" << GAME_VER_MAJOR << '.' << GAME_VER_MINOR << '.' << GAME_VER_PATCH << '\n'; + + Tyler2d tiler(coords2(64, 33)); + return 0; +}