test
This commit is contained in:
+25
-1
@@ -8,9 +8,33 @@
|
||||
#include "game/game.h"
|
||||
#include "scene/scene.h"
|
||||
#include "scene/overworldscene.h"
|
||||
#include "assert/assert.h"
|
||||
#include "asset/asset.h"
|
||||
#include "yyjson.h"
|
||||
|
||||
#define GAME_TEST_SCENE_ASSET "scenes/test.json"
|
||||
|
||||
errorret_t gameInit(void) {
|
||||
sceneSetActive(overworldSceneCreate());
|
||||
// overworldSceneCreate();
|
||||
|
||||
sceneid_t testSceneId = sceneCreate();
|
||||
|
||||
// Exercises sceneDeserialize() end-to-end: a camera looking at a
|
||||
// colored cube that falls under gravity onto a static ground plane,
|
||||
// described entirely as JSON rather than built with the entity API.
|
||||
assetentry_t *sceneEntry = assetLock(
|
||||
GAME_TEST_SCENE_ASSET, ASSET_LOADER_TYPE_JSON, NULL
|
||||
);
|
||||
errorret_t ret = assetRequireLoaded(sceneEntry);
|
||||
if(errorIsOk(ret)) {
|
||||
ret = sceneDeserialize(
|
||||
testSceneId, yyjson_doc_get_root(sceneEntry->data.json)
|
||||
);
|
||||
}
|
||||
assetUnlockEntry(sceneEntry);
|
||||
errorChain(ret);
|
||||
|
||||
sceneSetActive(testSceneId);
|
||||
errorOk();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user