Merge branch 'master' of git://factorcode.org/git/factor
commit
790829ea6f
|
@ -1,6 +1,6 @@
|
||||||
! Copyright (C) 2006, 2008 Slava Pestov
|
! Copyright (C) 2006, 2008 Slava Pestov
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors arrays documents io kernel math models
|
USING: accessors arrays documents kernel math models
|
||||||
namespaces locals fry make opengl opengl.gl sequences strings
|
namespaces locals fry make opengl opengl.gl sequences strings
|
||||||
io.styles math.vectors sorting colors combinators assocs
|
io.styles math.vectors sorting colors combinators assocs
|
||||||
math.order fry calendar alarms ui.clipboards ui.commands
|
math.order fry calendar alarms ui.clipboards ui.commands
|
||||||
|
@ -218,7 +218,7 @@ M: editor ungraft*
|
||||||
] with-editor-translation ;
|
] with-editor-translation ;
|
||||||
|
|
||||||
: selection-start/end ( editor -- start end )
|
: selection-start/end ( editor -- start end )
|
||||||
dup editor-mark* swap editor-caret* sort-pair ;
|
[ editor-mark* ] [ editor-caret* ] bi sort-pair ;
|
||||||
|
|
||||||
: (draw-selection) ( x1 x2 -- )
|
: (draw-selection) ( x1 x2 -- )
|
||||||
over -
|
over -
|
||||||
|
@ -227,9 +227,8 @@ M: editor ungraft*
|
||||||
swap [ gl-fill-rect ] with-translation ;
|
swap [ gl-fill-rect ] with-translation ;
|
||||||
|
|
||||||
: draw-selected-line ( start end n -- )
|
: draw-selected-line ( start end n -- )
|
||||||
[ start/end-on-line ] keep tuck
|
[ start/end-on-line ] keep
|
||||||
[ editor get offset>x ] 2dip
|
tuck [ editor get offset>x ] 2bi@
|
||||||
editor get offset>x
|
|
||||||
(draw-selection) ;
|
(draw-selection) ;
|
||||||
|
|
||||||
: draw-selection ( -- )
|
: draw-selection ( -- )
|
||||||
|
@ -237,9 +236,9 @@ M: editor ungraft*
|
||||||
editor get selection-start/end
|
editor get selection-start/end
|
||||||
over first [
|
over first [
|
||||||
2dup [
|
2dup [
|
||||||
[ 2dup ] dip draw-selected-line
|
draw-selected-line
|
||||||
1 translate-lines
|
1 translate-lines
|
||||||
] each-line 2drop
|
] with with each-line
|
||||||
] with-editor-translation ;
|
] with-editor-translation ;
|
||||||
|
|
||||||
M: editor draw-gadget*
|
M: editor draw-gadget*
|
||||||
|
|
|
@ -25,7 +25,7 @@ USING: kernel
|
||||||
ui.render
|
ui.render
|
||||||
multi-methods
|
multi-methods
|
||||||
multi-method-syntax
|
multi-method-syntax
|
||||||
combinators.short-circuit.smart
|
combinators.short-circuit
|
||||||
processing.shapes
|
processing.shapes
|
||||||
flatland ;
|
flatland ;
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ TUPLE: <separation> < <behaviour> { radius initial: 25 } ;
|
||||||
[ BEHAVIOUR view-angle>> in-view? ]
|
[ BEHAVIOUR view-angle>> in-view? ]
|
||||||
[ eq? not ]
|
[ eq? not ]
|
||||||
}
|
}
|
||||||
&& ;
|
2&& ;
|
||||||
|
|
||||||
:: neighborhood ( SELF OTHERS BEHAVIOUR -- boids )
|
:: neighborhood ( SELF OTHERS BEHAVIOUR -- boids )
|
||||||
OTHERS [| OTHER | SELF OTHER BEHAVIOUR within-neighborhood? ] filter ;
|
OTHERS [| OTHER | SELF OTHER BEHAVIOUR within-neighborhood? ] filter ;
|
||||||
|
@ -154,7 +154,7 @@ M: <boids-gadget> ungraft* ( <boids-gadget> -- ) t >>paused drop ;
|
||||||
|
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
M:: <boids-gadget> draw-gadget* ( BOIDS-GADGET -- )
|
:: iterate-system ( BOIDS-GADGET -- )
|
||||||
|
|
||||||
[let | SKY [ BOIDS-GADGET gadget->sky ]
|
[let | SKY [ BOIDS-GADGET gadget->sky ]
|
||||||
BOIDS [ BOIDS-GADGET boids>> ]
|
BOIDS [ BOIDS-GADGET boids>> ]
|
||||||
|
@ -183,11 +183,14 @@ M:: <boids-gadget> draw-gadget* ( BOIDS-GADGET -- )
|
||||||
|
|
||||||
map
|
map
|
||||||
|
|
||||||
BOIDS-GADGET (>>boids)
|
BOIDS-GADGET (>>boids) ] ;
|
||||||
|
|
||||||
origin get
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
[ BOIDS-GADGET boids>> [ draw-boid ] each ]
|
|
||||||
with-translation ] ;
|
M:: <boids-gadget> draw-gadget* ( BOIDS-GADGET -- )
|
||||||
|
origin get
|
||||||
|
[ BOIDS-GADGET boids>> [ draw-boid ] each ]
|
||||||
|
with-translation ;
|
||||||
|
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
|
@ -197,7 +200,7 @@ M:: <boids-gadget> draw-gadget* ( BOIDS-GADGET -- )
|
||||||
[
|
[
|
||||||
GADGET paused>>
|
GADGET paused>>
|
||||||
[ f ]
|
[ f ]
|
||||||
[ GADGET relayout-1 25 milliseconds sleep t ]
|
[ GADGET iterate-system GADGET relayout-1 1 milliseconds sleep t ]
|
||||||
if
|
if
|
||||||
]
|
]
|
||||||
loop
|
loop
|
||||||
|
|
Loading…
Reference in New Issue