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" #include "models/assets.h"
#define ecs_get_mut_ex(world, entity, T) \ #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) \ #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) \ #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 #ifndef ecs_get_mut_if
#define ecs_get_mut_if(world, entity, component)\ #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 #endif
#define ITEMS_INVENTORY_SIZE 9 #define ITEMS_INVENTORY_SIZE 9

View File

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