Properly link flecs library
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"id": "custom_phases",
|
||||
"type": "application",
|
||||
"value": {
|
||||
"use": [
|
||||
"flecs"
|
||||
],
|
||||
"language": "c++",
|
||||
"public": false
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
#include <custom_phases.h>
|
||||
#include <iostream>
|
||||
|
||||
// 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 flecs::Phase tag.
|
||||
|
||||
// Dummy system
|
||||
void Sys(flecs::iter& it) {
|
||||
std::cout << "system " << it.system().name() << "\n";
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
flecs::world ecs(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.
|
||||
flecs::entity Physics = ecs.entity()
|
||||
.add(flecs::Phase)
|
||||
.depends_on(flecs::OnUpdate);
|
||||
|
||||
flecs::entity Collisions = ecs.entity()
|
||||
.add(flecs::Phase)
|
||||
.depends_on(Physics);
|
||||
|
||||
// Create 3 dummy systems.
|
||||
ecs.system("CollisionSystem")
|
||||
.kind(Collisions)
|
||||
.iter(Sys);
|
||||
|
||||
ecs.system("PhysicsSystem")
|
||||
.kind(Physics)
|
||||
.iter(Sys);
|
||||
|
||||
ecs.system("GameSystem")
|
||||
.kind(flecs::OnUpdate)
|
||||
.iter(Sys);
|
||||
|
||||
// Run pipeline
|
||||
ecs.progress();
|
||||
|
||||
// Output
|
||||
// system GameSystem
|
||||
// system PhysicsSystem
|
||||
// system CollisionSystem
|
||||
}
|
||||
Reference in New Issue
Block a user