pong: use different colors.

paths
John Benediktsson 2018-03-22 13:18:51 -07:00
parent dd5be66957
commit 89fa8e09ee
1 changed files with 4 additions and 4 deletions

View File

@ -16,7 +16,7 @@ CONSTANT: FONT $[
monospace-font monospace-font
t >>bold? t >>bold?
COLOR: red >>foreground COLOR: red >>foreground
COLOR: white >>background COLOR: gray95 >>background
] ]
TUPLE: ball pos vel ; TUPLE: ball pos vel ;
@ -33,7 +33,7 @@ DEFER: on-tick
: <pong-gadget> ( -- gadget ) : <pong-gadget> ( -- gadget )
pong-gadget new initial-state pong-gadget new initial-state
COLOR: white <solid> >>interior COLOR: gray95 <solid> >>interior
dup '[ _ on-tick ] f 16 milliseconds <timer> >>timer ; dup '[ _ on-tick ] f 16 milliseconds <timer> >>timer ;
M: pong-gadget pref-dim* drop { 400 400 } ; M: pong-gadget pref-dim* drop { 400 400 } ;
@ -42,7 +42,7 @@ M: pong-gadget ungraft*
[ timer>> stop-timer ] [ call-next-method ] bi ; [ timer>> stop-timer ] [ call-next-method ] bi ;
M:: pong-gadget draw-gadget* ( PONG -- ) M:: pong-gadget draw-gadget* ( PONG -- )
COLOR: dark-gray gl-color COLOR: gray80 gl-color
15 390 20 <range> [ 15 390 20 <range> [
197 2array { 10 6 } gl-fill-rect 197 2array { 10 6 } gl-fill-rect
] each ] each
@ -64,7 +64,7 @@ M:: pong-gadget draw-gadget* ( PONG -- )
] [ ] [
PONG timer>> thread>> [ PONG timer>> thread>> [
FONT 24 >>size FONT 24 >>size
{ "N - New Game" "SPACE - Pause" } { " N - New Game" "SPACE - Pause" }
[ text-width 390 swap - 2 / 100 2array ] [ text-width 390 swap - 2 / 100 2array ]
[ '[ _ _ draw-text ] with-translation ] 2bi [ '[ _ _ draw-text ] with-translation ] 2bi
] unless ] unless