Remove Jerryscript further
This commit is contained in:
@@ -7,12 +7,11 @@
|
||||
#include "error/error.h"
|
||||
|
||||
#define CUTSCENE_EVENT_COUNT_MAX 16
|
||||
#define CUTSCENE_SCRIPT_REF_NONE ((jerry_value_t)0)
|
||||
|
||||
typedef struct {
|
||||
errorret_t (*onStart)(void);
|
||||
errorret_t (*onEnd)(void);
|
||||
errorret_t (*onUpdate)(void);
|
||||
errorret_t (*onStart)(void);
|
||||
errorret_t (*onEnd)(void);
|
||||
errorret_t (*onUpdate)(void);
|
||||
} cutsceneevent_t;
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -26,16 +26,6 @@
|
||||
#include "item/backpack.h"
|
||||
#include "save/save.h"
|
||||
|
||||
double jerry_port_current_time(void) {
|
||||
dusktimeepoch_t epoch = timeGetEpoch();
|
||||
return epoch.time * 1000.0;
|
||||
}
|
||||
|
||||
int32_t jerry_port_local_tza(double unix_ms) {
|
||||
(void) unix_ms;
|
||||
return 0;
|
||||
}
|
||||
|
||||
engine_t ENGINE;
|
||||
|
||||
errorret_t engineInit(const int32_t argc, const char_t **argv) {
|
||||
|
||||
@@ -7,4 +7,7 @@
|
||||
target_sources(${DUSK_LIBRARY_TARGET_NAME}
|
||||
PUBLIC
|
||||
scene.c
|
||||
)
|
||||
)
|
||||
|
||||
# Subdirectories
|
||||
add_subdirectory(initial)
|
||||
@@ -0,0 +1,10 @@
|
||||
# Copyright (c) 2026 Dominic Masters
|
||||
#
|
||||
# This software is released under the MIT License.
|
||||
# https://opensource.org/licenses/MIT
|
||||
|
||||
# Sources
|
||||
target_sources(${DUSK_LIBRARY_TARGET_NAME}
|
||||
PUBLIC
|
||||
initialscene.c
|
||||
)
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Copyright (c) 2026 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#include "initialscene.h"
|
||||
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* Copyright (c) 2026 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "scene/scene.h"
|
||||
|
||||
void initialSceneInit(void);
|
||||
errorret_t initialSceneUpdate(void);
|
||||
errorret_t initialSceneDraw(void);
|
||||
void initialSceneDispose(void);
|
||||
|
||||
static const scene_t INITIAL_SCENE = {
|
||||
.init = initialSceneInit,
|
||||
.update = initialSceneUpdate,
|
||||
.draw = initialSceneDraw,
|
||||
.dispose = initialSceneDispose
|
||||
};
|
||||
+20
-9
@@ -18,10 +18,15 @@
|
||||
#include "util/string.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
scene_t SCENE;
|
||||
scene_t SCENE_CURRENT;
|
||||
scene_t SCENE_NEXT;
|
||||
bool_t SCENE_NEXT_SET;
|
||||
|
||||
errorret_t sceneInit(void) {
|
||||
memoryZero(&SCENE, sizeof(scene_t));
|
||||
memoryZero(&SCENE_CURRENT, sizeof(scene_t));
|
||||
memoryZero(&SCENE_NEXT, sizeof(scene_t));
|
||||
SCENE_NEXT_SET = false;
|
||||
|
||||
errorOk();
|
||||
}
|
||||
|
||||
@@ -32,6 +37,15 @@ errorret_t sceneUpdate(void) {
|
||||
}
|
||||
#endif
|
||||
|
||||
if(SCENE_NEXT_SET) {
|
||||
if(SCENE_CURRENT.dispose) SCENE_CURRENT.dispose();
|
||||
SCENE_CURRENT = SCENE_NEXT;
|
||||
SCENE_NEXT_SET = false;
|
||||
if(SCENE_CURRENT.init) SCENE_CURRENT.init();
|
||||
}
|
||||
|
||||
if(SCENE_CURRENT.update != NULL) errorChain(SCENE_CURRENT.update());
|
||||
|
||||
errorOk();
|
||||
}
|
||||
|
||||
@@ -158,13 +172,10 @@ errorret_t sceneRender(void) {
|
||||
errorOk();
|
||||
}
|
||||
|
||||
// void sceneSet(const char_t *scene) {
|
||||
// stringCopy(
|
||||
// SCENE.sceneNext,
|
||||
// scene == NULL ? "" : scene,
|
||||
// ASSET_FILE_NAME_MAX
|
||||
// );
|
||||
// }
|
||||
void sceneSet(const scene_t scene) {
|
||||
SCENE_NEXT = scene;
|
||||
SCENE_NEXT_SET = true;
|
||||
}
|
||||
|
||||
errorret_t sceneDispose(void) {
|
||||
errorOk();
|
||||
|
||||
@@ -11,11 +11,14 @@
|
||||
#define SCENE_EVENT_UPDATE_MAX 16
|
||||
|
||||
typedef struct {
|
||||
void *nothing;
|
||||
void (*init)(void);
|
||||
errorret_t (*update)(void);
|
||||
void (*dispose)(void);
|
||||
} scene_t;
|
||||
|
||||
extern scene_t SCENE;
|
||||
|
||||
extern scene_t SCENE_CURRENT;
|
||||
extern scene_t SCENE_NEXT;
|
||||
extern bool_t SCENE_NEXT_SET;
|
||||
|
||||
/**
|
||||
* Initializes the scene manager.
|
||||
@@ -43,7 +46,7 @@ errorret_t sceneRender(void);
|
||||
*
|
||||
* @param scene Which scene to set.
|
||||
*/
|
||||
// void sceneSet(const char_t *scene);
|
||||
void sceneSet(const scene_t scene);
|
||||
|
||||
/**
|
||||
* Disposes of the current scene.
|
||||
|
||||
Reference in New Issue
Block a user