2 USING: kernel namespaces opengl ui.render ui.gadgets accessors ;
6 TUPLE: slate < gadget action pdim graft ungraft ;
8 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10 : init-slate ( slate -- slate )
17 : <slate> ( action -- slate )
22 M: slate pref-dim* ( slate -- dim ) pdim>> ;
24 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
26 USING: combinators arrays sequences math math.geometry
27 opengl.gl ui.gadgets.worlds ;
29 : screen-y* ( gadget -- loc )
38 : screen-loc* ( gadget -- loc )
46 : setup-viewport ( gadget -- gadget )
55 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
57 : default-coordinate-system ( gadget -- gadget )
69 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
71 M: slate graft* ( slate -- ) graft>> call ;
72 M: slate ungraft* ( slate -- ) ungraft>> call ;
74 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
76 GENERIC: establish-coordinate-system ( gadget -- gadget )
78 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
80 M: slate establish-coordinate-system ( slate -- slate )
81 default-coordinate-system ;
83 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
85 GENERIC: draw-slate ( slate -- slate )
87 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
89 M: slate draw-slate ( slate -- slate ) dup action>> call ;
91 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
93 M: slate draw-gadget* ( slate -- )
95 GL_PROJECTION glMatrixMode glPushMatrix glLoadIdentity
97 establish-coordinate-system
99 GL_MODELVIEW glMatrixMode glPushMatrix glLoadIdentity
105 GL_PROJECTION glMatrixMode glPopMatrix glLoadIdentity
106 GL_MODELVIEW glMatrixMode glPopMatrix glLoadIdentity
110 ! The world coordinate system is a little wacky:
111 dup { [ drop 0 ] [ width ] [ height ] [ drop 0 ] } cleave -1 1 glOrtho
116 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!