Hack to make it work with CCL
authorBill Robinson <airbaggins@gmail.com>
Wed, 5 Jan 2011 23:17:51 +0000 (5 23:17 +0000)
committerBill Robinson <airbaggins@gmail.com>
Wed, 5 Jan 2011 23:17:51 +0000 (5 23:17 +0000)
lib/glfw.lisp

index b4ece50..da5eb35 100644 (file)
 (in-package #:cl-glfw)
 
-(defconstant +false+ 0)
-(defconstant +true+ 1)
-
-
-;; Key and button state/action definitions
-(defconstant +release+ 0)
-(defconstant +press+ 1)
-
-;; Keyboard key definitions: 8-bit ISO-8859-1 (Latin 1) encoding is used
-;; for printable keys (such as A-Z, 0-9 etc), and values above 256
-;; represent special (non-printable) keys (e.g. F1, Page Up etc).
-(defconstant +key-unknown+ -1)
-(defconstant +key-space+ 32)
-(defconstant +key-special+ 256)
-(defconstant +key-esc+ (+ +key-special+ 1))
-(defconstant +key-f1+ (+ +key-special+ 2))
-(defconstant +key-f2+ (+ +key-special+ 3))
-(defconstant +key-f3+ (+ +key-special+ 4))
-(defconstant +key-f4+ (+ +key-special+ 5))
-(defconstant +key-f5+ (+ +key-special+ 6))
-(defconstant +key-f6+ (+ +key-special+ 7))
-(defconstant +key-f7+ (+ +key-special+ 8))
-(defconstant +key-f8+ (+ +key-special+ 9))
-(defconstant +key-f9+ (+ +key-special+ 10))
-(defconstant +key-f10+ (+ +key-special+ 11))
-(defconstant +key-f11+ (+ +key-special+ 12))
-(defconstant +key-f12+ (+ +key-special+ 13))
-(defconstant +key-f13+ (+ +key-special+ 14))
-(defconstant +key-f14+ (+ +key-special+ 15))
-(defconstant +key-f15+ (+ +key-special+ 16))
-(defconstant +key-f16+ (+ +key-special+ 17))
-(defconstant +key-f17+ (+ +key-special+ 18))
-(defconstant +key-f18+ (+ +key-special+ 19))
-(defconstant +key-f19+ (+ +key-special+ 20))
-(defconstant +key-f20+ (+ +key-special+ 21))
-(defconstant +key-f21+ (+ +key-special+ 22))
-(defconstant +key-f22+ (+ +key-special+ 23))
-(defconstant +key-f23+ (+ +key-special+ 24))
-(defconstant +key-f24+ (+ +key-special+ 25))
-(defconstant +key-f25+ (+ +key-special+ 26))
-(defconstant +key-up+ (+ +key-special+ 27))
-(defconstant +key-down+ (+ +key-special+ 28))
-(defconstant +key-left+ (+ +key-special+ 29))
-(defconstant +key-right+ (+ +key-special+ 30))
-(defconstant +key-lshift+ (+ +key-special+ 31))
-(defconstant +key-rshift+ (+ +key-special+ 32))
-(defconstant +key-lctrl+ (+ +key-special+ 33))
-(defconstant +key-rctrl+ (+ +key-special+ 34))
-(defconstant +key-lalt+ (+ +key-special+ 35))
-(defconstant +key-ralt+ (+ +key-special+ 36))
-(defconstant +key-tab+ (+ +key-special+ 37))
-(defconstant +key-enter+ (+ +key-special+ 38))
-(defconstant +key-backspace+ (+ +key-special+ 39))
-(defconstant +key-insert+ (+ +key-special+ 40))
-(defconstant +key-del+ (+ +key-special+ 41))
-(defconstant +key-pageup+ (+ +key-special+ 42))
-(defconstant +key-pagedown+ (+ +key-special+ 43))
-(defconstant +key-home+ (+ +key-special+ 44))
-(defconstant +key-end+ (+ +key-special+ 45))
-(defconstant +key-kp-0+ (+ +key-special+ 46))
-(defconstant +key-kp-1+ (+ +key-special+ 47))
-(defconstant +key-kp-2+ (+ +key-special+ 48))
-(defconstant +key-kp-3+ (+ +key-special+ 49))
-(defconstant +key-kp-4+ (+ +key-special+ 50))
-(defconstant +key-kp-5+ (+ +key-special+ 51))
-(defconstant +key-kp-6+ (+ +key-special+ 52))
-(defconstant +key-kp-7+ (+ +key-special+ 53))
-(defconstant +key-kp-8+ (+ +key-special+ 54))
-(defconstant +key-kp-9+ (+ +key-special+ 55))
-(defconstant +key-kp-divide+ (+ +key-special+ 56))
-(defconstant +key-kp-multiply+ (+ +key-special+ 57))
-(defconstant +key-kp-subtract+ (+ +key-special+ 58))
-(defconstant +key-kp-add+ (+ +key-special+ 59))
-(defconstant +key-kp-decimal+ (+ +key-special+ 60))
-(defconstant +key-kp-equal+ (+ +key-special+ 61))
-(defconstant +key-kp-enter+ (+ +key-special+ 62))
-(defconstant +key-last+ +key-kp-enter+)
-
-;; Mouse button definitions
-(defconstant +mouse-button-1+ 0)
-(defconstant +mouse-button-2+ 1)
-(defconstant +mouse-button-3+ 2)
-(defconstant +mouse-button-4+ 3)
-(defconstant +mouse-button-5+ 4)
-(defconstant +mouse-button-6+ 5)
-(defconstant +mouse-button-7+ 6)
-(defconstant +mouse-button-8+ 7)
-(defconstant +mouse-button-last+ +mouse-button-8+)
-
-;; Mouse button aliases
-(defconstant +mouse-button-left+ +mouse-button-1+)
-(defconstant +mouse-button-right+ +mouse-button-2+)
-(defconstant +mouse-button-middle+ +mouse-button-3+)
-
-;; Joystick identifiers
-(defconstant +joystick-1+ 0)
-(defconstant +joystick-2+ 1)
-(defconstant +joystick-3+ 2)
-(defconstant +joystick-4+ 3)
-(defconstant +joystick-5+ 4)
-(defconstant +joystick-6+ 5)
-(defconstant +joystick-7+ 6)
-(defconstant +joystick-8+ 7)
-(defconstant +joystick-9+ 8)
-(defconstant +joystick-10+ 9)
-(defconstant +joystick-11+ 10)
-(defconstant +joystick-12+ 11)
-(defconstant +joystick-13+ 12)
-(defconstant +joystick-14+ 13)
-(defconstant +joystick-15+ 14)
-(defconstant +joystick-16+ 15)
-(defconstant +joystick-last+ +joystick-16+)
-
-
-;;========================================================================
- ;; Other definitions
-;;========================================================================
-
-;; glfwOpenWindow modes
-(defconstant +window+ #x00010001)
-(defconstant +fullscreen+ #x00010002)
-
-;; glfwGetWindowParam tokens
-(defconstant +opened+ #x00020001)
-(defconstant +active+ #x00020002)
-(defconstant +iconified+ #x00020003)
-(defconstant +accelerated+ #x00020004)
-(defconstant +red-bits+ #x00020005)
-(defconstant +green-bits+ #x00020006)
-(defconstant +blue-bits+ #x00020007)
-(defconstant +alpha-bits+ #x00020008)
-(defconstant +depth-bits+ #x00020009)
-(defconstant +stencil-bits+ #x0002000a)
-
-;; The following constants are used for both glfwGetWindowParam
-;; and glfwOpenWindowHint
-(defconstant +refresh-rate+ #x0002000b)
-(defconstant +accum-red-bits+ #x0002000c)
-(defconstant +accum-green-bits+ #x0002000d)
-(defconstant +accum-blue-bits+ #x0002000e)
-(defconstant +accum-alpha-bits+ #x0002000f)
-(defconstant +aux-buffers+ #x00020010)
-(defconstant +stereo+ #x00020011)
-(defconstant +window-no-resize+ #x00020012)
-(defconstant +fsaa-samples+ #x00020013)
-
-;; glfwEnable/glfwDisable tokens
-(defconstant +mouse-cursor+ #x00030001)
-(defconstant +sticky-keys+ #x00030002)
-(defconstant +sticky-mouse-buttons+ #x00030003)
-(defconstant +system-keys+ #x00030004)
-(defconstant +key-repeat+ #x00030005)
-(defconstant +auto-poll-events+ #x00030006)
-
-;; glfwWaitThread wait modes
-(defconstant +wait+ #x00040001)
-(defconstant +nowait+ #x00040002)
-
-;; glfwGetJoystickParam tokens
-(defconstant +present+ #x00050001)
-(defconstant +axes+ #x00050002)
-(defconstant +buttons+ #x00050003)
-
-;; glfwReadImage/glfwLoadTexture2D flags
-(defconstant +no-rescale-bit+ #x00000001) ; Only for glfwReadImage
-(defconstant +origin-ul-bit+ #x00000002)
-(defconstant +build-mipmaps-bit+ #x00000004) ; Only for glfwLoadTexture2D
-(defconstant +alpha-map-bit+ #x00000008)
-
-;; Time spans longer than this (seconds) are considered to be infinity
-(defconstant +infinity+ 100000d0)
+(eval-when (:compile-toplevel :load-toplevel)
+  (defconstant +false+ 0)
+  (defconstant +true+ 1)
+
+
+  ;; Key and button state/action definitions
+  (defconstant +release+ 0)
+  (defconstant +press+ 1)
+
+  ;; Keyboard key definitions: 8-bit ISO-8859-1 (Latin 1) encoding is used
+  ;; for printable keys (such as A-Z, 0-9 etc), and values above 256
+  ;; represent special (non-printable) keys (e.g. F1, Page Up etc).
+  (defconstant +key-unknown+ -1)
+  (defconstant +key-space+ 32)
+  (defconstant +key-special+ 256)
+  (defconstant +key-esc+ (+ +key-special+ 1))
+  (defconstant +key-f1+ (+ +key-special+ 2))
+  (defconstant +key-f2+ (+ +key-special+ 3))
+  (defconstant +key-f3+ (+ +key-special+ 4))
+  (defconstant +key-f4+ (+ +key-special+ 5))
+  (defconstant +key-f5+ (+ +key-special+ 6))
+  (defconstant +key-f6+ (+ +key-special+ 7))
+  (defconstant +key-f7+ (+ +key-special+ 8))
+  (defconstant +key-f8+ (+ +key-special+ 9))
+  (defconstant +key-f9+ (+ +key-special+ 10))
+  (defconstant +key-f10+ (+ +key-special+ 11))
+  (defconstant +key-f11+ (+ +key-special+ 12))
+  (defconstant +key-f12+ (+ +key-special+ 13))
+  (defconstant +key-f13+ (+ +key-special+ 14))
+  (defconstant +key-f14+ (+ +key-special+ 15))
+  (defconstant +key-f15+ (+ +key-special+ 16))
+  (defconstant +key-f16+ (+ +key-special+ 17))
+  (defconstant +key-f17+ (+ +key-special+ 18))
+  (defconstant +key-f18+ (+ +key-special+ 19))
+  (defconstant +key-f19+ (+ +key-special+ 20))
+  (defconstant +key-f20+ (+ +key-special+ 21))
+  (defconstant +key-f21+ (+ +key-special+ 22))
+  (defconstant +key-f22+ (+ +key-special+ 23))
+  (defconstant +key-f23+ (+ +key-special+ 24))
+  (defconstant +key-f24+ (+ +key-special+ 25))
+  (defconstant +key-f25+ (+ +key-special+ 26))
+  (defconstant +key-up+ (+ +key-special+ 27))
+  (defconstant +key-down+ (+ +key-special+ 28))
+  (defconstant +key-left+ (+ +key-special+ 29))
+  (defconstant +key-right+ (+ +key-special+ 30))
+  (defconstant +key-lshift+ (+ +key-special+ 31))
+  (defconstant +key-rshift+ (+ +key-special+ 32))
+  (defconstant +key-lctrl+ (+ +key-special+ 33))
+  (defconstant +key-rctrl+ (+ +key-special+ 34))
+  (defconstant +key-lalt+ (+ +key-special+ 35))
+  (defconstant +key-ralt+ (+ +key-special+ 36))
+  (defconstant +key-tab+ (+ +key-special+ 37))
+  (defconstant +key-enter+ (+ +key-special+ 38))
+  (defconstant +key-backspace+ (+ +key-special+ 39))
+  (defconstant +key-insert+ (+ +key-special+ 40))
+  (defconstant +key-del+ (+ +key-special+ 41))
+  (defconstant +key-pageup+ (+ +key-special+ 42))
+  (defconstant +key-pagedown+ (+ +key-special+ 43))
+  (defconstant +key-home+ (+ +key-special+ 44))
+  (defconstant +key-end+ (+ +key-special+ 45))
+  (defconstant +key-kp-0+ (+ +key-special+ 46))
+  (defconstant +key-kp-1+ (+ +key-special+ 47))
+  (defconstant +key-kp-2+ (+ +key-special+ 48))
+  (defconstant +key-kp-3+ (+ +key-special+ 49))
+  (defconstant +key-kp-4+ (+ +key-special+ 50))
+  (defconstant +key-kp-5+ (+ +key-special+ 51))
+  (defconstant +key-kp-6+ (+ +key-special+ 52))
+  (defconstant +key-kp-7+ (+ +key-special+ 53))
+  (defconstant +key-kp-8+ (+ +key-special+ 54))
+  (defconstant +key-kp-9+ (+ +key-special+ 55))
+  (defconstant +key-kp-divide+ (+ +key-special+ 56))
+  (defconstant +key-kp-multiply+ (+ +key-special+ 57))
+  (defconstant +key-kp-subtract+ (+ +key-special+ 58))
+  (defconstant +key-kp-add+ (+ +key-special+ 59))
+  (defconstant +key-kp-decimal+ (+ +key-special+ 60))
+  (defconstant +key-kp-equal+ (+ +key-special+ 61))
+  (defconstant +key-kp-enter+ (+ +key-special+ 62))
+  (defconstant +key-last+ +key-kp-enter+)
+
+  ;; Mouse button definitions
+  (defconstant +mouse-button-1+ 0)
+  (defconstant +mouse-button-2+ 1)
+  (defconstant +mouse-button-3+ 2)
+  (defconstant +mouse-button-4+ 3)
+  (defconstant +mouse-button-5+ 4)
+  (defconstant +mouse-button-6+ 5)
+  (defconstant +mouse-button-7+ 6)
+  (defconstant +mouse-button-8+ 7)
+  (defconstant +mouse-button-last+ +mouse-button-8+)
+
+  ;; Mouse button aliases
+  (defconstant +mouse-button-left+ +mouse-button-1+)
+  (defconstant +mouse-button-right+ +mouse-button-2+)
+  (defconstant +mouse-button-middle+ +mouse-button-3+)
+
+  ;; Joystick identifiers
+  (defconstant +joystick-1+ 0)
+  (defconstant +joystick-2+ 1)
+  (defconstant +joystick-3+ 2)
+  (defconstant +joystick-4+ 3)
+  (defconstant +joystick-5+ 4)
+  (defconstant +joystick-6+ 5)
+  (defconstant +joystick-7+ 6)
+  (defconstant +joystick-8+ 7)
+  (defconstant +joystick-9+ 8)
+  (defconstant +joystick-10+ 9)
+  (defconstant +joystick-11+ 10)
+  (defconstant +joystick-12+ 11)
+  (defconstant +joystick-13+ 12)
+  (defconstant +joystick-14+ 13)
+  (defconstant +joystick-15+ 14)
+  (defconstant +joystick-16+ 15)
+  (defconstant +joystick-last+ +joystick-16+)
+
+
+  ;;========================================================================
+  ;; Other definitions
+  ;;========================================================================
+
+  ;; glfwOpenWindow modes
+  (defconstant +window+ #x00010001)
+  (defconstant +fullscreen+ #x00010002)
+
+  ;; glfwGetWindowParam tokens
+  (defconstant +opened+ #x00020001)
+  (defconstant +active+ #x00020002)
+  (defconstant +iconified+ #x00020003)
+  (defconstant +accelerated+ #x00020004)
+  (defconstant +red-bits+ #x00020005)
+  (defconstant +green-bits+ #x00020006)
+  (defconstant +blue-bits+ #x00020007)
+  (defconstant +alpha-bits+ #x00020008)
+  (defconstant +depth-bits+ #x00020009)
+  (defconstant +stencil-bits+ #x0002000a)
+
+  ;; The following constants are used for both glfwGetWindowParam
+  ;; and glfwOpenWindowHint
+  (defconstant +refresh-rate+ #x0002000b)
+  (defconstant +accum-red-bits+ #x0002000c)
+  (defconstant +accum-green-bits+ #x0002000d)
+  (defconstant +accum-blue-bits+ #x0002000e)
+  (defconstant +accum-alpha-bits+ #x0002000f)
+  (defconstant +aux-buffers+ #x00020010)
+  (defconstant +stereo+ #x00020011)
+  (defconstant +window-no-resize+ #x00020012)
+  (defconstant +fsaa-samples+ #x00020013)
+
+  ;; glfwEnable/glfwDisable tokens
+  (defconstant +mouse-cursor+ #x00030001)
+  (defconstant +sticky-keys+ #x00030002)
+  (defconstant +sticky-mouse-buttons+ #x00030003)
+  (defconstant +system-keys+ #x00030004)
+  (defconstant +key-repeat+ #x00030005)
+  (defconstant +auto-poll-events+ #x00030006)
+
+  ;; glfwWaitThread wait modes
+  (defconstant +wait+ #x00040001)
+  (defconstant +nowait+ #x00040002)
+
+  ;; glfwGetJoystickParam tokens
+  (defconstant +present+ #x00050001)
+  (defconstant +axes+ #x00050002)
+  (defconstant +buttons+ #x00050003)
+
+  ;; glfwReadImage/glfwLoadTexture2D flags
+  (defconstant +no-rescale-bit+ #x00000001) ; Only for glfwReadImage
+  (defconstant +origin-ul-bit+ #x00000002)
+  (defconstant +build-mipmaps-bit+ #x00000004) ; Only for glfwLoadTexture2D
+  (defconstant +alpha-map-bit+ #x00000008)
+
+  ;; Time spans longer than this (seconds) are considered to be infinity
+  (defconstant +infinity+ 100000d0))
 
 (defparameter *was-init* nil
   "True if we have already initialized.")