minor fix for rollovers
parent
3b98c55ecf
commit
ae27f48d12
|
@ -26,7 +26,6 @@
|
|||
- ffi unicode strings: null char security hole
|
||||
- utf16 string boxing
|
||||
- sdl console crash
|
||||
- UI: don't roll over if mouse button is down
|
||||
- more accurate types for various words
|
||||
- optimize out >array, >tuple, >hashtable etc
|
||||
- write read: write should flush
|
||||
|
|
|
@ -11,12 +11,17 @@ USING: generic kernel lists math namespaces sdl ;
|
|||
|
||||
: mouse-over? ( gadget -- ? ) my-hand hand-gadget child? ;
|
||||
|
||||
: button-rollover? ( button -- ? )
|
||||
mouse-over? 1 button-down? not and ;
|
||||
|
||||
: rollover-update ( button -- )
|
||||
dup mouse-over? blue black ? foreground set-paint-property ;
|
||||
dup button-rollover? blue black ? foreground set-paint-property ;
|
||||
|
||||
: button-pressed? ( button -- ? )
|
||||
#! Return true if the mouse was clicked on the button, and
|
||||
#! is currently over the button.
|
||||
dup mouse-over? [
|
||||
my-hand hand-buttons 1 swap contains? [
|
||||
1 button-down? [
|
||||
my-hand hand-clicked child?
|
||||
] [
|
||||
drop f
|
||||
|
|
|
@ -76,3 +76,6 @@ SYMBOL: button-down
|
|||
[
|
||||
2dup child? [ gain-focus ] hierarchy-gesture
|
||||
] each-parent 2drop ;
|
||||
|
||||
: button-down? ( n -- ? )
|
||||
my-hand hand-buttons contains? ;
|
||||
|
|
|
@ -47,7 +47,7 @@ DEFER: handle-event
|
|||
#! Keep polling for events until there are no more events in
|
||||
#! the queue; then block for the next event.
|
||||
dup SDL_PollEvent [
|
||||
dup handle-event eat-events
|
||||
[ handle-event ] in-thread eat-events
|
||||
] [
|
||||
world get world-step [ SDL_WaitEvent ] [ drop f ] ifte
|
||||
] ifte ;
|
||||
|
|
Loading…
Reference in New Issue