104 lines
4.4 KiB
C
104 lines
4.4 KiB
C
#ifndef PGPL_WINDOW_THREAD_H
|
|
#define PGPL_WINDOW_THREAD_H
|
|
|
|
#include <pgpl/window/predef.h>
|
|
#include <stdbool.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/* This creates a new thread loop, in which a window is also created. The first
|
|
* five parameters are shared with the non threaded counterpart. The event_loop
|
|
* function is called whenever there is a window event. The user_data parameter
|
|
* can be any custom pointer to anything that might be needed inside of the
|
|
* event_loop. If the user_data is not needed it can also be NULL.
|
|
*
|
|
* Returning false from the event_loop will close the window. Do not call any of
|
|
* the window_thread functions from within the event loop, as this will cause
|
|
* the thread to lock up. Use the window functions directly. */
|
|
PGPL_WindowThread *pgpl_window_thread_create(
|
|
const char *title, uint32_t width, uint32_t height, int32_t x, int32_t y,
|
|
bool (*event_loop)(PGPL_Window *window, PGPL_WindowEventType event,
|
|
PGPL_WindowEventData *event_data, void *user_data),
|
|
void *user_data);
|
|
|
|
/* This exits the thread loop that is running in the background. It also frees
|
|
* all resources that were created for this thread, including the Window that
|
|
* was created in the thread. */
|
|
void pgpl_window_thread_destroy(PGPL_WindowThread *window_thread);
|
|
|
|
/* Threaded version of pgpl_window_show, see pgpl_window_show for more
|
|
* information. */
|
|
void pgpl_window_thread_show(PGPL_WindowThread *window_thread);
|
|
|
|
/* Threaded version of pgpl_window_hide, see pgpl_window_hide for more
|
|
* information. */
|
|
void pgpl_window_thread_hide(PGPL_WindowThread *window_thread);
|
|
|
|
/* Threaded version of pgpl_window_set_title, see pgpl_window_set_title for more
|
|
* information. */
|
|
void pgpl_window_thread_set_title(PGPL_WindowThread *window_thread,
|
|
const char *title);
|
|
|
|
/* Threaded version of pgpl_window_get_title, see pgpl_window_get_title for more
|
|
* information. */
|
|
const char *pgpl_window_thread_get_title(PGPL_WindowThread *window_thread);
|
|
|
|
/* Threaded version of pgpl_window_get_size, see pgpl_window_get_size for more
|
|
* information. */
|
|
void pgpl_window_thread_get_size(PGPL_WindowThread *window_thread,
|
|
uint32_t *width, uint32_t *height);
|
|
|
|
/* Threaded version of pgpl_window_set_size, see pgpl_window_set_size for more
|
|
* information. */
|
|
void pgpl_window_thread_set_size(PGPL_WindowThread *window_thread,
|
|
uint32_t width, uint32_t height);
|
|
|
|
/* Threaded version of pgpl_window_get_position, see pgpl_window_get_position
|
|
* for more information. */
|
|
void pgpl_window_thread_get_position(PGPL_WindowThread *window_thread,
|
|
int32_t *x, int32_t *y);
|
|
|
|
/* Threaded version of pgpl_window_set_position, see pgpl_window_set_position
|
|
* for more information. */
|
|
void pgpl_window_thread_set_position(PGPL_WindowThread *window_thread,
|
|
int32_t x, int32_t y);
|
|
|
|
/* Threaded version of pgpl_window_get_scale, see pgpl_window_get_scale for more
|
|
* information. */
|
|
double pgpl_window_thread_get_scale(PGPL_WindowThread *window_thread);
|
|
|
|
/* Threaded version of pgpl_window_set_scale, see pgpl_window_set_scale for more
|
|
* information. */
|
|
void pgpl_window_thread_set_scale(PGPL_WindowThread *window_thread,
|
|
double scale);
|
|
|
|
/* Threaded version of pgpl_window_create_event, see pgpl_window_create_event
|
|
* for more information. */
|
|
void pgpl_window_thread_create_event(PGPL_WindowThread *window_thread,
|
|
PGPL_WindowEventType event_type,
|
|
PGPL_WindowEventData *event_data);
|
|
|
|
/* Threaded version of pgpl_window_set_transient, see pgpl_window_set_transient
|
|
* for more information. */
|
|
void pgpl_window_thread_set_transient(PGPL_WindowThread *window_thread,
|
|
void *parent);
|
|
|
|
/* Threaded version of pgpl_window_reparent_to, see pgpl_window_reparent_to for
|
|
* more information. */
|
|
void pgpl_window_thread_reparent_to(PGPL_WindowThread *window_thread,
|
|
void *parent);
|
|
|
|
/* Threaded version of pgpl_window_get_raw_window, see
|
|
* pgpl_window_get_raw_window for more information. */
|
|
void *pgpl_window_thread_get_raw_window(PGPL_WindowThread *window_thread);
|
|
|
|
/* This function halts until the window_thread is destroyed. */
|
|
void pgpl_window_thread_await_destruction(PGPL_WindowThread *window_thread);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|