: <cairo-demo-gadget> ( -- gadget )
cairo-demo-gadget new ;
-: run-cairo-demo ( -- )
- [
- <cairo-demo-gadget> "Hello World from Factor!" open-window
- ] with-ui ;
-
-MAIN: run-cairo-demo
+MAIN-WINDOW: run-cairo-demo
+ { { title "Hello World from Factor!" } }
+ <cairo-demo-gadget> >>gadgets ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-: pong-window ( -- ) pong [ "PONG" open-window ] [ start-pong-thread ] bi ;
-
-: pong-main ( -- ) [ pong-window ] with-ui ;
-
-MAIN: pong-window
+MAIN-WINDOW: pong-window
+ { { title "PONG" } }
+ pong [ >>gadgets ] [ start-pong-thread ] bi ;
pendulum-gadget new
{ 500 500 } >>pref-dim ;
-: pendulum-main ( -- )
- [ <pendulum-gadget> "pendulum" open-window ] with-ui ;
-
-MAIN: pendulum-main
+MAIN-WINDOW: pendulum-main
+ { { title "pendulum" } }
+ <pendulum-gadget> >>gadgets ;
M: animated-label ungraft*
alarm>> stop-timer ;
-: animated-main ( -- )
- [ sentence <model> <animated-label> "Rosetta" open-window ] with-ui ;
-
-MAIN: animated-main
+MAIN-WINDOW: animated-main
+ { { title "Rosetta" } }
+ sentence <model> <animated-label> >>gadgets ;
[ fps-model>> fps-gadget ]
[ <pile> swap add-gadget swap add-gadget ] bi ;
-: open-noise-window ( -- )
- [ <bw-noise-gadget> with-fps "Black and White noise" open-window ] with-ui ;
-
-MAIN: open-noise-window
+MAIN-WINDOW: open-noise-window
+ { { title "Black and White noise" } }
+ <bw-noise-gadget> >>gadgets ;
! Copyright (c) 2012 Anonymous
! See http://factorcode.org/license.txt for BSD license.
-USING: kernel math math.rectangles opengl.gl sequences ui
-ui.gadgets ui.render ;
+USING: accessors kernel math math.rectangles opengl.gl
+sequences ui ui.gadgets ui.render ;
IN: rosetta-code.opengl
! http://rosettacode.org/wiki/OpenGL
M: triangle-gadget draw-gadget*
rect-bounds nip first2 reshape paint ;
-: triangle-window ( -- )
- [ triangle-gadget new "Triangle" open-window ] with-ui ;
-
-MAIN: triangle-window
+MAIN-WINDOW: triangle-window
+ { { title "Triangle" } }
+ triangle-gadget new >>gadgets ;
dup start-trails-thread ;
-: trails-window ( -- ) [ <trails-gadget> "Trails" open-window ] with-ui ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-MAIN: trails-window
+MAIN-WINDOW: trails-window
+ { { title "Trails" } }
+ <trails-gadget> >>gadgets ;