move all static data to lists folder

isolation
Dominik Madarász 2022-09-29 20:11:47 +02:00
parent 7f098734f5
commit 3f96594fdb
22 changed files with 43 additions and 41 deletions

View File

@ -8,6 +8,7 @@ add_library(eco2d-foundation STATIC
src/platform/signal_handling.c
src/platform/profiler.c
src/models/assets.c
src/models/components.c
src/models/items.c
src/models/entity.c
@ -36,8 +37,6 @@ add_library(eco2d-foundation STATIC
src/world/entity_view.c
src/world/prediction.c
src/gen/assets.c
src/systems/systems.c
${PKT_SRCS}

View File

@ -2,7 +2,7 @@
#include "platform/system.h"
#include "raylib.h"
#include "world/blocks.h"
#include "gen/assets.h"
#include "models/assets.h"
Texture2D texgen_build_anim(asset_id id, int64_t counter);
Texture2D texgen_build_sprite(asset_id id);

View File

@ -1,5 +1,4 @@
#pragma once
#include "platform/system.h"
#define ASSET_INVALID 0xFF
@ -45,25 +44,3 @@ typedef enum {
MAX_ASSETS = 1024,
} asset_id;
typedef enum {
AKIND_TEXTURE,
AKIND_ANIM,
AKIND_SOUND,
FORCE_AKIND_UINT8 = UINT8_MAX
} asset_kind;
int32_t assets_setup(void);
int32_t assets_frame(void);
void assets_destroy(void);
uint16_t assets_find(asset_id id);
asset_kind assets_get_kind(uint16_t id);
void *assets_get_snd(uint16_t id);
void *assets_get_tex(uint16_t id);
// NOTE(zaklaus): client only
#define ASSET_SRC_RECT() ((Rectangle){0, 0, 64, 64})
#define ASSET_DST_RECT(x,y) ((Rectangle){x, y, 64, 64})

View File

@ -1,4 +1,4 @@
#include "gen/assets.h"
#include "models/assets.h"
#define ASSET_ENTRY(asset, asset_kind)\
{\

View File

@ -4,7 +4,7 @@
// use your favorite editor to quickly navigate between various files.
// 1) Register a new Asset ID
#include "gen/assets.h"
#include "models/assets.h"
// 2) Add the asset to the asset list
#include "assets_list.c"

View File

@ -1,4 +1,4 @@
#include "gen/assets.h"
#include "models/assets.h"
#include "raylib.h"
#include "gen/texgen.h"
@ -16,7 +16,7 @@ typedef struct {
// NOTE(zaklaus): metadata
} asset;
#include "assets_list.c"
#include "lists/assets_list.c"
#define ASSET_FRAME_RENDER_MS (1.0/5.0)
#define ASSET_FRAME_SKIP 4

View File

@ -0,0 +1,26 @@
#pragma once
#include "platform/system.h"
#include "lists/assets_ids.h"
typedef enum {
AKIND_TEXTURE,
AKIND_ANIM,
AKIND_SOUND,
FORCE_AKIND_UINT8 = UINT8_MAX
} asset_kind;
int32_t assets_setup(void);
int32_t assets_frame(void);
void assets_destroy(void);
uint16_t assets_find(asset_id id);
asset_kind assets_get_kind(uint16_t id);
void *assets_get_snd(uint16_t id);
void *assets_get_tex(uint16_t id);
// NOTE(zaklaus): client only
#define ASSET_SRC_RECT() ((Rectangle){0, 0, 64, 64})
#define ASSET_DST_RECT(x,y) ((Rectangle){x, y, 64, 64})

View File

@ -1,6 +1,6 @@
#pragma once
#include "flecs.h"
#include "gen/assets.h"
#include "models/assets.h"
#define ecs_get_mut_ex(world, entity, T) \
(ECS_CAST(T*, world_component_cached(world, entity, ecs_id(T))))

View File

@ -1,6 +1,6 @@
#pragma once
#include "platform/system.h"
#include "gen/assets.h"
#include "models/assets.h"
uint64_t device_spawn(asset_id id);
void device_despawn(uint64_t ent_id);

View File

@ -9,7 +9,7 @@
#include "zpl.h"
// NOTE(zaklaus): bring in entity spawnlist
#include "entity_spawnlist.c"
#include "lists/entity_spawnlist.c"
uint64_t entity_spawn(uint16_t class_id) {
ecs_entity_t e = ecs_new(world_ecs(), 0);

View File

@ -8,7 +8,7 @@
#include "zpl.h"
#include "items_list.c"
#include "lists/items_list.c"
#define ITEMS_COUNT (sizeof(items)/sizeof(item_desc))
static inline item_id item_resolve_proxy(item_id id) {

View File

@ -1,6 +1,6 @@
#pragma once
#include "platform/system.h"
#include "gen/assets.h"
#include "models/assets.h"
#include "world/blocks.h"
#include "models/components.h"

View File

@ -3,7 +3,7 @@
#include "platform/system.h"
#include "raylib.h"
#include "world/blocks.h"
#include "gen/assets.h"
#include "models/assets.h"
#define RAYLIB_NEW_RLGL
#include "rlgl.h"

View File

@ -34,7 +34,7 @@ typedef struct {
block_id slot;
} block;
#include "blocks_list.c"
#include "lists/blocks_list.c"
int32_t blocks_setup(void) {
for (block_id i=0; i<BLOCKS_COUNT; i++) {

View File

@ -1,6 +1,6 @@
#pragma once
#include "platform/system.h"
#include "gen/assets.h"
#include "models/assets.h"
typedef enum {
BLOCK_FLAG_COLLISION = (1 << 1),

View File

@ -1,6 +1,6 @@
#pragma once
#include "platform/system.h"
#include "gen/assets.h"
#include "models/assets.h"
#include "models/items.h"
#define ZPL_PICO

View File

@ -8,7 +8,7 @@
#include "core/camera.h"
#include "math.h"
#include "world/blocks.h"
#include "gen/assets.h"
#include "models/assets.h"
#include "platform/profiler.h"
#include "debug/debug_ui.h"
#include "utils/raylib_helpers.h"

View File

@ -8,7 +8,7 @@
#include "core/camera.h"
#include "math.h"
#include "world/blocks.h"
#include "gen/assets.h"
#include "models/assets.h"
#include "platform/profiler.h"
#include "debug/debug_ui.h"
#include "debug/debug_draw.h"