disable vsync again

efd/v1
Dominik Madarász 2022-10-17 18:28:18 +02:00
parent 0d58d5f315
commit 3f6235e8a4
3 changed files with 53 additions and 53 deletions

View File

@ -3,17 +3,17 @@
#include "models/assets.h"
#define ecs_get_mut_ex(world, entity, T) \
(ECS_CAST(T*, world_component_cached(world, entity, ecs_id(T))))
(ECS_CAST(T*, world_component_cached(world, entity, ecs_id(T))))
#define ecs_get_if(world, entity, T) \
(world_entity_valid(entity) ? ecs_get(world, entity, T) : NULL)
(world_entity_valid(entity) ? ecs_get(world, entity, T) : NULL)
#define ecs_get_mut_if_ex(world, entity, component) \
(ecs_get_if(world, entity, component) ? ecs_get_mut_ex(world, entity, component) : NULL)
(ecs_get_if(world, entity, component) ? ecs_get_mut_ex(world, entity, component) : NULL)
#ifndef ecs_get_mut_if
#define ecs_get_mut_if(world, entity, component)\
(ecs_get(world, entity, component) ? ecs_get_mut(world, entity, component) : NULL)
(ecs_get(world, entity, component) ? ecs_get_mut(world, entity, component) : NULL)
#endif
#define ITEMS_INVENTORY_SIZE 9

View File

@ -6,11 +6,11 @@
#ifdef ARCH_IMPL
EM_JS(int, canvas_get_width, (), {
return canvas.width;
});
});
EM_JS(int, canvas_get_height, (), {
return canvas.height;
});
});
void UpdateDrawFrame(void) {
reset_cached_time();
@ -43,7 +43,7 @@ void reset_cached_time(void) {
}
void game_run(void) {
#if !defined(PLATFORM_WEB)
#if !defined(PLATFORM_WEB)
while (game_is_running()) {
reset_cached_time();
profile (PROF_MAIN_LOOP) {
@ -54,29 +54,29 @@ void game_run(void) {
profiler_collate();
}
#else
#else
emscripten_set_main_loop(UpdateDrawFrame, 0, 1);
#endif
#endif
}
void platform_create_window(const char *title) {
SetTraceLogLevel(LOG_ERROR);
#if defined(PLATFORM_WEB)
#if defined(PLATFORM_WEB)
screenWidth = (uint16_t)canvas_get_width();
screenHeight = (uint16_t)canvas_get_height();
#endif
#endif
InitWindow(screenWidth, screenHeight, title);
uint32_t flags = /*FLAG_WINDOW_UNDECORATED|*/FLAG_WINDOW_MAXIMIZED|FLAG_WINDOW_RESIZABLE|FLAG_MSAA_4X_HINT;
#if !defined(PLATFORM_WEB)
flags |= FLAG_VSYNC_HINT;
#endif
#if !defined(PLATFORM_WEB)
//flags |= FLAG_VSYNC_HINT;
#endif
SetWindowState(flags);
#if !defined(PLATFORM_WEB)
#if !defined(PLATFORM_WEB)
screenWidth = (uint16_t)GetScreenWidth();
screenHeight = (uint16_t)GetScreenHeight();
#endif
#endif
// ToggleFullscreen();
// SetTargetFPS(60.0);
}