Properly link flecs library

This commit is contained in:
2023-11-09 11:38:29 +01:00
parent dc585396c3
commit 8edcf9305c
1392 changed files with 390081 additions and 164 deletions

View File

@@ -0,0 +1,16 @@
#ifndef EXPLORER_H
#define EXPLORER_H
/* This generated file contains includes for project dependencies */
#include "explorer/bake_config.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,24 @@
/*
)
(.)
.|.
| |
_.--| |--._
.-'; ;`-'& ; `&.
\ & ; & &_/
|"""---...---"""|
\ | | | | | | | /
`---.|.|.|.---'
* This file is generated by bake.lang.c for your convenience. Headers of
* dependencies will automatically show up in this file. Include bake_config.h
* in your main project file. Do not edit! */
#ifndef EXPLORER_BAKE_CONFIG_H
#define EXPLORER_BAKE_CONFIG_H
/* Headers of public dependencies */
#include <flecs.h>
#endif

View File

@@ -0,0 +1,10 @@
{
"id": "explorer",
"type": "application",
"value": {
"public": false,
"use": [
"flecs"
]
}
}

View File

@@ -0,0 +1,47 @@
#include <explorer.h>
typedef struct {
double value;
} Mass;
int main(int argc, char *argv[]) {
// Passing in the command line arguments will allow the explorer to display
// the application name.
ecs_world_t *world = ecs_init_w_args(argc, argv);
ECS_IMPORT(world, FlecsUnits);
ECS_IMPORT(world, FlecsMonitor); // Collect statistics periodically
// Mass component
ECS_COMPONENT(world, Mass);
ecs_struct(world, {
.entity = ecs_id(Mass),
.members = {
{ .name = "value", .type = ecs_id(ecs_f64_t), .unit = EcsKiloGrams}
}
});
// Simple hierarchy
ecs_entity_t Sun = ecs_new_entity(world, "Sun");
ecs_set(world, Sun, Mass, {1.988500e31});
ecs_set_scope(world, Sun);
ecs_entity_t Earth = ecs_new_entity(world, "Earth");
ecs_set(world, Earth, Mass, {5.9722e24});
ecs_set_scope(world, Earth);
ecs_entity_t Moon = ecs_new_entity(world, "Moon");
ecs_set(world, Moon, Mass, {7.34767309e22});
// Restore default hierarchy scope to root
ecs_set_scope(world, 0);
// Run application with REST interface. When the application is running,
// navigate to https://flecs.dev/explorer to inspect it!
//
// See docs/RestApi.md#explorer for more information.
return ecs_app_run(world, &(ecs_app_desc_t){
.enable_rest = true
});
}