Revise keys.
This commit is contained in:
@ -27,13 +27,12 @@
|
|||||||
\ mouse-x ( -- n )
|
\ mouse-x ( -- n )
|
||||||
\ mouse-y ( -- n )
|
\ mouse-y ( -- n )
|
||||||
\ last-key ( -- n )
|
\ last-key ( -- n )
|
||||||
\ last-keysym ( -- n )
|
\ last-char ( -- n )
|
||||||
\ last-keycode ( -- n )
|
|
||||||
\ pressed? ( k -- f )
|
\ pressed? ( k -- f )
|
||||||
\ event ( -- n )
|
\ event ( -- n )
|
||||||
\ Event constants:
|
\ Event constants:
|
||||||
\ UNKNOWN TIMEOUT RESIZED EXPOSED
|
\ UNKNOWN TIMEOUT RESIZED EXPOSED MOTION
|
||||||
\ MOTION PRESSED RELEASED FINISHED
|
\ PRESSED RELEASED TYPED FINISHED
|
||||||
\ Key/Button constants:
|
\ Key/Button constants:
|
||||||
\ LEFT-BUTTON MIDDLE-BUTTON RIGHT-BUTTON
|
\ LEFT-BUTTON MIDDLE-BUTTON RIGHT-BUTTON
|
||||||
|
|
||||||
@ -47,7 +46,8 @@ vocabulary internals
|
|||||||
4 constant MOTION
|
4 constant MOTION
|
||||||
5 constant PRESSED
|
5 constant PRESSED
|
||||||
6 constant RELEASED
|
6 constant RELEASED
|
||||||
7 constant FINISHED
|
7 constant TYPED
|
||||||
|
8 constant FINISHED
|
||||||
|
|
||||||
255 constant LEFT-BUTTON
|
255 constant LEFT-BUTTON
|
||||||
254 constant MIDDLE-BUTTON
|
254 constant MIDDLE-BUTTON
|
||||||
@ -56,8 +56,7 @@ vocabulary internals
|
|||||||
0 value mouse-x
|
0 value mouse-x
|
||||||
0 value mouse-y
|
0 value mouse-y
|
||||||
0 value last-key
|
0 value last-key
|
||||||
0 value last-keysym
|
0 value last-char
|
||||||
0 value last-keycode
|
|
||||||
0 value event
|
0 value event
|
||||||
0 value width
|
0 value width
|
||||||
0 value height
|
0 value height
|
||||||
|
|||||||
@ -18,8 +18,16 @@ grf
|
|||||||
: run
|
: run
|
||||||
begin
|
begin
|
||||||
wait
|
wait
|
||||||
0 to color
|
PRESSED event = if
|
||||||
0 0 width height box
|
." DOWN: " last-key . cr
|
||||||
|
then
|
||||||
|
RELEASED event = if
|
||||||
|
." UP: " last-key . cr
|
||||||
|
then
|
||||||
|
TYPED event = if
|
||||||
|
." CHAR: " last-char . cr
|
||||||
|
then
|
||||||
|
0 to color 0 0 width height box
|
||||||
LEFT-BUTTON pressed? if $ccccff else $ffccff then to color
|
LEFT-BUTTON pressed? if $ccccff else $ffccff then to color
|
||||||
mouse-x mouse-y height heart
|
mouse-x mouse-y height heart
|
||||||
flip
|
flip
|
||||||
|
|||||||
@ -85,19 +85,27 @@ cell allocate throw to backbuffer
|
|||||||
0 exit
|
0 exit
|
||||||
then
|
then
|
||||||
WM_KEYDOWN msg = if
|
WM_KEYDOWN msg = if
|
||||||
|
w 0 max 255 min to last-key
|
||||||
|
1 last-key key-state!
|
||||||
PRESSED to event
|
PRESSED to event
|
||||||
then
|
then
|
||||||
WM_KEYUP msg = if
|
WM_KEYUP msg = if
|
||||||
|
w 0 max 255 min to last-key
|
||||||
|
0 last-key key-state!
|
||||||
RELEASED to event
|
RELEASED to event
|
||||||
then
|
then
|
||||||
WM_CHAR msg = if
|
WM_CHAR msg = if
|
||||||
|
w to last-char
|
||||||
|
TYPED to event
|
||||||
|
0 exit
|
||||||
then
|
then
|
||||||
msg msg>button if
|
msg msg>button if
|
||||||
l GET_X_LPARAM to mouse-x
|
l GET_X_LPARAM to mouse-x
|
||||||
l GET_Y_LPARAM to mouse-y
|
l GET_Y_LPARAM to mouse-y
|
||||||
msg msg>pressed msg msg>button key-state!
|
msg msg>button to last-key
|
||||||
msg msg>button to last-keycode
|
msg msg>pressed dup last-key key-state!
|
||||||
msg msg>pressed if PRESSED else RELEASED then to event
|
if PRESSED else RELEASED then to event
|
||||||
|
0 exit
|
||||||
then
|
then
|
||||||
WM_MOUSEMOVE msg = if
|
WM_MOUSEMOVE msg = if
|
||||||
l GET_X_LPARAM to mouse-x
|
l GET_X_LPARAM to mouse-x
|
||||||
|
|||||||
Reference in New Issue
Block a user