Present now dispatches through a function pointer chosen at init and re-chosen by two new runtime setters: real vsync if requested and the driver grants it, else a manual sleep-based cap (auto-detects display refresh rate, falls back to 60fps if that can't be queried), else fully uncapped. skele_video_using_vsync() reports what was actually granted; skele_video_set_vsync()/skele_video_set_max_fps() let a game change either live without tearing down the renderer/GL context.
54 lines
1.3 KiB
C
54 lines
1.3 KiB
C
#ifndef SKELE_VIDEO_H
|
|
#define SKELE_VIDEO_H
|
|
|
|
#include <stdint.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#define SKELE_VIDEO_FULLSCREEN 0x01
|
|
#define SKELE_VIDEO_BORDERLESS 0x02
|
|
#define SKELE_VIDEO_RESIZABLE 0x04
|
|
#define SKELE_VIDEO_HIGHDPI 0x08
|
|
#define SKELE_VIDEO_FULLSCREEN_EXCLUSIVE 0x10
|
|
#define SKELE_VIDEO_VSYNC 0x20
|
|
|
|
#define SKELE_DEFAULT_RENDER_WIDTH 320
|
|
#define SKELE_DEFAULT_RENDER_HEIGHT 200
|
|
|
|
#define SKELE_VIDEO_FPS_UNCAPPED UINT16_MAX
|
|
#define SKELE_VIDEO_FPS_FALLBACK 60
|
|
|
|
typedef enum {
|
|
SKELE_FULLSCREEN_BORDERLESS,
|
|
SKELE_FULLSCREEN_EXCLUSIVE
|
|
} skele_fullscreen_kind_t;
|
|
|
|
typedef struct {
|
|
uint16_t render_width;
|
|
uint16_t render_height;
|
|
uint16_t window_width;
|
|
uint16_t window_height;
|
|
uint16_t max_fps;
|
|
uint8_t flags;
|
|
} skele_video_config_t;
|
|
|
|
uint8_t skele_video_init(skele_video_config_t cfg);
|
|
void skele_video_shutdown(void);
|
|
void skele_video_present(void);
|
|
uint8_t skele_video_using_vsync(void);
|
|
void skele_video_set_vsync(uint8_t enabled);
|
|
void skele_video_set_max_fps(uint16_t max_fps);
|
|
void skele_video_set_title(const char *title);
|
|
void skele_video_toggle_fullscreen(void);
|
|
void skele_video_set_fullscreen_kind(skele_fullscreen_kind_t kind);
|
|
void skele_video_cycle_scale(void);
|
|
void skele_video_set_mouse_grab(uint8_t grab);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* SKELE_VIDEO_H */
|