Add flecs

This commit is contained in:
Clément Pons
2025-03-25 17:18:06 +01:00
parent 6692bcf7ad
commit 5f74472055
5 changed files with 24 additions and 6 deletions

View File

@@ -3,15 +3,20 @@
// Includes Sokol GFX, Sokol GP and Sokol APP, doing all implementations.
#define SOKOL_IMPL
#define SOKOL_GLES3
#define FLECS_CUSTOM_BUILD
#include "sokol_gfx.h"
#include "sokol_gp.h"
#include "sokol_app.h"
#include "sokol_glue.h"
#include "flecs.c"
#include <stdio.h> // for fprintf()
#include <stdlib.h> // for exit()
#include <math.h> // for sinf() and cosf()
ecs_world_t *world;
// Called on every frame of the application.
static void frame(void) {
// 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()));
exit(-1);
}
world = ecs_init();
}
// Called when the application is shutting down.
static void cleanup(void) {
ecs_fini(world);
// Cleanup Sokol GP and Sokol GFX resources.
sgp_shutdown();
sg_shutdown();