Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • gamedev/fggl
  • onuralpsezer/fggl
2 results
Show changes
......@@ -63,7 +63,7 @@ namespace fggl::util {
}
StateType &active() const {
assertm(m_states.find(m_active) != m_states.end(), "active state does not exist!");
ASSERT_MSG(m_states.find(m_active) != m_states.end(), "active state does not exist!");
return *(m_states.at(m_active).get());
}
......
......@@ -5,9 +5,9 @@ to expose modules which can then be used in your applications.
## Integrations Provided
The following integration modules are povided in this folder. For more information please see the readme for that module.
| Integration | Module Name | Description |
| ----------- | ----------- |-------------|
| Integration | Module Name | Description |
|-------------|-----------------------|----------------------------------------------------|
| Bullet | `fggl::phys::Bullet3` | Provides Bullet3 integration into the game engine. |
| Lua | `fggl::script::Lua` | Provides LUA scripting support for the engine |
| Lua | `fggl::script::Lua` | Provides LUA scripting support for the engine |
Modules that cannot be included for legal reasons will be packaged independently of this repository.
\ No newline at end of file
target_include_directories( fggl
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>
$<INSTALL_INTERFACE:include>
)
......@@ -2,6 +2,7 @@ add_library(fggl-lua)
find_package(Lua REQUIRED)
target_link_libraries(fggl-lua PUBLIC ${LUA_LIBRARIES})
target_include_directories(fggl-lua INTERFACE ${LUA_INCLUDE_DIR})
# Link to FGGL
target_link_libraries(fggl-lua PUBLIC fggl)
......
......@@ -23,9 +23,9 @@
#include "fggl/data/storage.hpp"
extern "C" {
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
};
namespace fggl::script::lua {
......
......@@ -19,21 +19,30 @@
#ifndef FGGL_INTEGRATIONS_LUA_SCRIPT_LUA_MODULE_HPP
#define FGGL_INTEGRATIONS_LUA_SCRIPT_LUA_MODULE_HPP
#define FGGL_HAS_LUA
#include "fggl/modules/module.hpp"
#include "fggl/entity/module.hpp"
#include "fggl/script/engine.hpp"
#include "fggl/data/module.hpp"
#include "fggl/assets/packed/adapter.hpp"
namespace fggl::script::lua {
constexpr auto MIME_LUA = assets::from_mime("text/lua");
constexpr auto SCRIPT_LUA = assets::make_asset_type("script/lua");
struct Lua {
constexpr static const char* name = "fggl::script::lua";
constexpr static const std::array<modules::ModuleService, 1> provides = {
constexpr static const std::array<modules::ServiceName, 1> provides = {
script::ScriptProvider::service
};
constexpr static const std::array<modules::ModuleService, 1> depends = {
data::SERVICE_STORAGE
constexpr static const std::array<modules::ServiceName, 2> depends = {
data::SERVICE_STORAGE,
assets::CheckinAdapted::service
};
static bool factory(modules::ModuleService name, modules::Services& serviceManager);
static bool factory(modules::ServiceName name, modules::Services& serviceManager);
};
} // namespace fggl::script::lua
......
......@@ -21,11 +21,22 @@
namespace fggl::script::lua {
bool Lua::factory(modules::ModuleService service, modules::Services &serviceManager) {
static assets::AssetTypeID is_lua(std::filesystem::path path) {
if ( path.extension() == ".lua" ) {
return SCRIPT_LUA;
}
return assets::INVALID_ASSET_TYPE;
}
bool Lua::factory(modules::ServiceName service, modules::Services &serviceManager) {
if ( service == ScriptProvider::service ) {
auto storageService = serviceManager.get<data::Storage>();
auto *storageService = serviceManager.get<data::Storage>();
serviceManager.bind<ScriptProvider,LuaScriptProvider>(storageService);
auto *assetPacker = serviceManager.get<assets::CheckinAdapted>();
assetPacker->setLoader(MIME_LUA, assets::NEEDS_CHECKIN, is_lua);
return true;
}
......
......@@ -30,8 +30,8 @@
// Created by webpigeon on 11/09/22.
//
#ifndef FGGL_TOOLS_PACK_INCLUDES_BINARY_HPP
#define FGGL_TOOLS_PACK_INCLUDES_BINARY_HPP
#ifndef FGGL_TOOLS_PACK_SRC_BINARY_HPP
#define FGGL_TOOLS_PACK_SRC_BINARY_HPP
#include <cstdint>
#include <iostream>
......@@ -132,4 +132,4 @@ namespace fggl::data {
}
#endif //FGGL_TOOLS_PACK_INCLUDES_BINARY_HPP
#endif //FGGL_TOOLS_PACK_SRC_BINARY_HPP
# Vendor Libraries
This folder contains 3rd party code we need to ship with our build.
Compile-time only dependencies, or dependencies which can be included using cmake directly will not be included within this folder.
| Library | Purpose | Licence |
|------------|--------------------------------------------------|---------|
| GLAD | Allow loading of OpenGL libraries and extentions | MIT |
| Dear IMGUI | Debugging UI/Editor windows | MIT |
\ No newline at end of file
add_library( entt INTERFACE )
target_include_directories( entt
INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>
$<INSTALL_INTERFACE:include>
)
install(
FILES
include/fggl/vendor/entt.hpp
DESTINATION
${CMAKE_INSTALL_INCLUDEDIR}/fggl/vendor/entt.hpp
)
install(TARGETS entt
EXPORT fgglTargets
DESTINATION
${CMAKE_INSTALL_LIBDIR}/fggl/entt
)
......@@ -23,5 +23,5 @@ include(GNUInstallDirs)
install(TARGETS imgui
EXPORT fgglTargets
PUBLIC_HEADER
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/fggl/imgui
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/fggl/imgui
)
\ No newline at end of file