[Application] Template code added to start Lua API later.
This commit is contained in:
parent
4ad7257c44
commit
3e6751e6e6
@ -12,8 +12,8 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
#------------------------------------------------------------------------------
|
||||
# Get source files
|
||||
#------------------------------------------------------------------------------
|
||||
file(GLOB_RECURSE SOURCE_FILES source/*.cpp)
|
||||
file(GLOB_RECURSE HEADER_FILES include/*.hpp)
|
||||
file(GLOB_RECURSE SOURCE_FILES source/*.cpp external/*.cpp)
|
||||
file(GLOB_RECURSE HEADER_FILES include/*.hpp external/*.hpp)
|
||||
|
||||
foreach(HEADER_FILE ${HEADER_FILES})
|
||||
get_filename_component(HEADER_DIRECTORY ${HEADER_FILE} DIRECTORY)
|
||||
@ -35,15 +35,15 @@ target_compile_features(${CMAKE_PROJECT_NAME} PRIVATE cxx_std_17)
|
||||
#------------------------------------------------------------------------------
|
||||
# Packages
|
||||
#------------------------------------------------------------------------------
|
||||
# - jsoncpp
|
||||
# - Lua
|
||||
#------------------------------------------------------------------------------
|
||||
find_package(JsonCpp REQUIRED)
|
||||
if(NOT JSONCPP_FOUND)
|
||||
message(FATAL_ERROR "jsoncpp is needed to build the project. Please install it correctly.")
|
||||
find_package(Lua REQUIRED)
|
||||
if(NOT LUA_FOUND)
|
||||
message(FATAL_ERROR "Lua is needed to build the project. Please install it correctly.")
|
||||
endif()
|
||||
|
||||
include_directories(${JSONCPP_INCLUDE_DIRS})
|
||||
link_directories(${JSONCPP_LIBRARY_DIRS})
|
||||
include_directories(${LUA_INCLUDE_DIRS})
|
||||
link_directories(${LUA_LIBRARY_DIRS})
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# - tinyxml2
|
||||
@ -104,7 +104,7 @@ include_directories(${SDL2_INCLUDE_DIRS}
|
||||
#------------------------------------------------------------------------------
|
||||
target_link_libraries(${CMAKE_PROJECT_NAME}
|
||||
${TINYXML2_LIBRARIES}
|
||||
${JSONCPP_LIBRARIES}
|
||||
${LUA_LIBRARIES}
|
||||
${OPENGL_LIBRARIES}
|
||||
${SDL2_LIBRARIES}
|
||||
${SDL2IMAGE_LIBRARIES}
|
||||
|
22180
external/sol.hpp
vendored
Normal file
22180
external/sol.hpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@ -14,6 +14,8 @@
|
||||
#ifndef APPLICATION_HPP_
|
||||
#define APPLICATION_HPP_
|
||||
|
||||
#include <sol.hpp>
|
||||
|
||||
#include "CoreApplication.hpp"
|
||||
#include "Registry.hpp"
|
||||
|
||||
@ -27,6 +29,7 @@ class Application : public CoreApplication {
|
||||
|
||||
private:
|
||||
Registry m_registry;
|
||||
sol::state m_lua;
|
||||
};
|
||||
|
||||
#endif // APPLICATION_HPP_
|
||||
|
@ -37,6 +37,9 @@ void Application::init() {
|
||||
m_registry.registerItems();
|
||||
m_registry.registerRecipes();
|
||||
|
||||
m_lua.open_libraries();
|
||||
m_lua.script("print('lol')");
|
||||
|
||||
m_stateStack.push<GameState>();
|
||||
}
|
||||
|
||||
@ -71,4 +74,3 @@ void Application::initOpenGL() {
|
||||
glClearColor(0.196078, 0.6, 0.8, 1.0); // Skyblue
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user