package glfw-ocaml

  1. Overview
  2. Docs
A GLFW binding for OCaml

Install

Dune Dependency

Authors

Maintainers

Sources

3.2.1-1.tar.gz
md5=69bc25389d41f5041f373f5aca41fc71
sha512=bc98ff18534397273e7e385ccedbd9c691562d97cd1afb3e3e45d6f58122a1831605866dbf102f1203c64ca1d1f57d373cd598cbc154261321b57e3f68eed256

doc/glfw-ocaml/GLFW/index.html

Module GLFWSource

OCaml binding for GLFW 3.2.1

Sourceval version_major : int

GLFW-OCaml version numbers.

Sourceval version_minor : int
Sourceval version_revision : int
Sourceexception NotInitialized of string

Exceptions raised by the various functions of this module.

If you ever get an InvalidEnum exception and are not using unsafe features that would be a bug in GLFW-OCaml. Please fill an issue on GitHub.

Sourceexception NoCurrentContext of string
Sourceexception InvalidEnum of string
Sourceexception InvalidValue of string
Sourceexception OutOfMemory of string
Sourceexception ApiUnavailable of string
Sourceexception VersionUnavailable of string
Sourceexception PlatformError of string
Sourceexception FormatUnavailable of string
Sourceexception NoWindowContext of string
Sourcetype key_action =
  1. | Release
  2. | Press
  3. | Repeat
Sourcetype key =
  1. | Unknown
  2. | Space
  3. | Apostrophe
  4. | Comma
  5. | Minus
  6. | Period
  7. | Slash
  8. | Num0
  9. | Num1
  10. | Num2
  11. | Num3
  12. | Num4
  13. | Num5
  14. | Num6
  15. | Num7
  16. | Num8
  17. | Num9
  18. | Semicolon
  19. | Equal
  20. | A
  21. | B
  22. | C
  23. | D
  24. | E
  25. | F
  26. | G
  27. | H
  28. | I
  29. | J
  30. | K
  31. | L
  32. | M
  33. | N
  34. | O
  35. | P
  36. | Q
  37. | R
  38. | S
  39. | T
  40. | U
  41. | V
  42. | W
  43. | X
  44. | Y
  45. | Z
  46. | LeftBracket
  47. | Backslash
  48. | RightBracket
  49. | GraveAccent
  50. | World1
  51. | World2
  52. | Escape
  53. | Enter
  54. | Tab
  55. | Backspace
  56. | Insert
  57. | Delete
  58. | Right
  59. | Left
  60. | Down
  61. | Up
  62. | PageUp
  63. | PageDown
  64. | Home
  65. | End
  66. | CapsLock
  67. | ScrollLock
  68. | NumLock
  69. | PrintScreen
  70. | Pause
  71. | F1
  72. | F2
  73. | F3
  74. | F4
  75. | F5
  76. | F6
  77. | F7
  78. | F8
  79. | F9
  80. | F10
  81. | F11
  82. | F12
  83. | F13
  84. | F14
  85. | F15
  86. | F16
  87. | F17
  88. | F18
  89. | F19
  90. | F20
  91. | F21
  92. | F22
  93. | F23
  94. | F24
  95. | F25
  96. | Kp0
  97. | Kp1
  98. | Kp2
  99. | Kp3
  100. | Kp4
  101. | Kp5
  102. | Kp6
  103. | Kp7
  104. | Kp8
  105. | Kp9
  106. | KpDecimal
  107. | KpDivide
  108. | KpMultiply
  109. | KpSubtract
  110. | KpAdd
  111. | KpEnter
  112. | KpEqual
  113. | LeftShift
  114. | LeftControl
  115. | LeftAlt
  116. | LeftSuper
  117. | RightShift
  118. | RightControl
  119. | RightAlt
  120. | RightSuper
  121. | Menu
Sourcetype key_mod =
  1. | Shift
  2. | Control
  3. | Alt
  4. | Super

Keyboard key and mouse button modifiers.

Sourceval mouse_button_max_count : int

Maximum number of buttons handled for a mouse.

Sourceval mouse_button_left : int

Values of common mouse buttons.

Sourceval mouse_button_right : int
Sourceval mouse_button_middle : int
Sourceval joystick_max_count : int

Maximum number of joysticks connected.

Sourcetype client_api =
  1. | NoApi
  2. | OpenGLApi
  3. | OpenGLESApi

Client OpenGL API hint

Sourcetype context_robustness =
  1. | NoRobustness
  2. | NoResetNotification
  3. | LoseContextOnReset

Context robustness hint

Sourcetype opengl_profile =
  1. | AnyProfile
  2. | CoreProfile
  3. | CompatProfile

