glfw: add glfw.postEmptyEvent
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
66678f1df0
commit
5a5078b885
1 changed files with 22 additions and 12 deletions
34
src/main.zig
34
src/main.zig
|
@ -231,18 +231,20 @@ pub inline fn waitEventsTimeout(timeout: f64) Error!void {
|
|||
try getError();
|
||||
}
|
||||
|
||||
// /// Posts an empty event to the event queue.
|
||||
// ///
|
||||
// /// This function posts an empty event from the current thread to the event
|
||||
// /// queue, causing @ref glfwWaitEvents or @ref glfwWaitEventsTimeout to return.
|
||||
// ///
|
||||
// /// Possible errors include glfw.Error.NotInitialized and glfw.Error.PlatformError.
|
||||
// ///
|
||||
// /// @thread_safety This function may be called from any thread.
|
||||
// ///
|
||||
// /// see also: events, glfw.waitEvents, glfw.waitEventsTimeout
|
||||
// ///
|
||||
// GLFWAPI void glfwPostEmptyEvent(void);
|
||||
/// Posts an empty event to the event queue.
|
||||
///
|
||||
/// This function posts an empty event from the current thread to the event queue, causing
|
||||
/// glfw.waitEvents or glfw.waitEventsTimeout to return.
|
||||
///
|
||||
/// Possible errors include glfw.Error.NotInitialized and glfw.Error.PlatformError.
|
||||
///
|
||||
/// @thread_safety This function may be called from any thread.
|
||||
///
|
||||
/// see also: events, glfw.waitEvents, glfw.waitEventsTimeout
|
||||
pub inline fn postEmptyEvent() Error!void {
|
||||
c.glfwPostEmptyEvent();
|
||||
try getError();
|
||||
}
|
||||
|
||||
pub fn basicTest() !void {
|
||||
try init();
|
||||
|
@ -288,6 +290,14 @@ test "waitEventsTimeout" {
|
|||
try waitEventsTimeout(0.25);
|
||||
}
|
||||
|
||||
test "postEmptyEvent_and_waitEvents" {
|
||||
try init();
|
||||
defer terminate();
|
||||
|
||||
try postEmptyEvent();
|
||||
try waitEvents();
|
||||
}
|
||||
|
||||
test "basic" {
|
||||
try basicTest();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue