Properly link flecs library
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
#ifndef DELTA_TIME_H
|
||||
#define DELTA_TIME_H
|
||||
|
||||
/* This generated file contains includes for project dependencies */
|
||||
#include "delta_time/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 DELTA_TIME_BAKE_CONFIG_H
|
||||
#define DELTA_TIME_BAKE_CONFIG_H
|
||||
|
||||
/* Headers of public dependencies */
|
||||
#include <flecs.h>
|
||||
|
||||
#endif
|
||||
|
||||
12
engine/libs/flecs/examples/c/systems/delta_time/project.json
Normal file
12
engine/libs/flecs/examples/c/systems/delta_time/project.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"id": "delta_time",
|
||||
"type": "application",
|
||||
"value": {
|
||||
"author": "Jane Doe",
|
||||
"description": "A simple hello world flecs application",
|
||||
"use": [
|
||||
"flecs"
|
||||
],
|
||||
"public": false
|
||||
}
|
||||
}
|
||||
31
engine/libs/flecs/examples/c/systems/delta_time/src/main.c
Normal file
31
engine/libs/flecs/examples/c/systems/delta_time/src/main.c
Normal file
@@ -0,0 +1,31 @@
|
||||
#include <delta_time.h>
|
||||
#include <stdio.h>
|
||||
|
||||
void PrintDeltaTime(ecs_iter_t *it) {
|
||||
// Print delta_time. The same value is passed to all systems.
|
||||
printf("delta_time: %f\n", (double)it->delta_time);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
ecs_world_t *ecs = ecs_init_w_args(argc, argv);
|
||||
|
||||
// Create system that prints delta_time. This system doesn't query for any
|
||||
// components which means it won't match any entities, but will still be ran
|
||||
// once for each call to ecs_progress.
|
||||
ECS_SYSTEM(ecs, PrintDeltaTime, EcsOnUpdate, 0);
|
||||
|
||||
// Call progress with 0.0f for the delta_time parameter. This will cause
|
||||
// ecs_progress to measure the time passed since the last frame. The
|
||||
// delta_time of the first frame is a best guess (16ms).
|
||||
ecs_progress(ecs, 0.0f);
|
||||
|
||||
// The following calls should print a delta_time of approximately 100ms
|
||||
|
||||
ecs_os_sleep(0, 100 * 1000 * 1000);
|
||||
ecs_progress(ecs, 0.0f);
|
||||
|
||||
ecs_os_sleep(0, 100 * 1000 * 1000);
|
||||
ecs_progress(ecs, 0.0f);
|
||||
|
||||
return ecs_fini(ecs);
|
||||
}
|
||||
Reference in New Issue
Block a user