Changeset 30706 in project


Ignore:
Timestamp:
04/14/14 21:18:06 (7 years ago)
Author:
acharlton
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/4/glfw3

    r30699 r30706  
    1414For information regarding the GLFW API, see the official [[http://www.glfw.org/documentation.html|GLFW documentation]].
    1515
     16==== High-level interface
     17
     18===== make-window
     19    (make-window WIDTH HEIGHT NAME
     20                     #!key (fullscreen? #f)
     21                                 resizable
     22                                 visible
     23                                 decorated
     24                                 red-bits green-bits blue-bits alpha-bits
     25                                 depth-bits stencil-bits
     26                                 accum-red-bits accum-green-bits accum-blue-bits accum-alpha-bits
     27                                 aux-buffers
     28                                 samples
     29                                 refresh-rate
     30                                 sterio
     31                                 srgb-capable
     32                                 client-api
     33                                 context-version-major
     34                                 context-version-minor
     35                                 context-robustness
     36                                 opengl-forward-compat
     37                                 opengl-debug-context
     38                                 opengl-profile)
     39
     40Create the window with title string NAME and dimensions WIDTH by HEIGHT. The keys correspond to the available [[http://www.glfw.org/docs/latest/window.html#window_hints|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.
     41
     42===== *window*
     43This variable contains the GLFW window object that is created by {{make-window}}.
     44
     45===== with-window
     46<macro>(with-window (WIDTH HEIGHT NAME . KEYS) BODY ...)</macro>
     47
     48Initializes 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.
     49
     50
    1651=== Example
    1752This example must be compiled due to the external function definition.
     
    2863    (glfw:set-window-should-close *window* 1)]))
    2964
    30 (glfw:init)
    31 
    32 (define *window* (glfw:create-window 640 480 "Example" #f #f))
    33 
    34 (glfw:set-key-callback *window* #$keyCallback)
    35 
    36 (let loop ()
    37   (glfw:swap-buffers *window*)
    38   (glfw:poll-events)
    39   (unless (glfw:window-should-close *window*)
    40     (loop)))
    41 
    42 (glfw:destroy-window *window*)
    43 (glfw:terminate)
     65(glfw:with-window (640 480 "Example" resizable: #f)
     66    (glfw:set-key-callback glfw:*window* #$keyCallback)
     67    (let loop ()
     68      (glfw:swap-buffers glfw:*window*)
     69      (glfw:poll-events)
     70      (unless (glfw:window-should-close glfw:*window*)
     71        (loop))))
    4472</enscript>
    4573
     
    4977=== Source
    5078Available on [[https://github.com/AlexCharlton/glfw3-chicken|GitHub]]
     79
     80=== Changelog
     81* 0.2.0: Add {{make-window}}, {{with-window}}
     82* 0.1.0
    5183
    5284=== Licence
Note: See TracChangeset for help on using the changeset viewer.