Platform layer module


Coordinate system - +ve x - left to right
- +ve y - bottom to top
- Relative to window

TODO(bill): Proper documentation for this with code examples

Window Support - Complete
OS X Support (Not ported yet) - Missing:
* Software framebuffer
* (show|hide) window
* show_cursor
* toggle (fullscreen|borderless)
* set window position
* Clipboard
* GameControllers
Linux Support - None
Other OS Support - None

Ported from


struct zpl_game_controller
struct zpl_platform
struct zpl_video_mode


using zplKeyType = enum zplKeyType
using zplKeyState = u8
using zplKeyStateFlag = enum zplKeyStateFlag
using zplMouseButtonType = enum zplMouseButtonType
using zplControllerAxisType = enum zplControllerAxisType
using zplControllerButtonType = enum zplControllerButtonType
using zpl_game_controller = struct zpl_game_controller
using zplWindowFlag = enum zplWindowFlag
using zplRendererType = enum zplRendererType
using zpl_platform = struct zpl_platform
using zpl_video_mode = struct zpl_video_mode


auto zpl_key_state_update(zplKeyState* s, b32 is_down) -> void
auto zpl_set_video_mode(i32 width, i32 height, i32 bits_per_pixel) -> zpl_video_mode
auto zpl_video_mode_is_valid(zpl_video_mode mode) -> b32
auto zpl_video_mode_get_desktop(void) -> zpl_video_mode
auto zpl_video_mode_get_fullscreen_modes(zpl_video_mode* modes, isize max_mode_count) -> isize
auto zpl_platform_init_with_software(zpl_platform* p, char const* window_title, i32 width, i32 height, u32 window_flags) -> b32
auto zpl_platform_init_with_opengl(zpl_platform* p, char const* window_title, i32 width, i32 height, u32 window_flags, i32 major, i32 minor, b32 core, b32 compatible) -> b32
auto zpl_platform_update(zpl_platform* p) -> void
auto zpl_platform_display(zpl_platform* p) -> void
auto zpl_platform_destroy(zpl_platform* p) -> void
auto zpl_platform_show_cursor(zpl_platform* p, b32 show) -> void
auto zpl_platform_set_cursor(zpl_platform* p, void* handle) -> void
auto zpl_platform_set_mouse_position(zpl_platform* p, i32 x, i32 y) -> void
auto zpl_platform_set_controller_vibration(zpl_platform* p, isize index, f32 left_motor, f32 right_motor) -> void
auto zpl_platform_has_clipboard_text(zpl_platform* p) -> b32
auto zpl_platform_set_clipboard_text(zpl_platform* p, char const* str) -> void
auto zpl_platform_get_clipboard_text(zpl_platform* p, zpl_allocator a) -> char*
auto zpl_platform_get_scancode(zpl_platform* p, zplKeyType key) -> u32
auto zpl_platform_set_window_position(zpl_platform* p, i32 x, i32 y) -> void
auto zpl_platform_set_window_title(zpl_platform* p, char const* title, ...) -> void
auto zpl_platform_toggle_fullscreen(zpl_platform* p, b32 fullscreen_desktop) -> void
auto zpl_platform_toggle_borderless(zpl_platform* p) -> void
auto zpl_platform_make_opengl_context_current(zpl_platform* p) -> void
auto zpl_platform_show_window(zpl_platform* p) -> void
auto zpl_platform_hide_window(zpl_platform* p) -> void