Platform layer module

Contents


NOTE(bill):
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 https://github.com/gingerBill/gb/

Classes

struct zpl_game_controller
struct zpl_platform
struct zpl_video_mode

Typedefs

using zplKeyType = enum zplKeyType
using zplKeyState = zpl_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

Functions

auto zpl_key_state_update(zplKeyState* s, zpl_b32 is_down) -> void
auto zpl_set_video_mode(zpl_i32 width, zpl_i32 height, zpl_i32 bits_per_pixel) -> zpl_video_mode
auto zpl_video_mode_is_valid(zpl_video_mode mode) -> zpl_b32
auto zpl_video_mode_get_desktop(void) -> zpl_video_mode
auto zpl_video_mode_get_fullscreen_modes(zpl_video_mode* modes, zpl_isize max_mode_count) -> zpl_isize
ZPL_COMPARE_PROC(zpl_video_mode_cmp)
ZPL_COMPARE_PROC(zpl_video_mode_dsc_cmp)
auto zpl_platform_init_with_software(zpl_platform* p, char const* window_title, zpl_i32 width, zpl_i32 height, zpl_u32 window_flags) -> zpl_b32
auto zpl_platform_init_with_opengl(zpl_platform* p, char const* window_title, zpl_i32 width, zpl_i32 height, zpl_u32 window_flags, zpl_i32 major, zpl_i32 minor, zpl_b32 core, zpl_b32 compatible) -> zpl_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, zpl_b32 show) -> void
auto zpl_platform_set_cursor(zpl_platform* p, void* handle) -> void
auto zpl_platform_set_mouse_position(zpl_platform* p, zpl_i32 x, zpl_i32 y) -> void
auto zpl_platform_set_controller_vibration(zpl_platform* p, zpl_isize index, zpl_f32 left_motor, zpl_f32 right_motor) -> void
auto zpl_platform_has_clipboard_text(zpl_platform* p) -> zpl_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) -> zpl_u32
auto zpl_platform_set_window_position(zpl_platform* p, zpl_i32 x, zpl_i32 y) -> void
auto zpl_platform_set_window_title(zpl_platform* p, char const* title, ...) -> void
auto zpl_platform_toggle_fullscreen(zpl_platform* p, zpl_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

Defines

#define ZPL_MAX_GAME_CONTROLLER_COUNT