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 CUSTOM_PHASES_H
#define CUSTOM_PHASES_H
/* This generated file contains includes for project dependencies */
#include "custom_phases/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 CUSTOM_PHASES_BAKE_CONFIG_H
#define CUSTOM_PHASES_BAKE_CONFIG_H
/* Headers of public dependencies */
#include <flecs.h>
#endif

View File

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

View File

@@ -0,0 +1,58 @@
#include <custom_phases.h>
#include <stdio.h>
// This application demonstrates how to use custom phases for systems. The
// default pipeline will automatically run systems for custom phases as long as
// they have the EcsPhase tag.
// Dummy system
void Sys(ecs_iter_t *it) {
printf("system %s\n", ecs_get_name(it->world, it->system));
}
int main(int argc, char *argv[]) {
ecs_world_t *ecs = ecs_init_w_args(argc, argv);
// Create two custom phases that branch off of EcsOnUpdate. Note that the
// phases have the Phase tag, which is necessary for the builtin pipeline
// to discover which systems it should run.
ecs_entity_t Physics = ecs_new_w_id(ecs, EcsPhase);
ecs_entity_t Collisions = ecs_new_w_id(ecs, EcsPhase);
ecs_add_pair(ecs, Physics, EcsDependsOn, EcsOnUpdate);
ecs_add_pair(ecs, Collisions, EcsDependsOn, Physics);
// Create 3 dummy systems.
ecs_system(ecs, {
.entity = ecs_entity(ecs, {
.name = "CollisionSystem",
.add = { ecs_dependson(Collisions) }
}),
.callback = Sys
});
ecs_system(ecs, {
.entity = ecs_entity(ecs, {
.name = "PhysicsSystem",
.add = { ecs_dependson(Physics) }
}),
.callback = Sys
});
ecs_system(ecs, {
.entity = ecs_entity(ecs, {
.name = "GameSystem",
.add = { ecs_dependson(EcsOnUpdate) }
}),
.callback = Sys
});
// Run pipeline
ecs_progress(ecs, 0);
return ecs_fini(ecs);
// Output
// system GameSystem
// system PhysicsSystem
// system CollisionSystem
}