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