Properly link flecs library
This commit is contained in:
16
engine/libs/flecs/examples/cpp/explorer/include/explorer.h
Normal file
16
engine/libs/flecs/examples/cpp/explorer/include/explorer.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#ifndef EXPLORER_H
|
||||
#define EXPLORER_H
|
||||
|
||||
/* This generated file contains includes for project dependencies */
|
||||
#include "explorer/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 EXPLORER_BAKE_CONFIG_H
|
||||
#define EXPLORER_BAKE_CONFIG_H
|
||||
|
||||
/* Headers of public dependencies */
|
||||
#include <flecs.h>
|
||||
|
||||
#endif
|
||||
|
||||
11
engine/libs/flecs/examples/cpp/explorer/project.json
Normal file
11
engine/libs/flecs/examples/cpp/explorer/project.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"id": "explorer",
|
||||
"type": "application",
|
||||
"value": {
|
||||
"public": false,
|
||||
"use": [
|
||||
"flecs"
|
||||
],
|
||||
"language": "c++"
|
||||
}
|
||||
}
|
||||
37
engine/libs/flecs/examples/cpp/explorer/src/main.cpp
Normal file
37
engine/libs/flecs/examples/cpp/explorer/src/main.cpp
Normal file
@@ -0,0 +1,37 @@
|
||||
#include <explorer.h>
|
||||
#include <iostream>
|
||||
|
||||
using mass = flecs::units::mass;
|
||||
|
||||
struct Mass {
|
||||
double value;
|
||||
};
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
// Passing in the command line arguments will allow the explorer to display
|
||||
// the application name.
|
||||
flecs::world world(argc, argv);
|
||||
|
||||
world.import<flecs::units>();
|
||||
world.import<flecs::monitor>(); // Collect statistics periodically
|
||||
|
||||
// Mass component
|
||||
world.component<Mass>()
|
||||
.member<double, mass::KiloGrams>("value");
|
||||
|
||||
// Simple hierarchy
|
||||
flecs::entity Sun = world.entity("Sun")
|
||||
.set<Mass>({1.988500e31});
|
||||
|
||||
flecs::entity Earth = world.scope(Sun).entity("Earth")
|
||||
.set<Mass>({5.9722e24});
|
||||
|
||||
world.scope(Earth).entity("Moon")
|
||||
.set<Mass>({7.34767309e22});
|
||||
|
||||
// Run application with REST interface. When the application is running,
|
||||
// navigate to https://flecs.dev/explorer to inspect it!
|
||||
//
|
||||
// See docs/RestApi.md#explorer for more information.
|
||||
return world.app().enable_rest().run();
|
||||
}
|
||||
Reference in New Issue
Block a user