Properly link flecs library
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
#ifndef CUSTOM_PIPELINE_H
|
||||
#define CUSTOM_PIPELINE_H
|
||||
|
||||
/* This generated file contains includes for project dependencies */
|
||||
#include "custom_pipeline/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_PIPELINE_BAKE_CONFIG_H
|
||||
#define CUSTOM_PIPELINE_BAKE_CONFIG_H
|
||||
|
||||
/* Headers of public dependencies */
|
||||
#include <flecs.h>
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"id": "custom_pipeline",
|
||||
"type": "application",
|
||||
"value": {
|
||||
"use": [
|
||||
"flecs"
|
||||
],
|
||||
"language": "c++",
|
||||
"public": false
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
#include <custom_pipeline.h>
|
||||
#include <iostream>
|
||||
|
||||
// Custom pipelines make it possible for applications to override which systems
|
||||
// are ran by a pipeline and how they are ordered. Pipelines are queries under
|
||||
// the hood, and custom pipelines override the query used for system matching.
|
||||
|
||||
// If you only want to use custom phases in addition or in place of the builtin
|
||||
// phases see the custom_phases and custom_phases_no_builtin examples, as this
|
||||
// does not require using a custom pipeline.
|
||||
|
||||
struct Physics {};
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
flecs::world ecs(argc, argv);
|
||||
|
||||
// Create a pipeline that matches systems with Physics. Note that this
|
||||
// pipeline does not require the use of phases (see custom_phases) or of the
|
||||
// DependsOn relationship.
|
||||
flecs::entity pipeline = ecs.pipeline()
|
||||
.with(flecs::System) // Mandatory, must always match systems
|
||||
.with<Physics>()
|
||||
.build();
|
||||
|
||||
// Configure the world to use the custom pipeline
|
||||
ecs.set_pipeline(pipeline);
|
||||
|
||||
// Create system with Physics tag
|
||||
ecs.system()
|
||||
.kind<Physics>()
|
||||
.iter([](flecs::iter&) {
|
||||
std::cout << "System ran!\n";
|
||||
});
|
||||
|
||||
// Runs the pipeline & system
|
||||
ecs.progress();
|
||||
|
||||
// Output:
|
||||
// System ran!
|
||||
}
|
||||
Reference in New Issue
Block a user