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

View File

@@ -0,0 +1,11 @@
{
"id": "startup_system",
"type": "application",
"value": {
"use": [
"flecs"
],
"language": "c++",
"public": false
}
}

View File

@@ -0,0 +1,39 @@
#include <startup_system.h>
#include <iostream>
// Startup systems are systems registered with the EcsOnStart phase, and are
// only ran during the first frame. Just like with regular phases, custom phases
// can depend on the EcsOnStart phase (see custom_phases example). Phases that
// depend on EcsOnStart are also only ran during the first frame.
//
// Other than that, startup systems behave just like regular systems (they can
// match components, can introduce merge points), with as only exception that
// they are guaranteed to always run on the main thread.
int main(int, char *[]) {
flecs::world ecs;
// Startup system
ecs.system("Startup")
.kind(flecs::OnStart)
.iter([](flecs::iter& it) {
std::cout << it.system().name() << "\n";
});
// Regular system
ecs.system("Update")
.iter([](flecs::iter& it) {
std::cout << it.system().name() << "\n";
});
// First frame. This runs both the Startup and Update systems
ecs.progress();
// Second frame. This runs only the Update system
ecs.progress();
// Output
// Startup
// Update
// Update
}