Compiled meshes work
[lambdamundo.git] / keyboard.lisp
blob211c8210b2e0b8b0481e6763e5eec79abc82c117
2 (in-package :lambdamundo)
4 ;; keyboard handling --------------------
7 (defparameter *standard-key-fns* (make-hash-table)
8 "Hash table to map keypresses to function calls")
10 (defparameter *console-key-fns* (make-hash-table)
11 "Hash table to map keypresses to function calls")
14 (defparameter *mouse-free* t
15 "Indicates whether the mouse pointer is free or not")
17 (defmacro make-key-function (fn-table (key action-sym) &body forms)
18 "Compile a body and place it in the key hashtable, to be called
19 when the given key is pressed."
20 `(setf (gethash ,key ,fn-table)
21 (compile nil '(lambda (,action-sym) ,@forms))))
23 (defmacro make-key-press-function (fn-table (key action-sym) &body forms)
24 "Compile a body and place it in the key hashtable, to be called
25 when the given key is pressed."
26 `(setf (gethash ,key ,fn-table)
27 (compile nil '(lambda (,action-sym)
28 (when (= ,action-sym glfw:+press+) ,@forms)))))
30 (defun kill-key-function (fn-table key)
31 "Remove a key function from the list"
32 (remhash key fn-table))