Dart bindings to GLFW 3.1.1.
It is unlikely that programs written with these bindings will work on OSX due to requirements that the main thread be the one handling events.
mkdir -p lib/src/generated/
pub run tools/glfw_generator.dart --glfw3_path=<path to glfw3.h>
clang-format -i --style=Google generated/*.{cc,h}
dartfmt -w generated/*.dart
mv generated/* lib/src/generated/*
Set environment variables DART_SDK, GLFW_INCLUDE, and GLFW_LIB.
cd lib/
dart ../tools/glfw_compile.dart
Note that if you set the GLFW_LIB
variable when compiling, you must also set
LD_LIBRARY_PATH
to include the same directory when running your program or
the Dart VM will not be able to find libglfw.so
.
glfwWindowShouldClose
returns anint
, rather than abool
, but unlike in C, the expression!(1)
returns true so you must explicitly testglfwWindowShouldClose(window) != 1
- There is also a convenience function
bool glfwWindowShouldCloseAsBool(GLFWwindow window)
- There is also a convenience function
These changes are due to the C library's use of pointer arguments to return values. See also lib/src/manual_bindings.dart.
- glfwGetVersion
- Returns a
GLFWVersion
instance which hasmajor
,minor
,rev
fields.
- Returns a
- glfwGetMonitors
- Returns a
List<GLFWmonitor>
instance.
- Returns a
- glfwGetMonitorPos
- Returns a
Point
instance.
- Returns a
- glfwGetMonitorPhysicalSize
- Returns a
Rectangle
instance withxpos
andypos
set to 0.
- Returns a
- glfwGetVideoModes
- Returns a
List<GLFWvidmode>
instance.
- Returns a
- glfwGetWindowPos
- Returns a
Point
instance.
- Returns a
- glfwGetWindowSize
- Returns a
Rectangle
instance withxpos
andypos
set to 0.
- Returns a
- glfwGetFramebufferSize
- Returns a
Rectangle
instance withxpos
andypos
set to 0.
- Returns a
- glfwGetWindowFrameSize
- Returns a
Rectangle
instance.
- Returns a
- glfwSetWindowUserPointer
pointer
parameter is a DartObject
.
- glfwGetWindowUserPointer
- Returns an
Object
instance.
- Returns an
- glfwGetCursorPos
- Returns a
Point
instance.
- Returns a
- glfwGetJoystickAxes
- Returns a
List<double>
instance.
- Returns a
- glfwGetJoystickButtons
- Returns a
List<int>
instance.
- Returns a
- glfwSwapBuffersAsync
- An async version of glfwSwapBuffers that can be
await
-ed. This avoids blocking the current isolate while the glfwSwapBuffers call is waiting to finish.
- An async version of glfwSwapBuffers that can be