Functions - arabasso/tinywm GitHub Wiki

int twm_init();

void twm_finalize();

Window

twm_window twm_create_window(const char* title, int x, int y, int width, int height, twm_window_flags flags);

void twm_destroy_window(twm_window window);

void twm_show_window(twm_window window, bool visible);

bool twm_window_is_visible(twm_window window);

void twm_move_window(twm_window window, int x, int y, int width, int height);

int twm_window_width(twm_window window);

int twm_window_height(twm_window window);

void twm_window_size(twm_window window, int* width, int* height);

int twm_window_x(twm_window window);

int twm_window_y(twm_window window);

void twm_window_position(twm_window window, int* x, int* y);

void twm_window_rect(twm_window window, twm_rect* rect);

void twm_title_window(twm_window window, const char* title);

void twm_window_borderless(twm_window window, bool enable);

bool twm_window_is_borderless(twm_window window);

void twm_window_fullscreen(twm_window window, bool enable);

bool twm_window_is_fullscreen(twm_window window);

void twm_set_window_ptr(twm_window window, void * ptr);

void * twm_get_window_ptr(twm_window window);

void twm_set_window_property(twm_window window, const char* name, int size, const void* value);

bool twm_get_window_property(twm_window window, const char* name, int size, void* value);

void twm_free_window_property(twm_window window, const char* name);

bool twm_window_was_closed(twm_window window);

bool twm_window_was_resized(twm_window window, int* width, int* height);

Cursor

void twm_cursor_position(int * x, int * y);

void twm_move_cursor(int x, int y);

void twm_clip_cursor(twm_window window);

void twm_unclip_cursor();

void twm_show_cursor(bool show);

bool twm_cursor_is_visible();

void twm_grab_cursor(twm_window window);

void twm_ungrab_cursor();

Event

void twm_wait_event(twm_event* evt);

int twm_peek_event(twm_event* evt);

void twm_pool_events();

int twm_mouse_x();

int twm_mouse_y();

int twm_mouse_dx();

int twm_mouse_dy();

bool twm_mb_state(twm_mouse_button button);

bool twm_key_state(twm_key key);

bool twm_keymod_state(twm_keymod key);

unsigned int twm_utf8_to_codepoint(const char* utf8, int* out_advance);

Time control

double twm_fps_limit(int fps, double start_time);

double twm_time();

void twm_sleep(int milliseconds);

Screen

int twm_screen_default();

int twm_screen_from_cursor();

int twm_screen_from_window(twm_window window);

int twm_screen_from_position(int x, int y);

int twm_screen_count();

const twm_screen * twm_screen_info(int screen_index);

int twm_current_screen_mode(int screen_index);

int twm_screen_mode_count(int screen_index);

const twm_screen_mode* twm_screen_mode_info(int screen_index, int mode_index);

int twm_select_screen_mode(int screen_index, int width, int height, int bpp, int hz);

int twm_screen_width(int index);

int twm_screen_height(int index);

void twm_screen_size(int index, int* width, int* height);

int twm_screen_x(int index);

int twm_screen_y(int index);

void twm_screen_position(int index, int* x, int* y);

void twm_screen_rect(int index, twm_rect* rect);

bool twm_change_screen_mode(int screen_index, int mode_index);

OpenGL

void twm_gl_set_pixel_attribs(int pixel_attribs[]);

twm_gl_context twm_gl_create_context(twm_window window, int* attribs);

void twm_gl_delete_context(twm_gl_context context);

void twm_gl_make_current(twm_gl_context context);

void twm_gl_swap_buffers(twm_gl_context context);

Vulkan

const char** twm_vk_get_instance_extensions(int* extension_count);

VkResult twm_vk_create_surface(twm_window window, VkInstance instance, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);

ImGui

void ImGui_ImplTinyWM_Event(const twm_event* ev);

void ImGui_ImplTinyWM_NewFrame(int width, int height, double frame_time);