fixes
parent
a906afea7b
commit
594df6c087
|
@ -3,7 +3,10 @@ project(eco2d)
|
||||||
include(cmake/utils.cmake)
|
include(cmake/utils.cmake)
|
||||||
|
|
||||||
set(CMAKE_C_STANDARD 11)
|
set(CMAKE_C_STANDARD 11)
|
||||||
setup_build_dirs()
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/)
|
||||||
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/)
|
||||||
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR})
|
||||||
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR})
|
||||||
|
|
||||||
include_directories(code/common code/vendors code/vendors/flecs)
|
include_directories(code/common code/vendors code/vendors/flecs)
|
||||||
|
|
||||||
|
|
|
@ -7,10 +7,3 @@ function(link_system_libs target_name)
|
||||||
target_link_libraries(${target_name} pthread m dl atomic)
|
target_link_libraries(${target_name} pthread m dl atomic)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function(setup_build_dirs)
|
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/)
|
|
||||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/)
|
|
||||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR})
|
|
||||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR})
|
|
||||||
endfunction()
|
|
||||||
|
|
|
@ -1,7 +1,14 @@
|
||||||
#include "modules/physics.h"
|
#include "modules/physics.h"
|
||||||
|
|
||||||
void MoveWalk(ecs_iter_t *it) {
|
void MoveWalk(ecs_iter_t *it) {
|
||||||
|
Position *p = ecs_column(it, Position, 1);
|
||||||
|
Velocity *v = ecs_column(it, Velocity, 2);
|
||||||
|
|
||||||
|
for (int i = 0; i < it->count; i++) {
|
||||||
|
// TODO: handle collisions
|
||||||
|
p[i].x += v[i].x * it->delta_time;
|
||||||
|
p[i].y += v[i].y * it->delta_time;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhysicsImport(ecs_world_t *ecs) {
|
void PhysicsImport(ecs_world_t *ecs) {
|
||||||
|
|
|
@ -75,6 +75,7 @@ int main(int argc, char** argv) {
|
||||||
ECS_IMPORT(world_ecs(), FlecsSystemsCivetweb);
|
ECS_IMPORT(world_ecs(), FlecsSystemsCivetweb);
|
||||||
|
|
||||||
ecs_set(world_ecs(), 0, EcsDashServer, {.port = 27001});
|
ecs_set(world_ecs(), 0, EcsDashServer, {.port = 27001});
|
||||||
|
ecs_set_target_fps(world_ecs(), 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
zpl_printf("[INFO] Initializing network...\n");
|
zpl_printf("[INFO] Initializing network...\n");
|
||||||
|
|
|
@ -2,9 +2,6 @@
|
||||||
#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,16 +70,7 @@ int32_t world_init(int32_t seed, uint16_t block_size, uint16_t chunk_size, uint1
|
||||||
|
|
||||||
world.ecs = ecs_init();
|
world.ecs = ecs_init();
|
||||||
ecs_set_entity_range(world.ecs, 0, UINT32_MAX);
|
ecs_set_entity_range(world.ecs, 0, UINT32_MAX);
|
||||||
ecs_set_threads(world.ecs, 4);
|
//ecs_set_threads(world.ecs, 4);
|
||||||
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();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue