Add flecs
This commit is contained in:
parent
6692bcf7ad
commit
5f74472055
|
|
@ -20,7 +20,8 @@
|
||||||
"name": "Emscripten",
|
"name": "Emscripten",
|
||||||
"includePath": [
|
"includePath": [
|
||||||
"${workspaceFolder}/../sokol",
|
"${workspaceFolder}/../sokol",
|
||||||
"${workspaceFolder}/../sokol_gp"
|
"${workspaceFolder}/../sokol_gp",
|
||||||
|
"${workspaceFolder}/../flecs/distr"
|
||||||
],
|
],
|
||||||
"defines": [
|
"defines": [
|
||||||
"_DEBUG",
|
"_DEBUG",
|
||||||
|
|
@ -32,7 +33,6 @@
|
||||||
"cStandard": "c17",
|
"cStandard": "c17",
|
||||||
"cppStandard": "c++17",
|
"cppStandard": "c++17",
|
||||||
"intelliSenseMode": "windows-clang-x64",
|
"intelliSenseMode": "windows-clang-x64",
|
||||||
"compilerPathInCppPropertiesJson": "C:\\Users\\c.pons\\Documents\\Perso\\Git\\emsdk\\upstream\\bin\\clang.exe",
|
|
||||||
"mergeConfigurations": false,
|
"mergeConfigurations": false,
|
||||||
"browse": {
|
"browse": {
|
||||||
"path": [
|
"path": [
|
||||||
|
|
@ -47,7 +47,12 @@
|
||||||
"-sASSERTIONS",
|
"-sASSERTIONS",
|
||||||
"-sWASM_BIGINT",
|
"-sWASM_BIGINT",
|
||||||
"-pthread",
|
"-pthread",
|
||||||
"-sFILESYSTEM=0"
|
"-sFILESYSTEM=0",
|
||||||
|
"-sALLOW_MEMORY_GROWTH=1",
|
||||||
|
"-sSTACK_SIZE=1mb",
|
||||||
|
"-sEXPORTED_RUNTIME_METHODS=cwrap",
|
||||||
|
"-sMODULARIZE=1",
|
||||||
|
"-sEXPORT_NAME=\"flecs_tests\""
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,10 @@
|
||||||
"webgpu.h": "c",
|
"webgpu.h": "c",
|
||||||
"html5.h": "c",
|
"html5.h": "c",
|
||||||
"emscripten.h": "c",
|
"emscripten.h": "c",
|
||||||
"stddef.h": "c"
|
"stddef.h": "c",
|
||||||
|
"flecs.h": "c",
|
||||||
|
"stdlib.h": "c",
|
||||||
|
"math.h": "c",
|
||||||
|
"stdio.h": "c"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1 +1 @@
|
||||||
emcc -O3 src/main.c -o app.html -sUSE_WEBGL2 -sWASM_BIGINT -pthread -I../sokol -I../sokol_gp --shell-file=shell.html -sFILESYSTEM=0
|
emcc -O3 src/main.c -o app.html -sUSE_WEBGL2 -sWASM_BIGINT -pthread -I../sokol -I../sokol_gp -I../flecs/distr --shell-file=shell.html -sFILESYSTEM=0
|
||||||
|
|
@ -1 +1 @@
|
||||||
emcc src/main.c -o app.html -sUSE_WEBGL2 -sASSERTIONS -sWASM_BIGINT -pthread -I../sokol -I../sokol_gp --shell-file=shell.html -sFILESYSTEM=0 -g
|
emcc src/main.c -o app.html -sUSE_WEBGL2 -sASSERTIONS -sWASM_BIGINT -pthread -I../sokol -I../sokol_gp -I../flecs/distr --shell-file=shell.html -sFILESYSTEM=0 -g
|
||||||
|
|
@ -3,15 +3,20 @@
|
||||||
// Includes Sokol GFX, Sokol GP and Sokol APP, doing all implementations.
|
// Includes Sokol GFX, Sokol GP and Sokol APP, doing all implementations.
|
||||||
#define SOKOL_IMPL
|
#define SOKOL_IMPL
|
||||||
#define SOKOL_GLES3
|
#define SOKOL_GLES3
|
||||||
|
#define FLECS_CUSTOM_BUILD
|
||||||
#include "sokol_gfx.h"
|
#include "sokol_gfx.h"
|
||||||
#include "sokol_gp.h"
|
#include "sokol_gp.h"
|
||||||
#include "sokol_app.h"
|
#include "sokol_app.h"
|
||||||
#include "sokol_glue.h"
|
#include "sokol_glue.h"
|
||||||
|
|
||||||
|
#include "flecs.c"
|
||||||
|
|
||||||
#include <stdio.h> // for fprintf()
|
#include <stdio.h> // for fprintf()
|
||||||
#include <stdlib.h> // for exit()
|
#include <stdlib.h> // for exit()
|
||||||
#include <math.h> // for sinf() and cosf()
|
#include <math.h> // for sinf() and cosf()
|
||||||
|
|
||||||
|
ecs_world_t *world;
|
||||||
|
|
||||||
// Called on every frame of the application.
|
// Called on every frame of the application.
|
||||||
static void frame(void) {
|
static void frame(void) {
|
||||||
// Get current window size.
|
// Get current window size.
|
||||||
|
|
@ -68,10 +73,14 @@ static void init(void) {
|
||||||
fprintf(stderr, "Failed to create Sokol GP context: %s\n", sgp_get_error_message(sgp_get_last_error()));
|
fprintf(stderr, "Failed to create Sokol GP context: %s\n", sgp_get_error_message(sgp_get_last_error()));
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
world = ecs_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called when the application is shutting down.
|
// Called when the application is shutting down.
|
||||||
static void cleanup(void) {
|
static void cleanup(void) {
|
||||||
|
ecs_fini(world);
|
||||||
|
|
||||||
// Cleanup Sokol GP and Sokol GFX resources.
|
// Cleanup Sokol GP and Sokol GFX resources.
|
||||||
sgp_shutdown();
|
sgp_shutdown();
|
||||||
sg_shutdown();
|
sg_shutdown();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue