Skip to content
Snippets Groups Projects
Commit fcc6b959 authored by Joseph Walton-Rivers's avatar Joseph Walton-Rivers
Browse files

clean up header, cpp seperation

parent e661c350
No related branches found
No related tags found
No related merge requests found
......@@ -35,6 +35,8 @@ endif ()
add_subdirectory(math)
add_subdirectory(util)
add_subdirectory(assets)
target_sources(${PROJECT_NAME}
PRIVATE
app.cpp
......@@ -42,6 +44,7 @@ target_sources(${PROJECT_NAME}
data/model.cpp
data/procedural.cpp
data/heightmap.cpp
data/module.cpp
scenes/menu.cpp
scenes/game.cpp
......
target_sources(fggl PRIVATE
module.cpp
)
\ No newline at end of file
/*
* This file is part of FGGL.
*
* FGGL is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* FGGL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with FGGL.
* If not, see <https://www.gnu.org/licenses/>.
*/
//
// Created by webpigeon on 20/08/22.
//
#include "fggl/assets/module.hpp"
namespace fggl::assets {
bool AssetFolders::factory(modules::ModuleService service, modules::Services& services) {
if ( service == Loader::service) {
auto storage = services.get<data::Storage>();
services.create<Loader>(storage);
return true;
}
if (service == AssetManager::service) {
services.create<AssetManager>();
return true;
}
return false;
}
} // namespace fggl::assets
\ No newline at end of file
......@@ -12,19 +12,22 @@
* If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef FGGL_DATA_PROCEDURE_HPP
#define FGGL_DATA_PROCEDURE_HPP
//
// Created by webpigeon on 20/08/22.
//
namespace fggl::data {
class DataRegistry {
#include "fggl/data/module.hpp"
public:
DataRegistry();
~DataRegistry();
};
namespace fggl::data {
}
bool LocalStorage::factory(modules::ModuleService service, modules::Services& data) {
if (service == SERVICE_STORAGE) {
// FIXME: no easy way to set the application name
auto pathConfig = fggl::platform::calc_engine_paths("fggl-demo");
data.create<Storage>(pathConfig);
return true;
}
return false;
}
#endif
} // namespace fggl::data
\ No newline at end of file
......@@ -56,7 +56,7 @@ namespace fggl::assets {
m_registry.at(guid).refCount++;
}
void release(const AssetGUID& guid) {
inline void release(const AssetGUID& guid) {
m_registry.at(guid).refCount--;
}
......
......@@ -35,23 +35,9 @@ namespace fggl::assets {
constexpr static const std::array<modules::ModuleService, 1> depends = {
data::Storage::service
};
static bool factory(modules::ModuleService name, modules::Services& serviceManager);
};
bool AssetFolders::factory(modules::ModuleService service, modules::Services& services) {
if ( service == Loader::service) {
auto storage = services.get<data::Storage>();
services.create<Loader>(storage);
return true;
}
if (service == AssetManager::service) {
services.create<AssetManager>();
return true;
}
return false;
}
} // namespace fggl::assets
#endif //FGGL_ASSETS_MODULE_HPP
......@@ -25,26 +25,15 @@
namespace fggl::data {
struct LocalStorage {
constexpr static const char* name = "fggl::data::Storage";
constexpr static const std::array<modules::ModuleService, 1> provides = {
SERVICE_STORAGE
};
constexpr static const std::array<modules::ModuleService, 0> depends = {};
static bool factory(modules::ModuleService service, modules::Services& serviceManager);
};
bool LocalStorage::factory(modules::ModuleService service, modules::Services& data) {
if (service == SERVICE_STORAGE) {
// FIXME: no easy way to set the application name
auto pathConfig = fggl::platform::calc_engine_paths("fggl-demo");
data.create<Storage>(pathConfig);
return true;
}
return false;
}
} // namespace fggl::data
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment