Permalink
Browse files

Some major refactoring. Key events fully implemented.

  • Loading branch information...
1 parent 1dd93e5 commit 86fe02c0b06761b42d6a2a8fed230d6c588a22b6 @jtza8 jtza8 committed with patzy Oct 10, 2011
View
5 glop.asd
@@ -27,13 +27,12 @@
:serial t
:components ((:file "package")
(:file "carbon")
- (:file "quartz")
(:file "bridge")
(:file "foundation")
(:file "appkit")
+ (:file "quartz")
(:file "glop-app")
- (:file "glop-window-responder")
- (:file "glop-gl-view")
+ (:file "glop-view")
(:file "glop-osx")))
#+(or win32 windows)
(:module "win32"
View
14 src/glop.lisp
@@ -207,6 +207,13 @@ set window fullscreen state."
"Disable cursor display for WINDOW"))
;;; Events handling
+(defmacro define-simple-print-object (type &rest attribs)
+ `(defmethod print-object ((event ,type) stream)
+ (with-slots ,attribs event
+ (format stream
+ ,(format nil "#<~~s~{ ~s ~~s~}>" attribs)
+ (type-of event) ,@attribs))))
+
(defclass event () ()
(:documentation "Common ancestor for all events."))
@@ -216,6 +223,7 @@ set window fullscreen state."
(text :initarg :text :reader text)
(pressed :initarg :pressed :reader pressed))
(:documentation "Keyboard key press or release."))
+(define-simple-print-object key-event keycode keysym text pressed)
(defclass key-press-event (key-event)
()
@@ -231,6 +239,7 @@ set window fullscreen state."
((button :initarg :button :reader button)
(pressed :initarg :pressed :reader pressed))
(:documentation "Mouse button press or release."))
+(define-simple-print-object button-event button pressed)
(defclass button-press-event (button-event)
()
@@ -248,23 +257,27 @@ set window fullscreen state."
(dx :initarg :dx :reader dx)
(dy :initarg :dy :reader dy))
(:documentation "Mouse motion."))
+(define-simple-print-object mouse-motion-event x y dx dy)
(defclass expose-event (event)
((width :initarg :width :reader width)
(height :initarg :height :reader height))
(:documentation "Window expose."))
+(define-simple-print-object expose-event width height)
(defclass resize-event (event)
((width :initarg :width :reader width)
(height :initarg :height :reader height))
(:documentation "Window resized."))
+(define-simple-print-object resize-event width height)
(defclass close-event (event) ()
(:documentation "Window closed."))
(defclass visibility-event (event)
((visible :initarg :visible :reader visible))
(:documentation "Window visibility changed."))
+(define-simple-print-object visibility-event visible)
(defclass visibility-obscured-event (visibility-event)
()
@@ -279,6 +292,7 @@ set window fullscreen state."
(defclass focus-event (event)
((focused :initarg :focused :reader focused))
(:documentation "Window focus state changed."))
+(define-simple-print-object focus-event focused)
(defclass focus-in-event (focus-event)
()
View
133 src/osx/appkit.lisp
@@ -65,23 +65,23 @@
(foreign-enum-keyword 'ns-event-type (%ns-event-type event)))
(defcenum ns-key-code
- :A
- :S
- :D
- :F
- :H
- :G
- :Z
- :X
- :C
- :V
- (:B 11)
- :Q
- :W
- :E
- :R
- :Y
- :T
+ :a
+ :s
+ :d
+ :f
+ :h
+ :g
+ :z
+ :x
+ :c
+ :v
+ (:b 11)
+ :q
+ :w
+ :e
+ :r
+ :y
+ :t
:1
:2
:3
@@ -95,38 +95,39 @@
:8
:0
:|]|
- :O
- :U
+ :o
+ :u
:|[|
- :I
- :P
- :enter
- :L
- :J
+ :i
+ :p
+ :return
+ :l
+ :j
:|'|
- :K
+ :k
(:|;| 41)
:|\\|
:|,|
:|/|
- :N
- :M
+ :n
+ :m
:|.|
:tab
:space
:|`|
(:backspace 51)
- :esc
- (:rsuper 54)
- :lsuper
- :lshift
+ (:escape 53)
+ :super-r
+ :super-l
+ :shift-l
:caps-lock
- :lalt
- :lctrl
- :rshift
- :ralt
- :rctrl
- (:f17 64)
+ :alt-l
+ :ctrl-l
+ :shift-r
+ :alt-r
+ :ctrl-r
+ (:function 63)
+ :f17
:kp-decimal
(:kp-multiply 67)
(:kp-add 69)
@@ -162,24 +163,23 @@
(:f15 113)
:insert
:home
- :pageup
- :del
+ :page-up
+ :delete
:f4
:end
:f2
- :pagedown
+ :page-down
:f1
:left
:right
:down
:up)
-(defcfun ("NSEventKeyCode" %ns-event-key-code) :uint16
+(defcfun ("NSEventKeyCode" ns-event-key-code) :uint16
(event :pointer))
-(defun ns-event-key-code (event)
- (let* ((code (%ns-event-key-code event))
- (key (foreign-enum-keyword 'ns-key-code code :errorp nil)))
+(defun keysym (code)
+ (let* ((key (foreign-enum-keyword 'ns-key-code code :errorp nil)))
(if key key :unknown)))
(defbitfield ns-modifier-flags
@@ -219,6 +219,8 @@
(defcfun ("NSEventDeltaY" ns-event-delta-y) cg-float
(event :pointer))
+(defcfun ("NSEventCharacters" ns-event-characters) ns-string
+ (event :pointer))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; NSApplication ;;;
@@ -240,12 +242,9 @@
(width :int)
(height :int))
-(defcfun ("NSWindowSetTitle" %ns-window-set-title) :pointer
+(defcfun ("NSWindowSetTitle" ns-window-set-title) :void
(window :pointer)
- (title :pointer))
-(defun ns-window-set-title (window title)
- (with-ns-strings ((ns-title title))
- (%ns-window-set-title window ns-title)))
+ (title ns-string))
(defcfun ("NSWindowSetBackgroundColor" ns-window-set-background-color) :void
(window :pointer)
@@ -298,34 +297,23 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-(defcfun ("NSMenuAllocInit" %ns-menu-alloc-init) :pointer
- (title :pointer))
-(defun ns-menu-alloc-init (title)
- (with-ns-strings ((ns-str-title title))
- (%ns-menu-alloc-init ns-str-title)))
+(defcfun ("NSMenuAllocInit" ns-menu-alloc-init) :pointer
+ (title ns-string))
(defcfun ("NSMenuAddItem" ns-menu-add-item) :void
(menu :pointer)
(item :pointer))
-(defcfun ("NSMenuAddItemWithTitle" %ns-menu-add-item-with-title) :void
+(defcfun ("NSMenuAddItemWithTitle" ns-menu-add-item-with-title) :void
(menu :pointer)
- (title :pointer)
+ (title ns-string)
(selector :pointer)
- (key-equiv :pointer))
-(defun ns-menu-add-item-with-title (menu title selector key-equiv)
- (with-ns-strings ((ns-str-title title)
- (ns-str-key-equiv key-equiv))
- (%ns-menu-add-item-with-title menu ns-str-title selector ns-str-key-equiv)))
-
-(defcfun ("NSMenuItemAllocInit" %ns-menu-item-alloc-init) :void
- (title :pointer)
+ (key-equiv ns-string))
+
+(defcfun ("NSMenuItemAllocInit" ns-menu-item-alloc-init) :void
+ (title ns-string)
(selector :pointer)
- (key-equiv :pointer))
-(defun ns-menu-item-alloc-init (title selector key-equiv)
- (with-ns-strings ((ns-str-title title)
- (ns-str-key-equiv key-equiv))
- (%ns-menu-item-alloc-init ns-str-title selector ns-str-key-equiv)))
+ (key-equiv ns-string))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -408,6 +396,13 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(defcfun ("NSOpenGLContextInit" ns-opengl-context-init) :pointer
+ (format :pointer))
+
+(defcfun ("NSOpenGLContextSetView" ns-opengl-context-set-view) :void
+ (context :pointer)
+ (view :pointer))
+
(defcfun ("NSOpenGLContextClearDrawable" ns-opengl-context-clear-drawable) :void
(context :pointer))
View
4 src/osx/bridge/GlopGLView.h
@@ -1,4 +0,0 @@
-#import <Cocoa/Cocoa.h>
-
-@interface GlopGLView : NSOpenGLView
-@end
View
37 src/osx/bridge/GlopGLView.m
@@ -1,37 +0,0 @@
-#import "GlopGLView.h"
-
-@implementation GlopGLView
-
-- (void)drawRect:(NSRect)dirtyRect
-{
-}
-
-@end
-
-
-GlopGLView *GlopGLViewInit (int x, int y, int width, int height,
- NSOpenGLPixelFormat *pixelFormat)
-{
- NSRect frame = NSMakeRect(x, y, width, height);
- return [[GlopGLView alloc] initWithFrame:frame pixelFormat:pixelFormat];
-}
-
-NSOpenGLContext *GlopGLViewOpenGLContext (GlopGLView *view)
-{
- return [view openGLContext];
-}
-
-void GlopGLViewSetOpenGLContext (GlopGLView *view, NSOpenGLContext *context)
-{
- [view setOpenGLContext:context];
-}
-
-void GlopGLViewClearGLContext (GlopGLView *view)
-{
- [view clearGLContext];
-}
-
-void GlopGLViewSetNextResponder (GlopGLView *view, NSResponder *responder)
-{
- [view setNextResponder:responder];
-}
View
4 src/osx/bridge/GlopWindowResponder.h → src/osx/bridge/GlopView.h
@@ -1,9 +1,9 @@
-#import <Appkit/Appkit.h>
+#import <Cocoa/Cocoa.h>
typedef void(*GlopEventCallback)(NSEvent*);
-@interface GlopWindowResponder : NSResponder <NSWindowDelegate>
+@interface GlopView : NSView <NSWindowDelegate>
{
GlopEventCallback eventCallback;
}
View
54 src/osx/bridge/GlopWindowResponder.m → src/osx/bridge/GlopView.m
@@ -1,13 +1,28 @@
-#import "GlopWindowResponder.h"
+#import "GlopView.h"
-@implementation GlopWindowResponder
+@implementation GlopView
-- (id)initWithEventCallback:(GlopEventCallback)callback
+- (id)initWithEventCallback:(GlopEventCallback)callback;
{
eventCallback = callback;
return [self init];
}
+- (BOOL)acceptsFirstResponder
+{
+ return YES;
+}
+
+- (BOOL)canBecomeKeyView
+{
+ return YES;
+}
+
+- (BOOL)isOpaque
+{
+ return YES;
+}
+
- (void)keyUp:(NSEvent *)event
{
eventCallback(event);
@@ -63,40 +78,15 @@ - (void)flagsChanged:(NSEvent *)event
eventCallback(event);
}
-/*
-- (void)mouseDragged:(NSEvent *)event
-{
- eventCallback(event);
-}
-
-- (void)rightMouseDragged:(NSEvent *)event
-{
- eventCallback(event);
-}
-
-- (void)otherMouseDragged:(NSEvent *)event
-{
- eventCallback(event);
-}
-
-- (void)mouseEntered:(NSEvent *)event
-{
- eventCallback(event);
-}
-
-- (void)mouseExited:(NSEvent *)event
-{
- eventCallback(event);
-}
-*/
-
- (void)windowWillClose:(NSNotification *)notification
{
}
@end
-GlopWindowResponder *GlopWindowResponderInit (GlopEventCallback callback)
+
+GlopView *GlopViewInit (GlopEventCallback callback)
{
- return [[GlopWindowResponder alloc] initWithEventCallback:callback];
+ return [[GlopView alloc] initWithEventCallback:callback];
}
+
View
2 src/osx/bridge/Makefile
@@ -1,5 +1,5 @@
CFLAGS=-Wall
-OBJ=foundation.o appkit.o GlopApp.o GlopWindowResponder.o GlopGLView.o
+OBJ=foundation.o appkit.o GlopApp.o GlopView.o
all: glop-bridge.dylib
View
16 src/osx/bridge/appkit.m
@@ -67,6 +67,11 @@ CGFloat NSEventDeltaY (NSEvent *event)
return [event deltaY];
}
+NSString *NSEventCharacters (NSEvent *event)
+{
+ return [event characters];
+}
+
/******************************************************************************/
/*** NSApplication ***/
@@ -210,6 +215,17 @@ void NSMenuAddItemWithTitle (NSMenu *menu, NSString *title, SEL selector,
/******************************************************************************/
+NSOpenGLContext *NSOpenGLContextInit (NSOpenGLPixelFormat *format)
+{
+ return [[NSOpenGLContext alloc] initWithFormat:format
+ shareContext:nil];
+}
+
+void NSOpenGLContextSetView (NSOpenGLContext *context, NSView *view)
+{
+ [context setView:view];
+}
+
void NSOpenGLContextClearDrawable (NSOpenGLContext *context)
{
[context clearDrawable];
View
BIN src/osx/bridge/glop-bridge.dylib
Binary file not shown.
View
51 src/osx/foundation.lisp
@@ -60,11 +60,17 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(define-foreign-type ns-string-type ()
+ ((ns-string :initform nil
+ :accessor ns-string))
+ (:actual-type :pointer)
+ (:simple-parser ns-string))
+
(defcenum ns-string-encoding
(:ascii 1)
(:nextstep 2)
(:japanese-euc 3)
- (:utf8 4)
+ (:utf-8 4)
(:iso-latin-1 5)
(:symbol 6)
(:non-lossy-ascii 7)
@@ -78,12 +84,12 @@
(:windows-cp-1250 15)
(:iso-2022-jp 21)
(:mac-os-roman 30)
- (:utf16 10)
- (:utf16-big-endian #x90000100)
- (:utf16-little-endian #x94000100)
- (:utf32 #x8c000100)
- (:utf32-big-endian #x98000100)
- (:utf32-little-endian #x9c000100)
+ (:utf-16 10)
+ (:utf-16-big-endian #x90000100)
+ (:utf-16-little-endian #x94000100)
+ (:utf-32 #x8c000100)
+ (:utf-32-big-endian #x98000100)
+ (:utf-32-little-endian #x9c000100)
(:proprietary 65536))
(defcfun ("NSStringCStringUsingEncoding" ns-string-c-string-using-encoding)
@@ -96,17 +102,21 @@
(string :string)
(encodign ns-string-encoding))
-(defun ns-string-to-lisp-string (ns-string)
- (with-ns-autorelease-pool
- (ns-string-c-string-using-encoding ns-string :iso-latin-1)))
+(defmethod translate-from-foreign (ns-string (type ns-string-type))
+ (ns-string-c-string-using-encoding ns-string :utf-8))
+
+(defmethod translate-to-foreign (lisp-string (type ns-string-type))
+ (let ((buffer-size (1+ (length lisp-string))))
+ (with-foreign-object (buffer :char buffer-size)
+ (setf (ns-string type)
+ (ns-string-alloc-init-with-c-string
+ (lisp-string-to-foreign lisp-string buffer buffer-size
+ :encoding :utf-8)
+ :utf-8)))))
-(defmacro with-ns-strings ((&rest vars-and-strings) &body body)
- `(with-ns-autorelease-pool
- (let ,(loop for (var string) in vars-and-strings
- collect `(,var (ns-autorelease
- (ns-string-alloc-init-with-c-string
- ,string :iso-latin-1))))
- ,@body)))
+(defmethod free-translated-object (pointer (type ns-string-type) param)
+ (declare (ignore param))
+ (ns-release (ns-string type)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -134,8 +144,5 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-(defcfun ("NSSelectorFromString" %ns-selector-from-string) :pointer
- (string :pointer))
-(defun ns-selector-from-string (string)
- (with-ns-strings ((ns-string string))
- (%ns-selector-from-string ns-string)))
+(defcfun ("NSSelectorFromString" ns-selector-from-string) :pointer
+ (string ns-string))
View
22 src/osx/glop-gl-view.lisp
@@ -1,22 +0,0 @@
-(in-package :glop-bridge)
-
-(defcfun ("GlopGLViewInit" glop-gl-view-init) :pointer
- (x :int)
- (y :int)
- (width :int)
- (height :int)
- (pixel-format :pointer))
-
-(defcfun ("GlopGLViewOpenGLContext" glop-gl-view-opengl-context) :pointer
- (view :pointer))
-
-(defcfun ("GlopGLViewSetOpenGLContext" glop-gl-view-set-opengl-context) :void
- (view :pointer)
- (context :pointer))
-
-(defcfun ("GlopGLViewClearGLContext" glop-gl-view-clear-gl-context) :void
- (view :pointer))
-
-(defcfun ("GlopGLViewSetNextResponder" glop-gl-view-set-next-responder) :void
- (view :pointer)
- (responder :pointer))
View
61 src/osx/glop-osx.lisp
@@ -4,7 +4,6 @@
(defparameter *opengl-bundle* nil)
(defparameter *main-menu* nil)
(defparameter *event-stacks* (make-hash-table))
-(defparameter *active-modifiers* '())
(defun event-stack (ns-window)
(gethash (cffi:pointer-address ns-window) *event-stacks*))
@@ -75,21 +74,25 @@
(event
(case event-type
((:key-down :key-up)
- (let ((pressed (eq event-type :key-down)))
- (make-instance (if pressed 'key-press-event 'key-release-event)
- :pressed pressed
- :keysym (glop-bridge:ns-event-key-code ns-event)
- :keycode 0)))
+ (let ((keycode (glop-bridge:ns-event-key-code ns-event))
+ (pressed (eq event-type :key-down)))
+ (unless (and *ignore-auto-repeat*
+ (eq (key-pressed keycode) pressed))
+ (setf (key-pressed keycode) pressed)
+ (make-instance (if pressed 'key-press-event 'key-release-event)
+ :pressed pressed
+ :keycode keycode
+ :keysym (glop-bridge:keysym keycode)
+ :text (glop-bridge:ns-event-characters ns-event)))))
(:flags-changed
- (let* ((keysym (glop-bridge:ns-event-key-code ns-event))
- (pressed (null (find keysym *active-modifiers*))))
- (if pressed
- (push keysym *active-modifiers*)
- (setf *active-modifiers* (delete keysym *active-modifiers*)))
+ (let* ((keycode (glop-bridge:ns-event-key-code ns-event))
+ (pressed (not (key-pressed keycode))))
+ (setf (key-pressed keycode) pressed)
(make-instance (if pressed 'key-press-event 'key-release-event)
:pressed pressed
- :keysym keysym
- :keycode 0)))
+ :keysym (glop-bridge:keysym keycode)
+ :keycode keycode
+ :text "")))
(:mouse-moved
(destructuring-bind (x y)
(glop-bridge:ns-event-location-in-window ns-event)
@@ -131,19 +134,19 @@
(when double-buffer (push :double-buffer pf-list))
(when stereo (push :stereo pf-list))
(setf (pixel-format-list window) pf-list))
- (with-accessors ((ns-window ns-window)) window
- (let ((responder (glop-bridge:glop-window-responder-init
- (cffi:callback push-event-to-stack))))
- (setf ns-window
- (glop-bridge:ns-window-alloc-init
- x (- (+ (video-mode-height (current-video-mode)) height) y)
- width height)
- (event-stack ns-window) '())
- (glop-bridge:ns-window-discard-remaining-events ns-window)
- (glop-bridge:ns-window-set-delegate ns-window responder)
- (glop-bridge:ns-window-set-accepts-mouse-moved-events ns-window t)
- (glop-bridge:ns-window-set-next-responder ns-window responder)
- (glop-bridge:ns-window-set-title ns-window title))))
+ (with-accessors ((ns-window ns-window) (gl-view gl-view)) window
+ (setf gl-view
+ (glop-bridge:glop-view-init (cffi:callback push-event-to-stack))
+ ns-window
+ (glop-bridge:ns-window-alloc-init
+ x (- (+ (video-mode-height (current-video-mode)) height) y)
+ width height)
+ (event-stack ns-window) '())
+ (glop-bridge:ns-window-discard-remaining-events ns-window)
+ (glop-bridge:ns-window-set-accepts-mouse-moved-events ns-window t)
+ (glop-bridge:ns-window-set-content-view ns-window gl-view)
+ (glop-bridge:ns-window-set-delegate ns-window gl-view)
+ (glop-bridge:ns-window-set-title ns-window title)))
(defmethod set-window-title ((window osx-window) title)
(glop-bridge:ns-window-set-title (ns-window window) title))
@@ -172,10 +175,8 @@
(let ((pixel-format (glop-bridge:ns-autorelease
(glop-bridge:ns-opengl-pixel-format-init
pixel-format-list))))
- (setf gl-view (glop-bridge:glop-gl-view-init 0 0 width height
- pixel-format)
- gl-context (glop-bridge:glop-gl-view-opengl-context gl-view))))
- (glop-bridge:ns-window-set-content-view ns-window gl-view)))
+ (setf gl-context (glop-bridge:ns-opengl-context-init pixel-format))))
+ (glop-bridge:ns-opengl-context-set-view gl-context gl-view)))
(defmethod destroy-gl-context (context)
(glop-bridge:ns-opengl-context-clear-drawable context)
View
4 src/osx/glop-view.lisp
@@ -0,0 +1,4 @@
+(in-package :glop-bridge)
+
+(defcfun ("GlopViewInit" glop-view-init) :pointer
+ (event-callback :pointer))
View
4 src/osx/glop-window-responder.lisp
@@ -1,4 +0,0 @@
-(in-package :glop-bridge)
-
-(defcfun ("GlopWindowResponderInit" glop-window-responder-init) :pointer
- (callback :pointer))
View
14 src/osx/package.lisp
@@ -60,19 +60,14 @@
#:transform-current-process-type
#:transform-process-type
#:with-ns-autorelease-pool
- #:with-ns-strings
- #:glop-gl-view-init
+ #:glop-view-init
#:ns-window-set-content-view
#:ns-opengl-pixel-format-init
- #:glop-gl-view-opengl-context
- #:glop-gl-view-set-opengl-context
- #:glop-gl-view-clear-gl-context
#:ns-opengl-context-clear-drawable
#:ns-event-type
#:glop-window-responder-init
#:ns-window-set-delegate
#:ns-window-set-next-responder
- #:glop-gl-view-set-next-responder
#:ns-window-set-accepts-mouse-moved-events
#:ns-event-window
#:ns-event-location-in-window
@@ -82,4 +77,9 @@
#:ns-opengl-context-flush-buffer
#:ns-event-key-code
#:ns-event-modifier-flags
- #:ns-window-discard-remaining-events))
+ #:ns-window-discard-remaining-events
+ #:ns-opengl-context-init
+ #:ns-opengl-context-set-view
+ #:ns-event-key-sym
+ #:ns-event-characters
+ #:keysym))
View
4 src/osx/quartz.lisp
@@ -18,7 +18,5 @@
(mode :pointer))
(defcfun ("CGDisplayModeGetRefreshRate" mode-rate) :double
(mode :pointer))
-(defcfun ("CGDisplayModeCopyPixelEncoding" %mode-pixel-encoding) :pointer
+(defcfun ("CGDisplayModeCopyPixelEncoding" mode-pixel-encoding) ns-string
(mode :pointer))
-(defun mode-pixel-encoding (mode)
- (ns-string-to-lisp-string (%mode-pixel-encoding mode)))
View
6 src/utils.lisp
@@ -79,10 +79,8 @@ Otherwise, only one key-press event will be triggered.")
(defun key-pressed (keycode)
(aref %key-states% keycode))
-(defun %set-key-pressed (keycode value)
- (setf (aref %key-states% keycode) value))
-
-(defsetf key-pressed %set-key-pressed)
+(defsetf key-pressed (keycode) (value)
+ `(setf (aref %key-states% ,keycode) ,value))
;; Helper macros from bordeaux-threads
;; http://common-lisp.net/project/bordeaux-threads/

0 comments on commit 86fe02c

Please sign in to comment.