simplify project structure
parent
d14b8246f5
commit
f1a7c96135
|
@ -48,7 +48,7 @@ typedef struct entity_view {
|
|||
|
||||
ZPL_TABLE_DECLARE(, entity_view_tbl, entity_view_tbl_, entity_view);
|
||||
|
||||
pkt_desc pkt_entity_view_desc[];
|
||||
extern pkt_desc pkt_entity_view_desc[];
|
||||
|
||||
void entity_view_init(entity_view_tbl *map);
|
||||
void entity_view_free(entity_view_tbl *map);
|
||||
|
@ -63,4 +63,4 @@ size_t entity_view_pack_struct(void *data, size_t len, entity_view view);
|
|||
entity_view entity_view_unpack_struct(void *data, size_t len);
|
||||
|
||||
void entity_view_mark_for_removal(entity_view_tbl *map, uint64_t ent_id);
|
||||
void entity_view_mark_for_fadein(entity_view_tbl *map, uint64_t ent_id);
|
||||
void entity_view_mark_for_fadein(entity_view_tbl *map, uint64_t ent_id);
|
||||
|
|
|
@ -17,7 +17,7 @@ world_view *game_world_view_get_active(void);
|
|||
world_view *game_world_view_get(uint16_t idx);
|
||||
void game_world_view_set_active_by_idx(uint16_t idx);
|
||||
void game_world_view_set_active(world_view *view);
|
||||
void game_world_view_cycle_active(uint8_t dir);
|
||||
void game_world_view_cycle_active(int8_t dir);
|
||||
void game_world_view_active_entity_map(void (*map_proc)(uint64_t key, entity_view * value));
|
||||
void game_world_cleanup_entities(void);
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ typedef struct {
|
|||
|
||||
size_t pkt_00_init_encode(pkt_00_init *table);
|
||||
size_t pkt_00_init_send(uint16_t view_id);
|
||||
pkt_desc pkt_00_init_desc[];
|
||||
extern pkt_desc pkt_00_init_desc[];
|
||||
|
||||
PKT_HANDLER_PROC(pkt_00_init_handler);
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ size_t pkt_01_welcome_send(uint64_t peer_id,
|
|||
uint16_t chunk_size,
|
||||
uint16_t world_size);
|
||||
size_t pkt_01_welcome_encode(pkt_01_welcome *table);
|
||||
pkt_desc pkt_01_welcome_desc[];
|
||||
extern pkt_desc pkt_01_welcome_desc[];
|
||||
|
||||
PKT_HANDLER_PROC(pkt_01_welcome_handler);
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ size_t pkt_send_keystate_send(uint16_t view_id,
|
|||
uint8_t use,
|
||||
uint8_t sprint);
|
||||
size_t pkt_send_keystate_encode(pkt_send_keystate *table);
|
||||
pkt_desc pkt_send_keystate_desc[];
|
||||
extern pkt_desc pkt_send_keystate_desc[];
|
||||
|
||||
PKT_HANDLER_PROC(pkt_send_keystate_handler);
|
||||
|
||||
|
|
|
@ -1,35 +1,24 @@
|
|||
include(FindRaylib.cmake)
|
||||
|
||||
populate_pkt_srcs()
|
||||
add_library(client-common STATIC
|
||||
source/network.c
|
||||
source/game.c
|
||||
add_executable(eco2d
|
||||
source/platform_raylib.c
|
||||
source/main.c
|
||||
|
||||
source/network.c
|
||||
source/game.c
|
||||
source/camera.c
|
||||
source/world_view.c
|
||||
source/prediction.c
|
||||
|
||||
source/utils/options.c
|
||||
source/utils/options.c
|
||||
|
||||
header/network.h
|
||||
${PKT_SRCS}
|
||||
header/network.h
|
||||
${PKT_SRCS}
|
||||
)
|
||||
|
||||
add_executable(eco2d-client
|
||||
source/platform_raylib.c
|
||||
source/main.c
|
||||
)
|
||||
|
||||
add_executable(eco2d-cli
|
||||
source/platform_text.c
|
||||
source/main.c
|
||||
)
|
||||
|
||||
target_compile_definitions(client-common PRIVATE CLIENT)
|
||||
set(LIBS client-common cwpack eco2d-common eco2d-modules flecs-bundle)
|
||||
|
||||
target_compile_definitions(eco2d PRIVATE CLIENT)
|
||||
include_directories(header ../modules)
|
||||
target_link_libraries(eco2d-client raylib ${LIBS})
|
||||
target_link_libraries(eco2d-cli ${LIBS})
|
||||
target_link_libraries(eco2d raylib cwpack eco2d-common eco2d-modules flecs-bundle)
|
||||
|
||||
link_system_libs(eco2d-cli)
|
||||
link_system_libs(eco2d-client)
|
||||
link_system_libs(eco2d)
|
||||
|
|
|
@ -77,7 +77,7 @@ world_view *game_world_view_get_active(void) {
|
|||
return active_viewer;
|
||||
}
|
||||
|
||||
void game_world_view_cycle_active(uint8_t dir) {
|
||||
void game_world_view_cycle_active(int8_t dir) {
|
||||
uint16_t idx = (uint16_t)(active_viewer - world_viewers);
|
||||
game_world_view_set_active_by_idx((idx+dir)%zpl_buffer_count(world_viewers));
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ float target_zoom = 4.0f;
|
|||
static Camera2D render_camera;
|
||||
|
||||
void DrawTextEco(const char *text, float posX, float posY, int fontSize, Color color, float spacing) {
|
||||
#if 1
|
||||
// Check if default font has been loaded
|
||||
if (GetFontDefault().texture.id != 0) {
|
||||
Vector2 position = { (float)posX , (float)posY };
|
||||
|
@ -24,9 +25,11 @@ void DrawTextEco(const char *text, float posX, float posY, int fontSize, Color c
|
|||
|
||||
DrawTextEx(GetFontDefault(), text, position, (float)fontSize , (float)new_spacing , color);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int MeasureTextEco(const char *text, int fontSize, float spacing) {
|
||||
#if 1
|
||||
Vector2 vec = { 0.0f, 0.0f };
|
||||
|
||||
// Check if default font has been loaded
|
||||
|
@ -38,6 +41,9 @@ int MeasureTextEco(const char *text, int fontSize, float spacing) {
|
|||
}
|
||||
|
||||
return (int)vec.x;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
void DrawCircleEco(float centerX, float centerY, float radius, Color color)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue