Re-implement <polygon-gadget> since joystick-demo still uses it

db4
Slava Pestov 2009-03-09 20:23:34 -05:00
parent 58582ab4d9
commit 073333f245
1 changed files with 7 additions and 2 deletions

View File

@ -1,7 +1,8 @@
! Copyright (C) 2009 Slava Pestov. ! Copyright (C) 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors colors help.markup help.syntax kernel opengl USING: accessors colors help.markup help.syntax kernel opengl
opengl.gl sequences specialized-arrays.float ui.pens ; opengl.gl sequences specialized-arrays.float math.vectors
ui.gadgets ui.pens ;
IN: ui.pens.polygon IN: ui.pens.polygon
! Polygon pen ! Polygon pen
@ -31,3 +32,7 @@ M: polygon draw-interior
[ interior-vertices>> gl-vertex-pointer ] [ interior-vertices>> gl-vertex-pointer ]
[ [ GL_POLYGON 0 ] dip interior-count>> glDrawArrays ] [ [ GL_POLYGON 0 ] dip interior-count>> glDrawArrays ]
tri ; tri ;
: <polygon-gadget> ( color points -- gadget )
[ <polygon> ] [ { 0 0 } [ vmax ] reduce ] bi
[ <gadget> ] 2dip [ >>interior ] [ >>dim ] bi* ;