[Fluxus] Key events
Carlos Alegria
ccristoo at gmail.com
Fri Jun 8 11:11:31 PDT 2012
Hi Kassen and Gabor, thanks a lot for your help.
Gabor,
Yes I am using fluxus from the Git repository. To have that included would
be great!!, and indeed, more general solution (and in fact, more like the
solution I was looking for). In fact I think it would be great to have an
OpenGL-like list of keys, each one for key-down, key-pressed, and
key-release events.
I am just beginning with fluxus/scheme and in general, functional
programming. I hope to be able to contribute to Fluxus code soon with this
kind of features.
Again, thanks a lot for your quick response.
Carlos
-----Original Message-----
From: gabor papp [mailto:gabor.lists at mndl.hu]
Sent: viernes, 08 de junio de 2012 12:40
To: Carlos Alegria
Cc: 'Kassen'; 'gabor papp'; 'Fluxus'
Subject: RE: [Fluxus] Key events
hi Carlos,
> true in the frame where I press the space bar for the first time, but
> also at some other frames after the first one, when the space bar is
> pressed
yes, as Kassen already mentioned this is normal and comes from the keyboard
repeat.
> I took a look into modules/scheme/input.ss to try to implement this
> behavior as you said, but as I am new to fluxus I would first get
> familiar with its
sorry for bringing that solution up. it is probably too complex for this
problem. i thought you need callbacks on key presses.
> source code. Thus, I ended up implementing all using
> (key-pressed-this-frame " "):
clever solution. as i see you are detecting key release.
are you using fluxus from git? maybe we should add a (key-released) function
which could make this simpler.
something like this would be more general for now:
(define PLAY #f)
(define key-released
(let ([keys-down-last '()])
(lambda (key)
(let* ([keych (string-ref key 0)]
[released (and (member keych keys-down-last)
(not (member keych (keys-down))))])
(set! keys-down-last (keys-down))
released))))
(define (render)
(when (key-released " ")
(set! PLAY (not PLAY)))
(when PLAY
...))
(every-frame (render))
best,
gabor
More information about the Fluxus
mailing list