Properly link flecs library
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"id": "startup_system",
|
||||
"type": "application",
|
||||
"value": {
|
||||
"use": [
|
||||
"flecs"
|
||||
],
|
||||
"public": false
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
#include <startup_system.h>
|
||||
#include <stdio.h>
|
||||
|
||||
// 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.
|
||||
|
||||
void Startup(ecs_iter_t *it) {
|
||||
printf("%s\n", ecs_get_name(it->world, it->system));
|
||||
}
|
||||
|
||||
void Update(ecs_iter_t *it) {
|
||||
printf("%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);
|
||||
|
||||
// Startup system
|
||||
ECS_SYSTEM(ecs, Startup, EcsOnStart, 0);
|
||||
|
||||
// Regular system
|
||||
ECS_SYSTEM(ecs, Update, EcsOnUpdate, 0);
|
||||
|
||||
// First frame. This runs both the Startup and Update systems
|
||||
ecs_progress(ecs, 0.0f);
|
||||
|
||||
// Second frame. This runs only the Update system
|
||||
ecs_progress(ecs, 0.0f);
|
||||
|
||||
return ecs_fini(ecs);
|
||||
|
||||
// Output
|
||||
// Startup
|
||||
// Update
|
||||
// Update
|
||||
}
|
||||
Reference in New Issue
Block a user