summary refs log tree commit diff
path: root/src/gfz.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/gfz.zig')
-rw-r--r--src/gfz.zig42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/gfz.zig b/src/gfz.zig
index 83c89aa..56d60f0 100644
--- a/src/gfz.zig
+++ b/src/gfz.zig
@@ -16,7 +16,7 @@
 // You should have received a copy of the GNU Lesser General Public License
 // along with gfz.  If not, see <https://www.gnu.org/licenses/>.
 
-usingnamespace @import("cimport.zig");
+const c = @import("cimport.zig");
 const input = @import("input.zig");
 
 pub const Error = error {
@@ -46,18 +46,18 @@ pub const Error = error {
 /// Return and clear the error code of the last error
 /// that occurred on the calling thread if any.
 pub fn checkError() Error!void {
-    return switch (glfwGetError(null)) {
-        GLFW_NO_ERROR => {},
-        GLFW_NOT_INITIALIZED => Error.NotInitialized,
-        GLFW_NO_CURRENT_CONTEXT => Error.NoCurrentContext,
-        GLFW_INVALID_ENUM => Error.InvalidEnum,
-        GLFW_INVALID_VALUE => Error.InvalidValue,
-        GLFW_OUT_OF_MEMORY => Error.OutOfMemory,
-        GLFW_API_UNAVAILABLE => Error.ApiUnavailable,
-        GLFW_VERSION_UNAVAILABLE => Error.VersionUnavailable,
-        GLFW_PLATFORM_ERROR => Error.PlatformError,
-        GLFW_FORMAT_UNAVAILABLE => Error.FormatUnavailable,
-        GLFW_NO_WINDOW_CONTEXT => Error.NoWindowContext,
+    return switch (c.glfwGetError(null)) {
+        c.GLFW_NO_ERROR => {},
+        c.GLFW_NOT_INITIALIZED => Error.NotInitialized,
+        c.GLFW_NO_CURRENT_CONTEXT => Error.NoCurrentContext,
+        c.GLFW_INVALID_ENUM => Error.InvalidEnum,
+        c.GLFW_INVALID_VALUE => Error.InvalidValue,
+        c.GLFW_OUT_OF_MEMORY => Error.OutOfMemory,
+        c.GLFW_API_UNAVAILABLE => Error.ApiUnavailable,
+        c.GLFW_VERSION_UNAVAILABLE => Error.VersionUnavailable,
+        c.GLFW_PLATFORM_ERROR => Error.PlatformError,
+        c.GLFW_FORMAT_UNAVAILABLE => Error.FormatUnavailable,
+        c.GLFW_NO_WINDOW_CONTEXT => Error.NoWindowContext,
         else => unreachable,
     };
 }
@@ -79,7 +79,7 @@ pub fn getError() Error {
 /// Additional calls to this function after successful initialization
 /// but before termination will return immediately.
 pub fn init() Error!void {
-    if (glfwInit() != GLFW_TRUE)
+    if (c.glfwInit() != c.GLFW_TRUE)
         return getError();
 }
 
@@ -95,39 +95,39 @@ pub fn init() Error!void {
 /// 
 /// This function has no effect if GLFW is not initialized.
 pub fn deinit() Error!void {
-    glfwTerminate();
+    c.glfwTerminate();
     try checkError();
 }
 
 /// Set the swap interval for the current context.
 pub fn swapInterval(interval: c_int) Error!void {
-    glfwSwapInterval(interval);
+    c.glfwSwapInterval(interval);
     try checkError();
 }
 
 /// Process all pending events.
 pub fn pollEvents() Error!void {
-    glfwPollEvents();
+    c.glfwPollEvents();
     try checkError();
 }
 
 /// Return the GLFW time, in seconds.
 pub fn getTime() Error!f64 {
-    const time = glfwGetTime();
+    const time = c.glfwGetTime();
     return if (time == 0) getError() else time;
 }
 
 /// Set the GLFW time, in seconds.
 pub fn setTime(time: f64) Error!void {
-    glfwSetTime(time);
+    c.glfwSetTime(time);
     try checkError();
 }
 
 /// Return whether raw mouse motion is supported.
 pub fn rawMouseMotionSupported() Error!bool {
-    const result = glfwRawMouseMotionSupported();
+    const result = c.glfwRawMouseMotionSupported();
     try checkError();
-    return result == GLFW_TRUE;
+    return result == c.GLFW_TRUE;
 }
 
 pub const Window = @import("Window.zig");