disable vsync again
parent
0d58d5f315
commit
3f6235e8a4
|
@ -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
|
||||
|
|
|
@ -5,12 +5,12 @@
|
|||
#include <emscripten.h>
|
||||
#ifdef ARCH_IMPL
|
||||
EM_JS(int, canvas_get_width, (), {
|
||||
return canvas.width;
|
||||
});
|
||||
return canvas.width;
|
||||
});
|
||||
|
||||
EM_JS(int, canvas_get_height, (), {
|
||||
return canvas.height;
|
||||
});
|
||||
return canvas.height;
|
||||
});
|
||||
|
||||
void UpdateDrawFrame(void) {
|
||||
reset_cached_time();
|
||||
|
@ -43,42 +43,42 @@ void reset_cached_time(void) {
|
|||
}
|
||||
|
||||
void game_run(void) {
|
||||
#if !defined(PLATFORM_WEB)
|
||||
while (game_is_running()) {
|
||||
reset_cached_time();
|
||||
profile (PROF_MAIN_LOOP) {
|
||||
game_input();
|
||||
game_update();
|
||||
game_render();
|
||||
}
|
||||
|
||||
profiler_collate();
|
||||
#if !defined(PLATFORM_WEB)
|
||||
while (game_is_running()) {
|
||||
reset_cached_time();
|
||||
profile (PROF_MAIN_LOOP) {
|
||||
game_input();
|
||||
game_update();
|
||||
game_render();
|
||||
}
|
||||
#else
|
||||
emscripten_set_main_loop(UpdateDrawFrame, 0, 1);
|
||||
#endif
|
||||
|
||||
profiler_collate();
|
||||
}
|
||||
#else
|
||||
emscripten_set_main_loop(UpdateDrawFrame, 0, 1);
|
||||
#endif
|
||||
}
|
||||
void platform_create_window(const char *title) {
|
||||
SetTraceLogLevel(LOG_ERROR);
|
||||
|
||||
#if defined(PLATFORM_WEB)
|
||||
screenWidth = (uint16_t)canvas_get_width();
|
||||
screenHeight = (uint16_t)canvas_get_height();
|
||||
#endif
|
||||
#if defined(PLATFORM_WEB)
|
||||
screenWidth = (uint16_t)canvas_get_width();
|
||||
screenHeight = (uint16_t)canvas_get_height();
|
||||
#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
|
||||
SetWindowState(flags);
|
||||
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
|
||||
SetWindowState(flags);
|
||||
|
||||
#if !defined(PLATFORM_WEB)
|
||||
screenWidth = (uint16_t)GetScreenWidth();
|
||||
screenHeight = (uint16_t)GetScreenHeight();
|
||||
#endif
|
||||
// ToggleFullscreen();
|
||||
// SetTargetFPS(60.0);
|
||||
#if !defined(PLATFORM_WEB)
|
||||
screenWidth = (uint16_t)GetScreenWidth();
|
||||
screenHeight = (uint16_t)GetScreenHeight();
|
||||
#endif
|
||||
// ToggleFullscreen();
|
||||
// SetTargetFPS(60.0);
|
||||
}
|
||||
|
||||
void platform_resize_window() {
|
||||
|
|
Loading…
Reference in New Issue