OpenGL profile hint

Sourcetype context_release_behavior =
  1. | AnyReleaseBehavior
  2. | ReleaseBehaviorFlush
  3. | ReleaseBehaviorNone

Context release behavior hint

Sourcetype context_creation_api =
  1. | NativeContextApi
  2. | EGLContextApi

Context creation API hint

Sourcemodule WindowHint : sig ... end

Window hints. Use with windowHint like this:

Sourcemodule WindowAttribute : sig ... end

Windows attributes. Use with getWindowAttrib in a similar manner as with window hints.

Sourcetype cursor_mode =
  1. | Normal
  2. | Hidden
  3. | Disabled

Mouse cursor input mode.

Sourcetype _ input_mode =
  1. | Cursor : cursor_mode input_mode
  2. | StickyKeys : bool input_mode
  3. | StickyMouseButtons : bool input_mode

Input modes. Use with setInputMode and getInputMode in a similar manner as with window hints.

Sourcetype cursor_shape =
  1. | ArrowCursor
  2. | IBeamCursor
  3. | CrosshairCursor
  4. | HandCursor
  5. | HResizeCursor
  6. | VResizeCursor

Standard cursor shapes.

Sourcetype connection_event =
  1. | Connected
  2. | Disconnected

Joystick connection event.

Sourcetype video_mode = {
  1. width : int;
  2. height : int;
  3. red_bits : int;
  4. green_bits : int;
  5. blue_bits : int;
  6. refresh_rate : int;
}

Video mode description as returned by getVideoMode(s).

Sourcetype monitor
Sourcetype window
Sourcetype cursor
Sourcemodule GammaRamp : sig ... end

GammaRamp module. Describes the gamma ramp for a monitor.

Sourcemodule Image : sig ... end

Image data for creating custom cursors and window icons.

Module functions. These are mostly identical to their original GLFW counterparts.

There are no bindings for the glfwSetWindowUserPointer and glfwGetWindowUserPointer functions because you would have to use unsafe features to set the correct type for your data. If you need to make user data accessible inside a callback you can instead capture it in a closure and use that closure as your callback function.

There is no binding for the glfwGetProcAddress function because it would basicaly require to write an entire OpenGL wrapper to make the functions returned by GLFW usable from OCaml. Incidentaly the glfwExtensionSupported function is not provided either. There are numerous OpenGL bindings available for OCaml that you can use instead.

The Vulkan related functions are not supported as of now but we might look into it at some point.

