Modules
This commit is contained in:
32
src/script/scriptmodule.c
Normal file
32
src/script/scriptmodule.c
Normal file
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#include "scriptmodule.h"
|
||||
#include "script/module/modulesystem.h"
|
||||
#include "script/module/moduleinput.h"
|
||||
#include "script/module/moduleplatform.h"
|
||||
#include "script/module/modulescene.h"
|
||||
|
||||
const scriptmodule_t SCRIPT_MODULE_LIST[] = {
|
||||
{ .name = "system", .callback = moduleSystem },
|
||||
{ .name = "input", .callback = moduleInput },
|
||||
{ .name = "platform", .callback = modulePlatform },
|
||||
{ .name = "scene", .callback = moduleScene },
|
||||
};
|
||||
|
||||
#define SCRIPT_MODULE_COUNT ( \
|
||||
sizeof(SCRIPT_MODULE_LIST) / sizeof(scriptmodule_t) \
|
||||
)
|
||||
|
||||
const scriptmodule_t * scriptModuleGetByName(const char_t *name) {
|
||||
for(uint_fast8_t i = 0; i < SCRIPT_MODULE_COUNT; i++) {
|
||||
if(stringCompare(SCRIPT_MODULE_LIST[i].name, name) != 0) continue;
|
||||
return &SCRIPT_MODULE_LIST[i];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
Reference in New Issue
Block a user