ModEasy, a c++ library, is an easy to add modding system that is functional out of the box, but also designed to be extendable for whatever you may need.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
1.9 KiB

#ifndef ModdingFrameworkCore_H
#define ModdingFrameworkCore_H
#include "defaults.h"
#include "Configuration/ConfigLoaderBase.h"
#include "Configuration/ConfigLoaderINI.h"
#include "Configuration/ConfigStore.h"
#include "Configuration/ConfigManager.h"
#include "Dependency/Dependency.h"
#include <memory>
#include <unordered_map>
#include <vector>
class ModdingFrameworkCore {
//path to mod directory
std::string mods_path{""};
//class in charge of managing config file loading
ConfigManager config_manager;
//settings used by the library
std::shared_ptr<ConfigStore> default_settings;
//Mod configuration data
std::vector< std::shared_ptr<ConfigStore> > mod_config;
ModdingFrameworkCore(std::string _mods_path, bool register_default_loaders = true,
std::shared_ptr<ConfigStore> _default_settings = buildDefaultSettings())
: mods_path(_mods_path), config_manager(), default_settings(_default_settings), mod_config() {
//allows user to not load default config loaders if they so desire
if (register_default_loaders) {
registerConfigLoader( std::make_shared<ConfigLoaderINI>() );
//TODO setup needs to go somewhere else besides the constructor method to let user register more loaders and the like
//1. Load mod configuration data
mod_config = config_manager.loadModDirConfigs(mods_path);
//2. Construct loading order based on Dependancies
//3. Follow load order and pass each mod to the appropriate mod implementation class for initialization
//Wrapper function for registering configLoaders
void registerConfigLoader(std::shared_ptr<ConfigLoaderBase> loader) {