Sourceval init : unit -> unit
Sourceval terminate : unit -> unit
Sourceval getVersion : unit -> int * int * int
Sourceval getVersionString : unit -> string
Sourceval getMonitors : unit -> monitor list
Sourceval getPrimaryMonitor : unit -> monitor
Sourceval getMonitorPos : monitor:monitor -> int * int
Sourceval getMonitorPhysicalSize : monitor:monitor -> int * int
Sourceval getMonitorName : monitor:monitor -> string
Sourceval setMonitorCallback : f:(monitor -> connection_event -> unit) option -> (monitor -> connection_event -> unit) option
Sourceval getVideoModes : monitor:monitor -> video_mode list
Sourceval getVideoMode : monitor:monitor -> video_mode
Sourceval setGamma : monitor:monitor -> gamma:float -> unit
Sourceval getGammaRamp : monitor:monitor -> GammaRamp.t
Sourceval setGammaRamp : monitor:monitor -> gamma_ramp:GammaRamp.t -> unit
Sourceval defaultWindowHints : unit -> unit
Sourceval windowHint : hint:'a WindowHint.t -> value:'a -> unit
Sourceval createWindow : width:int -> height:int -> title:string -> ?monitor:monitor -> ?share:window -> unit -> window
Sourceval destroyWindow : window:window -> unit
Sourceval windowShouldClose : window:window -> bool
Sourceval setWindowShouldClose : window:window -> b:bool -> unit
Sourceval setWindowTitle : window:window -> title:string -> unit
Sourceval setWindowIcon : window:window -> images:Image.t list -> unit
Sourceval getWindowPos : window:window -> int * int
Sourceval setWindowPos : window:window -> xpos:int -> ypos:int -> unit
Sourceval getWindowSize : window:window -> int * int
Sourceval setWindowSizeLimits : window:window -> minWidth:int option -> minHeight:int option -> maxWidth:int option -> maxHeight:int option -> unit
Sourceval setWindowAspectRatio : window:window -> numer:int -> denom:int -> unit
Sourceval setWindowSize : window:window -> width:int -> height:int -> unit
Sourceval getFramebufferSize : window:window -> int * int
Sourceval getWindowFrameSize : window:window -> int * int * int * int
Sourceval iconifyWindow : window:window -> unit
Sourceval restoreWindow : window:window -> unit
Sourceval maximizeWindow : window:window -> unit
Sourceval showWindow : window:window -> unit
Sourceval hideWindow : window:window -> unit
Sourceval focusWindow : window:window -> unit
Sourceval getWindowMonitor : window:window -> monitor option
Sourceval setWindowMonitor : window:window -> monitor:monitor option -> xpos:int -> ypos:int -> width:int -> height:int -> refreshRate:int option -> unit
Sourceval getWindowAttrib : window:window -> attribute:'a WindowAttribute.t -> 'a
Sourceval setWindowPosCallback : window:window -> f:(window -> int -> int -> unit) option -> (window -> int -> int -> unit) option
Sourceval setWindowSizeCallback : window:window -> f:(window -> int -> int -> unit) option -> (window -> int -> int -> unit) option
Sourceval setWindowCloseCallback : window:window -> f:(window -> unit) option -> (window -> unit) option
Sourceval setWindowRefreshCallback : window:window -> f:(window -> unit) option -> (window -> unit) option
Sourceval setWindowFocusCallback : window:window -> f:(window -> bool -> unit) option -> (window -> bool -> unit) option
Sourceval setWindowIconifyCallback : window:window -> f:(window -> bool -> unit) option -> (window -> bool -> unit) option
Sourceval setFramebufferSizeCallback : window:window -> f:(window -> int -> int -> unit) option -> (window -> int -> int -> unit) option
Sourceval pollEvents : unit -> unit
Sourceval waitEvents : unit -> unit
Sourceval waitEventsTimeout : timeout:float -> unit
Sourceval postEmptyEvent : unit -> unit
Sourceval getInputMode : window:window -> mode:'a input_mode -> 'a
Sourceval setInputMode : window:window -> mode:'a input_mode -> value:'a -> unit
Sourceval getKeyName : key:key -> scancode:int -> string option
Sourceval getKey : window:window -> key:key -> bool
Sourceval getMouseButton : window:window -> button:int -> bool
Sourceval getCursorPos : window:window -> float * float
Sourceval setCursorPos : window:window -> xpos:float -> ypos:float -> unit
Sourceval createCursor : image:Image.t -> xhot:int -> yhot:int -> cursor
Sourceval createStandardCursor : shape:cursor_shape -> cursor
Sourceval destroyCursor : cursor:cursor -> unit
Sourceval setCursor : window:window -> cursor:cursor -> unit
Sourceval setKeyCallback : window:window -> f:(window -> key -> int -> key_action -> key_mod list -> unit) option -> (window -> key -> int -> key_action -> key_mod list -> unit) option
Sourceval setCharCallback : window:window -> f:(window -> int -> unit) option -> (window -> int -> unit) option
Sourceval setCharModsCallback : window:window -> f:(window -> int -> key_mod list -> unit) option -> (window -> int -> key_mod list -> unit) option
Sourceval setMouseButtonCallback : window:window -> f:(window -> int -> bool -> key_mod list -> unit) option -> (window -> int -> bool -> key_mod list -> unit) option
Sourceval setCursorPosCallback : window:window -> f:(window -> float -> float -> unit) option -> (window -> float -> float -> unit) option
Sourceval setCursorEnterCallback : window:window -> f:(window -> bool -> unit) option -> (window -> bool -> unit) option
Sourceval setScrollCallback : window:window -> f:(window -> float -> float -> unit) option -> (window -> float -> float -> unit) option
Sourceval setDropCallback : window:window -> f:(window -> string list -> unit) option -> (window -> string list -> unit) option
Sourceval joystickPresent : joy:int -> bool
Sourceval getJoystickAxes : joy:int -> float array
Sourceval getJoystickButtons : joy:int -> bool array
Sourceval getJoystickName : joy:int -> string option
Sourceval setJoystickCallback : f:(int -> connection_event -> unit) option -> (int -> connection_event -> unit) option
Sourceval setClipboardString : window:window -> string:string -> unit
Sourceval getClipboardString : window:window -> string
Sourceval getTime : unit -> float
Sourceval setTime : time:float -> unit
Sourceval getTimerValue : unit -> int64
Sourceval getTimerFrequency : unit -> int64
Sourceval makeContextCurrent : window:window option -> unit
Sourceval getCurrentContext : unit -> window option
Sourceval swapBuffers : window:window -> unit
Sourceval swapInterval : interval:int -> unit
OCaml

Innovation. Community. Security.