code: more fixes for mac

isolation_bkp/dynres
Vladyslav Hrytsenko 2021-05-10 10:10:26 +03:00
parent 7df3155f4f
commit f8a856b05d
6 changed files with 16 additions and 5 deletions

View File

@ -100,7 +100,7 @@ void flecs_dash_init() {
ECS_IMPORT(world_ecs(), FlecsSystemsCivetweb);
ecs_set(world_ecs(), 0, EcsDashServer, {.port = 27001});
ecs_set_target_fps(world_ecs(), 60);
// ecs_set_target_fps(world_ecs(), 60);
}
void game_init(int8_t play_mode, uint32_t num_viewers, int32_t seed, uint16_t block_size, uint16_t chunk_size, uint16_t chunk_amount, int8_t is_dash_enabled) {
@ -180,4 +180,4 @@ void game_world_cleanup_entities(void) {
}
}
}

View File

@ -29,7 +29,7 @@ int main(int argc, char** argv)
zpl_opts_add(&opts, "v", "viewer-only", "run viewer-only client", ZPL_OPTS_FLAG);
zpl_opts_add(&opts, "c", "viewer-count", "number of viewers (detachable clients)", ZPL_OPTS_INT);
zpl_opts_add(&opts, "p", "preview-map", "draw world preview", ZPL_OPTS_FLAG);
zpl_opts_add(&opts, "dd", "disable-dash", "disables flecs dash", ZPL_OPTS_FLAG);
zpl_opts_add(&opts, "ed", "enable-dash", "enables flecs dash", ZPL_OPTS_FLAG);
zpl_opts_add(&opts, "s", "seed", "world seed", ZPL_OPTS_INT);
zpl_opts_add(&opts, "r", "random-seed", "generate random world seed", ZPL_OPTS_FLAG);
zpl_opts_add(&opts, "bs", "block-size", "amount of units within a block (single axis)", ZPL_OPTS_INT);
@ -46,7 +46,7 @@ int main(int argc, char** argv)
}
int8_t is_viewer_only = zpl_opts_has_arg(&opts, "viewer-only");
int8_t is_dash_enabled = !zpl_opts_has_arg(&opts, "disable-dash");
int8_t is_dash_enabled = zpl_opts_has_arg(&opts, "enable-dash");
int32_t seed = zpl_opts_integer(&opts, "seed", DEFAULT_WORLD_SEED);
uint16_t num_viewers = zpl_opts_integer(&opts, "viewer-count", 1);
uint16_t block_size = zpl_opts_integer(&opts, "block-size", DEFAULT_BLOCK_SIZE);

View File

@ -248,6 +248,10 @@ void lerp_entity_positions(uint64_t key, entity_view *data) {
}
}
float platform_frametime() {
return GetFrameTime();
}
void do_entity_fadeinout(uint64_t key, entity_view * data) {
switch (data->tran_effect) {
case ETRAN_FADEIN: {

View File

@ -21,6 +21,10 @@ uint8_t platform_is_running() {
return is_running;
}
float platform_frametime() {
return 1.0f;
}
void platform_render() {
zpl_printf("o");
zpl_sleep_ms(1000);

View File

@ -3,6 +3,7 @@
void platform_init();
void platform_shutdown();
float platform_frametime();
uint8_t platform_is_running();
void platform_input();

View File

@ -5,6 +5,7 @@
#include "modules/physics.h"
#include "world/world.h"
#include "entity_view.h"
#include "platform.h"
#include "packets/pkt_send_librg_update.h"
@ -206,8 +207,9 @@ static void world_tracker_update(uint8_t ticker, uint32_t freq, uint8_t radius)
}
}
int32_t world_update() {
ecs_progress(world.ecs, 0);
ecs_progress(world.ecs, platform_frametime());
world_tracker_update(0, WORLD_TRACKER_UPDATE_FAST_MS, 2);
world_tracker_update(1, WORLD_TRACKER_UPDATE_NORMAL_MS, 4);