menu positioning fix
parent
9b361d749b
commit
2636a247c9
|
@ -8,10 +8,8 @@
|
||||||
- fix up the min thumb size hack
|
- fix up the min thumb size hack
|
||||||
- scroll bar: more intuitive behavior when clicking inside the elevator
|
- scroll bar: more intuitive behavior when clicking inside the elevator
|
||||||
- nicer scrollbars with up/down buttons
|
- nicer scrollbars with up/down buttons
|
||||||
- clicking outside menu doesn't close
|
|
||||||
- only redraw dirty gadgets
|
- only redraw dirty gadgets
|
||||||
- faster mouse tracking
|
- faster mouse tracking
|
||||||
- better menu positioning
|
|
||||||
|
|
||||||
- off-by-one error in pick-up?
|
- off-by-one error in pick-up?
|
||||||
- closing ui does not stop timers
|
- closing ui does not stop timers
|
||||||
|
|
|
@ -3,8 +3,20 @@
|
||||||
IN: gadgets
|
IN: gadgets
|
||||||
USING: generic kernel lists math namespaces sequences ;
|
USING: generic kernel lists math namespaces sequences ;
|
||||||
|
|
||||||
|
: menu-actions ( glass -- )
|
||||||
|
[ drop hide-glass ] [ button-down 1 ] set-action ;
|
||||||
|
|
||||||
|
: fit-bounds ( loc dim max -- loc )
|
||||||
|
#! Adjust loc to fit inside max.
|
||||||
|
swap v- { 0 0 0 } vmax vmin ;
|
||||||
|
|
||||||
|
: menu-loc ( menu -- loc )
|
||||||
|
hand rect-loc swap rect-dim world get rect-dim fit-bounds ;
|
||||||
|
|
||||||
: show-menu ( menu -- )
|
: show-menu ( menu -- )
|
||||||
hand screen-loc over set-rect-loc show-glass ;
|
dup show-glass
|
||||||
|
dup menu-loc swap set-rect-loc
|
||||||
|
world get world-glass menu-actions ;
|
||||||
|
|
||||||
: menu-items ( assoc -- pile )
|
: menu-items ( assoc -- pile )
|
||||||
#! Given an association list mapping labels to quotations.
|
#! Given an association list mapping labels to quotations.
|
||||||
|
|
|
@ -38,8 +38,7 @@ C: world ( -- world )
|
||||||
|
|
||||||
: show-glass ( gadget -- )
|
: show-glass ( gadget -- )
|
||||||
hide-glass
|
hide-glass
|
||||||
<gadget> dup
|
<gadget> dup add-layer dup world get set-world-glass
|
||||||
world get 2dup add-gadget set-world-glass
|
|
||||||
dupd add-gadget prefer ;
|
dupd add-gadget prefer ;
|
||||||
|
|
||||||
: draw-world ( world -- )
|
: draw-world ( world -- )
|
||||||
|
@ -54,8 +53,7 @@ DEFER: handle-event
|
||||||
world get dup world-invalid >r layout-world r>
|
world get dup world-invalid >r layout-world r>
|
||||||
[ dup world-hand update-hand draw-world ] [ drop ] ifte ;
|
[ dup world-hand update-hand draw-world ] [ drop ] ifte ;
|
||||||
|
|
||||||
: next-event ( -- event ? )
|
: next-event ( -- event ? ) <event> dup SDL_PollEvent ;
|
||||||
<event> dup SDL_PollEvent ;
|
|
||||||
|
|
||||||
: run-world ( -- )
|
: run-world ( -- )
|
||||||
#! Keep polling for events until there are no more events in
|
#! Keep polling for events until there are no more events in
|
||||||
|
|
Loading…
Reference in New Issue