*** empty log message ***

cvs
Eduardo Cavazos 2005-12-31 02:35:38 +00:00
parent 594f0c1c60
commit 75d6a5bc4a
1 changed files with 18 additions and 10 deletions

View File

@ -1,3 +1,6 @@
USING: kernel sequences namespaces math io opengl concurrency
x xlib x11 gl concurrent-widgets ;
SYMBOL: loop-action
[ ] loop-action set
@ -13,7 +16,7 @@ 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 ;
swap-buffers ;
: spin-display ( -- )
spin get 2.0 + spin set
@ -21,29 +24,34 @@ spin get 360.0 > [ spin get 360.0 - spin set ] when
display ;
: reshape ( { width height } -- )
>r 0 0 r> [ ] each glViewPort
>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 = ]
{ { [ dup XButtonEvent-button Button1 = ]
[ [ spin-display ] loop-action set drop "Button1 pressed" print ] }
{ [ dup XButtonEvent-button Button2 = ]
[ [ ] loop-action set drop ] }
{ [ t ] [ drop ] } } cond ;
: loop ( -- ) loop-action get call ;
: loop ( -- ) loop-action get call loop ;
f initialize-x
create-pwindow
[ drop reshape ] over set-pwindow-resize-action
[ drop mouse ] over set-pwindow-button-action
[ drop reshape "window resized" print ] over set-pwindow-resize-action
[ drop mouse "button pressed" print ] over set-pwindow-button-action
window-id win set
StructureNotifyMask ButtonPressMask bitor select-input
{ 250 250 } resize-window { 100 100 } move-window map-window
[ GLX_RGBA GLX_DOUBLEBUFFER ] choose-visual create-context make-current
[ loop ] spawn
init
{ 250 250 } reshape
! [ concurrent-event-loop ] spawn
! [ loop ] spawn