isolation_bkp/dynres
Dominik Madarász 2021-01-23 19:24:52 +01:00
parent a906afea7b
commit 594df6c087
5 changed files with 13 additions and 21 deletions

View File

@ -3,7 +3,10 @@ project(eco2d)
include(cmake/utils.cmake)
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)

View File

@ -7,10 +7,3 @@ function(link_system_libs target_name)
target_link_libraries(${target_name} pthread m dl atomic)
endif()
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()

View File

@ -1,7 +1,14 @@
#include "modules/physics.h"
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) {

View File

@ -75,6 +75,7 @@ int main(int argc, char** argv) {
ECS_IMPORT(world_ecs(), FlecsSystemsCivetweb);
ecs_set(world_ecs(), 0, EcsDashServer, {.port = 27001});
ecs_set_target_fps(world_ecs(), 60);
}
zpl_printf("[INFO] Initializing network...\n");

View File

@ -2,9 +2,6 @@
#include "librg.h"
#include "modules/general.h"
#include "world/world.h"
#include "flecs/flecs.h"
#include "flecs/flecs_dash.h"
#include "flecs/flecs_systems_civetweb.h"
typedef struct {
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();
ecs_set_entity_range(world.ecs, 0, UINT32_MAX);
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});
}
//ecs_set_threads(world.ecs, 4);
world.tracker = librg_world_create();