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);
|
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_init(entity_view_tbl *map);
|
||||||
void entity_view_free(entity_view_tbl *map);
|
void entity_view_free(entity_view_tbl *map);
|
||||||
|
|
|
@ -17,7 +17,7 @@ world_view *game_world_view_get_active(void);
|
||||||
world_view *game_world_view_get(uint16_t idx);
|
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_by_idx(uint16_t idx);
|
||||||
void game_world_view_set_active(world_view *view);
|
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_view_active_entity_map(void (*map_proc)(uint64_t key, entity_view * value));
|
||||||
void game_world_cleanup_entities(void);
|
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_encode(pkt_00_init *table);
|
||||||
size_t pkt_00_init_send(uint16_t view_id);
|
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);
|
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 chunk_size,
|
||||||
uint16_t world_size);
|
uint16_t world_size);
|
||||||
size_t pkt_01_welcome_encode(pkt_01_welcome *table);
|
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);
|
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 use,
|
||||||
uint8_t sprint);
|
uint8_t sprint);
|
||||||
size_t pkt_send_keystate_encode(pkt_send_keystate *table);
|
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);
|
PKT_HANDLER_PROC(pkt_send_keystate_handler);
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
include(FindRaylib.cmake)
|
include(FindRaylib.cmake)
|
||||||
|
|
||||||
populate_pkt_srcs()
|
populate_pkt_srcs()
|
||||||
add_library(client-common STATIC
|
add_executable(eco2d
|
||||||
|
source/platform_raylib.c
|
||||||
|
source/main.c
|
||||||
|
|
||||||
source/network.c
|
source/network.c
|
||||||
source/game.c
|
source/game.c
|
||||||
source/camera.c
|
source/camera.c
|
||||||
|
@ -14,22 +17,8 @@ add_library(client-common STATIC
|
||||||
${PKT_SRCS}
|
${PKT_SRCS}
|
||||||
)
|
)
|
||||||
|
|
||||||
add_executable(eco2d-client
|
target_compile_definitions(eco2d PRIVATE 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)
|
|
||||||
|
|
||||||
include_directories(header ../modules)
|
include_directories(header ../modules)
|
||||||
target_link_libraries(eco2d-client raylib ${LIBS})
|
target_link_libraries(eco2d raylib cwpack eco2d-common eco2d-modules flecs-bundle)
|
||||||
target_link_libraries(eco2d-cli ${LIBS})
|
|
||||||
|
|
||||||
link_system_libs(eco2d-cli)
|
link_system_libs(eco2d)
|
||||||
link_system_libs(eco2d-client)
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ world_view *game_world_view_get_active(void) {
|
||||||
return active_viewer;
|
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);
|
uint16_t idx = (uint16_t)(active_viewer - world_viewers);
|
||||||
game_world_view_set_active_by_idx((idx+dir)%zpl_buffer_count(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;
|
static Camera2D render_camera;
|
||||||
|
|
||||||
void DrawTextEco(const char *text, float posX, float posY, int fontSize, Color color, float spacing) {
|
void DrawTextEco(const char *text, float posX, float posY, int fontSize, Color color, float spacing) {
|
||||||
|
#if 1
|
||||||
// Check if default font has been loaded
|
// Check if default font has been loaded
|
||||||
if (GetFontDefault().texture.id != 0) {
|
if (GetFontDefault().texture.id != 0) {
|
||||||
Vector2 position = { (float)posX , (float)posY };
|
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);
|
DrawTextEx(GetFontDefault(), text, position, (float)fontSize , (float)new_spacing , color);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int MeasureTextEco(const char *text, int fontSize, float spacing) {
|
int MeasureTextEco(const char *text, int fontSize, float spacing) {
|
||||||
|
#if 1
|
||||||
Vector2 vec = { 0.0f, 0.0f };
|
Vector2 vec = { 0.0f, 0.0f };
|
||||||
|
|
||||||
// Check if default font has been loaded
|
// Check if default font has been loaded
|
||||||
|
@ -38,6 +41,9 @@ int MeasureTextEco(const char *text, int fontSize, float spacing) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (int)vec.x;
|
return (int)vec.x;
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void DrawCircleEco(float centerX, float centerY, float radius, Color color)
|
void DrawCircleEco(float centerX, float centerY, float radius, Color color)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue