MoveWalk
parent
50a750ab2d
commit
a906afea7b
|
@ -10,6 +10,7 @@ typedef struct {
|
||||||
ECS_DECLARE_ENTITY(Walking);
|
ECS_DECLARE_ENTITY(Walking);
|
||||||
ECS_DECLARE_ENTITY(Flying);
|
ECS_DECLARE_ENTITY(Flying);
|
||||||
ECS_DECLARE_COMPONENT(Velocity);
|
ECS_DECLARE_COMPONENT(Velocity);
|
||||||
|
ECS_DECLARE_ENTITY(MoveWalk);
|
||||||
} Physics;
|
} Physics;
|
||||||
|
|
||||||
#define PhysicsImportHandles(handles)\
|
#define PhysicsImportHandles(handles)\
|
||||||
|
@ -17,5 +18,6 @@ typedef struct {
|
||||||
ECS_IMPORT_ENTITY(handles, Walking);\
|
ECS_IMPORT_ENTITY(handles, Walking);\
|
||||||
ECS_IMPORT_ENTITY(handles, Flying);\
|
ECS_IMPORT_ENTITY(handles, Flying);\
|
||||||
ECS_IMPORT_COMPONENT(handles, Velocity);\
|
ECS_IMPORT_COMPONENT(handles, Velocity);\
|
||||||
|
ECS_IMPORT_ENTITY(handles, MoveWalk);\
|
||||||
|
|
||||||
void PhysicsImport(ecs_world_t *ecs);
|
void PhysicsImport(ecs_world_t *ecs);
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
#include "modules/physics.h"
|
#include "modules/physics.h"
|
||||||
|
|
||||||
|
void MoveWalk(ecs_iter_t *it) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void PhysicsImport(ecs_world_t *ecs) {
|
void PhysicsImport(ecs_world_t *ecs) {
|
||||||
ECS_MODULE(ecs, Physics);
|
ECS_MODULE(ecs, Physics);
|
||||||
ecs_set_name_prefix(ecs, "Physics");
|
ecs_set_name_prefix(ecs, "Physics");
|
||||||
|
@ -10,8 +14,11 @@ void PhysicsImport(ecs_world_t *ecs) {
|
||||||
|
|
||||||
ECS_COMPONENT(ecs, Velocity);
|
ECS_COMPONENT(ecs, Velocity);
|
||||||
|
|
||||||
|
ECS_SYSTEM(ecs, MoveWalk, EcsOnUpdate, general.Position, Velocity, SWITCH | Movement, CASE | Walking);
|
||||||
|
|
||||||
ECS_SET_TYPE(Movement);
|
ECS_SET_TYPE(Movement);
|
||||||
ECS_SET_ENTITY(Walking);
|
ECS_SET_ENTITY(Walking);
|
||||||
ECS_SET_ENTITY(Flying);
|
ECS_SET_ENTITY(Flying);
|
||||||
ECS_SET_COMPONENT(Velocity);
|
ECS_SET_COMPONENT(Velocity);
|
||||||
|
ECS_SET_ENTITY(MoveWalk);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
#include "librg.h"
|
#include "librg.h"
|
||||||
#include "modules/general.h"
|
#include "modules/general.h"
|
||||||
#include "world/world.h"
|
#include "world/world.h"
|
||||||
|
#include "flecs/flecs.h"
|
||||||
|
#include "flecs/flecs_dash.h"
|
||||||
|
#include "flecs/flecs_systems_civetweb.h"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t *data;
|
uint8_t *data;
|
||||||
|
@ -73,6 +76,14 @@ int32_t world_init(int32_t seed, uint16_t block_size, uint16_t chunk_size, uint1
|
||||||
ecs_set_threads(world.ecs, 4);
|
ecs_set_threads(world.ecs, 4);
|
||||||
ecs_set_target_fps(world.ecs, 60);
|
ecs_set_target_fps(world.ecs, 60);
|
||||||
|
|
||||||
|
/* server dashboard */
|
||||||
|
{
|
||||||
|
ECS_IMPORT(world_ecs(), FlecsDash);
|
||||||
|
ECS_IMPORT(world_ecs(), FlecsSystemsCivetweb);
|
||||||
|
|
||||||
|
ecs_set(world_ecs(), 0, EcsDashServer, {.port = 27001});
|
||||||
|
}
|
||||||
|
|
||||||
world.tracker = librg_world_create();
|
world.tracker = librg_world_create();
|
||||||
|
|
||||||
if (world.tracker == NULL) {
|
if (world.tracker == NULL) {
|
||||||
|
|
Loading…
Reference in New Issue