You are looking at historical revision 30712 of this page. It may differ significantly from its current revision.
Bindings to the GLFW OpenGL window and event management library, version 3.X.
Direct bindings generated by bind. Names Scheme-ified, with GLFW prefixes removed. Constants surrounded by +s (e.g. +alpha-bits+)
Version 3 of GLFW is not backwards compatible with previous major versions of GLFW.
For information regarding the GLFW API, see the official GLFW documentation.
(make-window WIDTH HEIGHT NAME #!key (fullscreen? #f) resizable visible decorated red-bits green-bits blue-bits alpha-bits depth-bits stencil-bits accum-red-bits accum-green-bits accum-blue-bits accum-alpha-bits aux-buffers samples refresh-rate sterio srgb-capable client-api context-version-major context-version-minor context-robustness opengl-forward-compat opengl-debug-context opengl-profile)
Create the window with title string NAME and dimensions WIDTH by HEIGHT. The keys correspond to the available GLFW window hints. resizable, visible, decorated, sterio, srgb-capable, opengl-forward-compat, opengl-debug-context accept boolean arguments, while all other accept either an integer or an appropriate GLFW constant as per the documentation.
This variable contains the GLFW window object that is created by make-window.
with-window[syntax] (with-window (WIDTH HEIGHT NAME . KEYS) BODY ...)
Initializes GLFW, creates a window as per make-window, and runs BODY before cleaning up. If opengl-glew has been included in the same file that this macro is used, opengl-glew will also be initialized.
This example must be compiled due to the external function definition.
(import foreign) (use (prefix glfw3 glfw:)) (define-external (keyCallback (c-pointer window) (int key) (int scancode) (int action) (int mods)) void (cond [(and (eq? key glfw:+key-escape+) (eq? action glfw:+press+)) (glfw:set-window-should-close glfw:*window* 1)])) (glfw:with-window (640 480 "Example" resizable: #f) (glfw:set-key-callback glfw:*window* #$keyCallback) (let loop () (glfw:swap-buffers glfw:*window*) (glfw:poll-events) (unless (glfw:window-should-close glfw:*window*) (loop))))
Available on GitHub
- 0.2.0: Add make-window, with-window
Copyright (c) 2014, Alexander Charlton All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.