From 75e46bc0abdaa0875e09d821cc98e59f1cca009f Mon Sep 17 00:00:00 2001 From: Deathsbreed Date: Wed, 30 Mar 2016 16:36:13 +0200 Subject: [PATCH] Updating a few things. --- CMakeLists.txt | 25 +++----------------- {res => assets}/map-20kdm2.pk3 | Bin {cmake => cmake_modules}/FindIrrlicht.cmake | 3 ++- src/main.cpp | 6 ++--- 4 files changed, 8 insertions(+), 26 deletions(-) rename {res => assets}/map-20kdm2.pk3 (100%) rename {cmake => cmake_modules}/FindIrrlicht.cmake (87%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 65394e1..1e012c1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,22 +3,7 @@ project(CastleTour) set(CMAKE_CXX_FLAGS "-Wall -g") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin) -set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) - -find_package(X11) -if(NOT X11_FOUND) - message(FATAL_ERROR "Package X11 is required, but not found!") -endif(NOT X11_FOUND) - -find_package(GLUT) -if(NOT GLUT_FOUND) - message(FATAL_ERROR "Package OpenGL is required, but not found!") -endif(NOT GLUT_FOUND) - -find_package(ZLIB) -if(NOT ZLIB_FOUND) - message(FATAL_ERROR "Package zlib is required, but not found!") -endif(NOT ZLIB_FOUND) +set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake_modules) find_package(Irrlicht) if(NOT Irrlicht_FOUND) @@ -27,22 +12,18 @@ endif(NOT Irrlicht_FOUND) include_directories( ${IRRLICHT_INCLUDE_DIR} - ${X11_INCLUDE_DIR} - ${GLUT_INCLUDE_DIR} - ${ZLIB_INCLUDE_DIR} ) file(GLOB SRCS src/*.cpp) file(GLOB HDRS src/*.h) +include_directories(${IRRLICHT_INCLUDE_DIR}) + add_executable(${CMAKE_PROJECT_NAME} ${SRCS} ${HDRS} ) target_link_libraries(${CMAKE_PROJECT_NAME} - ${X11_LIBRARIES} - ${GLUT_LIBRARIES} - ${ZLIB_LIBRARIES} ${IRRLICHT_LIBRARY} ) diff --git a/res/map-20kdm2.pk3 b/assets/map-20kdm2.pk3 similarity index 100% rename from res/map-20kdm2.pk3 rename to assets/map-20kdm2.pk3 diff --git a/cmake/FindIrrlicht.cmake b/cmake_modules/FindIrrlicht.cmake similarity index 87% rename from cmake/FindIrrlicht.cmake rename to cmake_modules/FindIrrlicht.cmake index d71a117..5db5896 100644 --- a/cmake/FindIrrlicht.cmake +++ b/cmake_modules/FindIrrlicht.cmake @@ -5,10 +5,11 @@ find_path(IRRLICHT_INCLUDE_DIR irrlicht/irrlicht.h message(STATUS "IRRLICHT_INCLUDE_DIR = ${IRRLICHT_INCLUDE_DIR}") -find_library(IRRLICHT_LIBRARY NAMES Irrlicht +find_library(IRRLICHT_LIBRARY NAMES libIrrlicht.so PATHS $ENV{IRRDIR}/lib ) + message(STATUS "IRRLICHT_LIBRARY = ${IRRLICHT_LIBRARY}") if(IRRLICHT_INCLUDE_DIR AND IRRLICHT_LIBRARY) diff --git a/src/main.cpp b/src/main.cpp index 4b80284..5198587 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -26,7 +26,7 @@ int main() { guienv->addStaticText(L"Use WASD to move\nUse SPACE to jump\nUse R to reset\nUse ESC or Q to exit", core::rect(30, 30, 120, 72), false, false, 0, -1, true); // Load map - device->getFileSystem()->addFileArchive("../res/map-20kdm2.pk3"); + device->getFileSystem()->addFileArchive("../assets/map-20kdm2.pk3"); scene::IAnimatedMesh *mapmesh = smgr->getMesh("20kdm2.bsp"); scene::IMeshSceneNode *mapnode = 0; @@ -76,7 +76,7 @@ int main() { while(device->run()) { // Begin the scene - driver->beginScene(true, true, video::SColor(0, 255, 101, 255)); + driver->beginScene(true, true, video::SColor(50, 50, 255, 255)); // Draw smgr->drawAll(); guienv->drawAll(); @@ -88,7 +88,7 @@ int main() { } if(eventReceiver.IsKeyDown(KEY_KEY_R)) { cam->setPosition(core::vector3df(50, 50, -60)); - cam->setTarget(core::vector3df(-70, 30, -60)); + cam->setTarget(core::vector3df(-70, 30, -60)); } // Print FPS