USING: kernel math memory raylib namespaces ; IN: stacky SYMBOLS: loc ; CONSTANT: stacky_text "STACKY" : init ( -- ) 0 loc set 1000 1000 "STACKY" init-window ; : gray ( -- ) WHITE clear-background ; : wloop ( quot -- ) [ window-should-close not ] swap while ; inline : stacky-text ( -- ) stacky_text 500 stacky_text 30 measure-text 2 / - 500 225 - 30 BLACK draw-text ; : stacky-rect ( -- ) 500 300 2 / - 500 150 - 300 500 BLACK draw-rectangle ; : down-clicked ( -- bool ) KEY_TAB is-key-pressed KEY_LEFT_SHIFT is-key-down KEY_RIGHT_SHIFT is-key-down or not and KEY_DOWN is-key-pressed or ; : up-clicked ( -- bool ) KEY_UP is-key-pressed KEY_TAB is-key-pressed KEY_LEFT_SHIFT is-key-down KEY_RIGHT_SHIFT is-key-down or and or ; : tab-incr-loc ( -- ) down-clicked [ loc inc ] [ ] if ; : up-decr-loc ( -- ) up-clicked [ loc dec ] [ ] if ; : number-pressed ( -- number/f ) KEY_ZERO is-key-pressed [ 0 ] [ KEY_ONE is-key-pressed [ 1 ] [ KEY_TWO is-key-pressed [ 2 ] [ KEY_THREE is-key-pressed [ 3 ] [ KEY_FOUR is-key-pressed [ 4 ] [ KEY_FIVE is-key-pressed [ 5 ] [ KEY_SIX is-key-pressed [ 6 ] [ KEY_SEVEN is-key-pressed [ 7 ] [ KEY_EIGHT is-key-pressed [ 8 ] [ KEY_NINE is-key-pressed [ 9 ] [ f ] if ] if ] if ] if ] if ] if ] if ] if ] if ] if ; : gray-box ( -- ) 350 loc get 20 * 350 + 300 100 S{ Color f 50 50 50 255 } draw-rectangle ; init [ begin-drawing gray stacky-text stacky-rect up-decr-loc tab-incr-loc gray-box end-drawing ] wloop