Properly link flecs library
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
#ifndef MEMBER_RANGES_H
|
||||
#define MEMBER_RANGES_H
|
||||
|
||||
/* This generated file contains includes for project dependencies */
|
||||
#include "member_ranges/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 MEMBER_RANGES_BAKE_CONFIG_H
|
||||
#define MEMBER_RANGES_BAKE_CONFIG_H
|
||||
|
||||
/* Headers of public dependencies */
|
||||
#include <flecs.h>
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"id": "member_ranges",
|
||||
"type": "application",
|
||||
"value": {
|
||||
"use": [
|
||||
"flecs"
|
||||
],
|
||||
"language": "c++",
|
||||
"public": false
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
#include <member_ranges.h>
|
||||
#include <iostream>
|
||||
|
||||
struct CpuUtilization {
|
||||
double value;
|
||||
};
|
||||
|
||||
int main() {
|
||||
flecs::world ecs;
|
||||
|
||||
ecs.component<CpuUtilization>()
|
||||
.member<double>("value")
|
||||
.range(0.0, 100.0) // Specifics values that the member can assume
|
||||
.warning_range(0.0, 60.0) // Values outside this range are considerd a warning
|
||||
.error_range(0.0, 80.0); // Values outside this range are considerd an error
|
||||
|
||||
ecs.entity("MachineA").set<CpuUtilization>({ 50.0 });
|
||||
ecs.entity("MachineB").set<CpuUtilization>({ 75.0 });
|
||||
ecs.entity("MachineC").set<CpuUtilization>({ 90.0 });
|
||||
|
||||
// Open https://www.flecs.dev/explorer?show=query&query=CpuUtilization to
|
||||
// see how ranges affect visualization.
|
||||
ecs.app().enable_rest().run();
|
||||
}
|
||||
Reference in New Issue
Block a user