chore: reorganize source files

isolation_bkp/dynres
Dominik Madarász 2021-07-28 11:49:09 +02:00
parent 2370bd4ea0
commit 420411ae4f
67 changed files with 39 additions and 44 deletions

View File

@ -10,7 +10,7 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR})
if(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_compile_options(/MP /W4 /nologo)
add_compile_options(/W4 /nologo)
endif()
include_directories(code/common code/vendors code/vendors/flecs)

View File

@ -1,42 +1,42 @@
file(GLOB PKT_SRCS ../game/header/packets/*.h ../game/source/packets/*.c)
file(GLOB PKT_SRCS ../game/src/packets/*.h ../game/src/packets/*.c)
add_executable(eco2d
source/platform_raylib.c
source/main.c
src/platform_raylib.c
src/main.c
source/network.c
source/game.c
source/camera.c
source/world_view.c
source/prediction.c
src/network.c
src/game.c
src/camera.c
src/world_view.c
src/prediction.c
source/assets.c
source/compress.c
source/entity.c
source/entity_view.c
source/packet.c
source/player.c
source/signal_handling.c
source/profiler.c
source/debug_ui.c
src/assets.c
src/compress.c
src/entity.c
src/entity_view.c
src/packet.c
src/player.c
src/signal_handling.c
src/profiler.c
src/debug_ui.c
source/utils/options.c
src/utils/options.c
header/network.h
src/network.h
source/world/blocks.c
source/world/perlin.c
source/world/world.c
src/world/blocks.c
src/world/perlin.c
src/world/world.c
source/gen/texgen.c
src/gen/texgen.c
source/world/worldgen/worldgen_test.c
src/world/worldgen/worldgen_test.c
${PKT_SRCS}
)
target_compile_definitions(eco2d PRIVATE CLIENT)
include_directories(header ../modules ../../art/gen)
include_directories(src ../modules ../../art/gen)
target_link_libraries(eco2d raylib cwpack eco2d-modules flecs-bundle)
link_system_libs(eco2d)

View File

@ -1,5 +0,0 @@
#pragma once
#include "system.h"
uint64_t entity_spawn(char *name, uint16_t class_id /* 0 = no streaming */);
void entity_despawn(uint64_t ent_id);

View File

@ -9,16 +9,11 @@
#include "modules/systems.h"
#include "zpl.h"
uint64_t entity_spawn(char *name, uint16_t class_id) {
uint64_t entity_spawn(uint16_t class_id) {
ECS_IMPORT(world_ecs(), Components);
ecs_entity_t e = ecs_new(world_ecs(), 0);
if (!name) {
name = zpl_bprintf("entity_%d", e);
}
ecs_set(world_ecs(), e, EcsName, {.alloc_value = name });
ecs_set(world_ecs(), e, Velocity, {0});
ecs_set(world_ecs(), e, Classify, { .id = class_id });
ecs_add(world_ecs(), e, Walking);

View File

@ -0,0 +1,5 @@
#pragma once
#include "system.h"
uint64_t entity_spawn(uint16_t class_id /* 0 = no streaming */);
void entity_despawn(uint64_t ent_id);

View File

@ -133,7 +133,7 @@ void game_init(game_kind play_mode, uint32_t num_viewers, int32_t seed, uint16_t
}
int8_t game_is_networked() {
return game_mode > 0;
return game_mode != GAMEKIND_SINGLE;
}
void game_shutdown() {

View File

@ -70,7 +70,7 @@ int main(int argc, char** argv) {
{
ECS_IMPORT(world_ecs(), Components);
for (uint32_t i = 0; i < npc_count; i++) {
uint64_t e = entity_spawn(NULL, EKIND_DEMO_NPC);
uint64_t e = entity_spawn(EKIND_DEMO_NPC);
ecs_add(world_ecs(), e, EcsDemoNPC);
Position *pos = ecs_get_mut(world_ecs(), e, Position, NULL);
pos->x=rand() % world_dim();

View File

@ -26,7 +26,7 @@ static Camera2D render_camera;
void platform_init() {
InitWindow(screenWidth, screenHeight, "eco2d - client");
SetWindowState(FLAG_WINDOW_UNDECORATED|FLAG_WINDOW_MAXIMIZED|FLAG_WINDOW_RESIZABLE);
SetTargetFPS(60);
SetTargetFPS(0);
screenWidth = GetScreenWidth();
screenHeight = GetScreenHeight();

View File

@ -13,7 +13,7 @@
#define PLAYER_MAX_HP 100.0f
uint64_t player_spawn(char *name) {
ecs_entity_t e = entity_spawn(NULL, EKIND_PLAYER);
ecs_entity_t e = entity_spawn(EKIND_PLAYER);
if (!name) {
name = zpl_bprintf("player_%d", e);

View File

@ -1,5 +1,5 @@
add_library(eco2d-modules STATIC
source/systems.c
source/components.c
modules/systems.c
modules/components.c
)
include_directories(. ../game/header)
include_directories(. ../game/src)