From 0bf24a095f69c09da59d212ee5e3263f81cbdd6f Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Sat, 31 Dec 2005 01:53:19 +0000 Subject: [PATCH] *** empty log message *** --- contrib/x11/concurrent-widgets.factor | 2 +- contrib/x11/examples/double.factor | 49 +++++++++++++++++++++++++++ contrib/x11/x.factor | 2 +- 3 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 contrib/x11/examples/double.factor diff --git a/contrib/x11/concurrent-widgets.factor b/contrib/x11/concurrent-widgets.factor index 88a94ff002..f1cac4c4f3 100644 --- a/contrib/x11/concurrent-widgets.factor +++ b/contrib/x11/concurrent-widgets.factor @@ -1,7 +1,7 @@ IN: concurrent-widgets USING: io namespaces kernel hashtables math generic threads concurrency - lists sequences xlib x ; + lists sequences arrays xlib x ; ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! diff --git a/contrib/x11/examples/double.factor b/contrib/x11/examples/double.factor new file mode 100644 index 0000000000..de000fb258 --- /dev/null +++ b/contrib/x11/examples/double.factor @@ -0,0 +1,49 @@ +SYMBOL: loop-action +[ ] loop-action set + +SYMBOL: spin +0.0 spin set + +: init ( -- ) 0.0 0.0 0.0 0.0 glClearColor GL_FLAT glShadeModel ; + +: display ( -- ) +GL_COLOR_BUFFER_BIT glClear +glPushMatrix +spin get 0.0 0.0 1.0 glRotatef +1.0 1.0 1.0 glColor3f +-25.0 -25.0 25.0 25.0 glRectf +glPopMatrix +glXSwapBuffers ; + +: spin-display ( -- ) +spin get 2.0 + spin set +spin get 360.0 > [ spin get 360.0 - spin set ] when +display ; + +: reshape ( { width height } -- ) +>r 0 0 r> [ ] each glViewPort +GL_PROJECTION glMatrixMode glLoadIdentity +-50.0 50.0 -50.0 50.0 -1.0 1.0 glOrtho +GL_MODELVIEW glMatrixMode glLoadIdentity ; + +: mouse ( event -- ) +{ { [ dup XButtonEvent-button Button1Mask = ] + [ [ spin-display ] loop-action set drop ] } + { [ dup XButtonEvent-button Button2Mask = ] + [ [ ] loop-action set drop ] } + { [ t ] [ drop ] } } cond ; + +: loop ( -- ) loop-action get call ; + +f initialize-x + +create-pwindow +[ drop reshape ] over set-pwindow-resize-action +[ drop mouse ] over set-pwindow-button-action +window-id win set + +{ 250 250 } resize-window { 100 100 } move-window map-window + +[ GLX_RGBA GLX_DOUBLEBUFFER ] choose-visual create-context make-current + +[ loop ] spawn \ No newline at end of file diff --git a/contrib/x11/x.factor b/contrib/x11/x.factor index 6fc7ae711f..aacbdbec76 100644 --- a/contrib/x11/x.factor +++ b/contrib/x11/x.factor @@ -1,5 +1,5 @@ -IN: x USING: namespaces kernel math arrays alien sequences xlib ; +IN: x USING: namespaces kernel math arrays strings alien sequences xlib ; SYMBOL: dpy SYMBOL: scr