-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/tumble1999/cinnabar
- Loading branch information
Showing
8 changed files
with
85 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/** | ||
* Cinnabar Module API | ||
* Author: Cameron Trow <[email protected]> | ||
* | ||
* Entry point for the version of the module api for use during module development | ||
* | ||
*/ | ||
|
||
#include "core/module.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** | ||
* API FOR CREATING MODULES FOR CINNABAR ENGINE | ||
*/ | ||
|
||
#pragma once | ||
|
||
namespace ce { | ||
class Module { | ||
private: | ||
public: | ||
virtual void tick(float deltaTime) = 0; | ||
}; | ||
typedef Module* init_module_t(); | ||
typedef void delete_module_t(Module*); | ||
} | ||
#define CE_MODULE(X) \ | ||
extern "C" ce::Module* init_module() { return new X; } \ | ||
extern "C" void delete_module(ce::Module* m) { delete m; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,30 @@ | ||
#pragma once | ||
|
||
#include <string> | ||
#include <vector> | ||
|
||
#include <core/module.h> | ||
|
||
namespace ce { | ||
typedef void (*module_t)(); | ||
class ModuleManger { | ||
|
||
private: | ||
struct ModuleRef { | ||
Module* module; | ||
void* lib; | ||
init_module_t* inti_module; | ||
delete_module_t* delete_module; | ||
}; | ||
|
||
inline static const std::string MODULE_FOLDER = "modules"; | ||
|
||
std::vector<ModuleRef> m_modules; | ||
|
||
void loadModules(); | ||
|
||
public: | ||
ModuleManger(); | ||
~ModuleManger(); | ||
|
||
void tickModules(float deltaTime); | ||
}; | ||
} |
Binary file not shown.
Binary file not shown.