Merge branch 'master' of git://factorcode.org/git/factor

db4
Slava Pestov 2008-07-29 21:32:13 -05:00
commit 75af228f5a
5 changed files with 69 additions and 18 deletions

View File

@ -30,7 +30,7 @@ IN: automata.ui
: draw-bitmap ( bitmap -- ) GL_POINTS glBegin (draw-bitmap) glEnd ; : draw-bitmap ( bitmap -- ) GL_POINTS glBegin (draw-bitmap) glEnd ;
: display ( -- ) black gl-color bitmap> draw-bitmap ; : display ( -- ) black set-color bitmap> draw-bitmap ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

View File

@ -2,7 +2,7 @@
USING: kernel namespaces math math.constants math.functions math.order USING: kernel namespaces math math.constants math.functions math.order
arrays sequences arrays sequences
opengl opengl.gl opengl.glu ui ui.render ui.gadgets ui.gadgets.theme opengl opengl.gl opengl.glu ui ui.render ui.gadgets ui.gadgets.theme
ui.gadgets.slate colors accessors combinators.cleave ui.gadgets.cartesian colors accessors combinators.cleave
processing.shapes ; processing.shapes ;
IN: golden-section IN: golden-section
@ -39,20 +39,17 @@ IN: golden-section
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: display ( -- )
GL_PROJECTION glMatrixMode
glLoadIdentity
-400 400 -400 400 -1 1 glOrtho
GL_MODELVIEW glMatrixMode
glLoadIdentity
golden-section ;
: golden-section-window ( -- ) : golden-section-window ( -- )
[ [
[ display ] <slate> <cartesian>
{ 600 600 } >>pdim { 600 600 } >>pdim
{ -400 400 } x-range
{ -400 400 } y-range
[ golden-section ] >>action
"Golden Section" open-window "Golden Section" open-window
] ]
with-ui ; with-ui ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
MAIN: golden-section-window MAIN: golden-section-window

View File

@ -3,7 +3,7 @@
USING: arrays hashtables help.markup help.stylesheet io USING: arrays hashtables help.markup help.stylesheet io
io.styles kernel math models namespaces sequences ui ui.gadgets io.styles kernel math models namespaces sequences ui ui.gadgets
ui.gadgets.books ui.gadgets.panes ui.gestures ui.render ui.gadgets.books ui.gadgets.panes ui.gestures ui.render
parser accessors ; parser accessors colors ;
IN: slides IN: slides
: stylesheet : stylesheet

View File

@ -0,0 +1,47 @@
USING: kernel combinators sequences opengl.gl
ui.render ui.gadgets ui.gadgets.slate
accessors ;
IN: ui.gadgets.cartesian
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
TUPLE: cartesian < slate x-min x-max y-min y-max z-min z-max perspective ;
: init-cartesian ( cartesian -- cartesian )
init-slate
-10 >>x-min
10 >>x-max
-10 >>y-min
10 >>y-max
-1 >>z-min
1 >>z-max ;
: <cartesian> ( -- cartesian ) cartesian new init-cartesian ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
M: cartesian draw-gadget* ( cartesian -- )
GL_PROJECTION glMatrixMode
glLoadIdentity
dup
{
[ x-min>> ] [ x-max>> ]
[ y-min>> ] [ y-max>> ]
[ z-min>> ] [ z-max>> ]
}
cleave
glOrtho
GL_MODELVIEW glMatrixMode
glLoadIdentity
call-next-method ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: x-range ( cartesian range -- cartesian ) first2 [ >>x-min ] [ >>x-max ] bi* ;
: y-range ( cartesian range -- cartesian ) first2 [ >>y-min ] [ >>y-max ] bi* ;
: z-range ( cartesian range -- cartesian ) first2 [ >>z-min ] [ >>z-max ] bi* ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

View File

@ -5,12 +5,19 @@ IN: ui.gadgets.slate
TUPLE: slate < gadget action pdim graft ungraft ; TUPLE: slate < gadget action pdim graft ungraft ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: init-slate ( slate -- slate )
init-gadget
[ ] >>action
{ 200 200 } >>pdim
[ ] >>graft
[ ] >>ungraft ;
: <slate> ( action -- slate ) : <slate> ( action -- slate )
slate new-gadget slate new
swap >>action init-slate
{ 100 100 } >>pdim swap >>action ;
[ ] >>graft
[ ] >>ungraft ;
M: slate pref-dim* ( slate -- dim ) pdim>> ; M: slate pref-dim* ( slate -- dim ) pdim>> ;