Scene methods
Some checks failed
Build Dusk / run-tests (push) Failing after 2m14s
Build Dusk / build-linux (push) Successful in 2m12s
Build Dusk / build-psp (push) Failing after 1m30s

This commit is contained in:
2026-01-28 10:31:31 -06:00
parent 25dc97e3cc
commit 6bdb4ae30d
20 changed files with 215 additions and 151 deletions

View File

@@ -0,0 +1,37 @@
/**
* Copyright (c) 2026 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "moduletime.h"
#include "assert/assert.h"
#include "script/scriptstruct.h"
void moduleTime(scriptcontext_t *ctx) {
assertNotNull(ctx, "Script context cannot be NULL");
// Script structure
scriptStructRegister(ctx, "time_mt", moduleTimeGetter, NULL);
// Register struct
scriptStructPush(ctx, "time_mt", "TIME", &TIME);
}
void moduleTimeGetter(
const scriptcontext_t *context,
const char_t *key,
const void *structPtr,
scriptvalue_t *outValue
) {
if(stringCompare(key, "delta") == 0) {
outValue->type = SCRIPT_VALUE_TYPE_FLOAT;
outValue->value.floatValue = TIME.delta;
return;
} else if(stringCompare(key, "time") == 0) {
outValue->type = SCRIPT_VALUE_TYPE_FLOAT;
outValue->value.floatValue = TIME.time;
return;
}
}