null-world class for interactive OpenGL use

db4
Joe Groff 2009-06-03 11:03:34 -05:00
parent 6599beefd6
commit 0169934f6d
3 changed files with 31 additions and 2 deletions

View File

@ -217,4 +217,3 @@ M: world check-world-pixel-format
: with-world-pixel-format ( world quot -- )
[ dup dup world-pixel-format-attributes <pixel-format> ]
dip [ 2dup check-world-pixel-format ] prepose with-disposal ; inline

View File

@ -206,8 +206,11 @@ PRIVATE>
: open-world-window ( world -- )
dup pref-dim >>dim dup relayout graft ;
: open-window* ( gadget title/attributes -- window )
?attributes <world> [ open-world-window ] keep ;
: open-window ( gadget title/attributes -- )
?attributes <world> open-world-window ;
open-window* drop ;
: set-fullscreen ( gadget ? -- )
[ find-world ] dip (set-fullscreen) ;

View File

@ -0,0 +1,27 @@
USING: accessors kernel ui ui.backend ui.gadgets
ui.gadgets.worlds ui.pixel-formats ;
IN: ui.gadgets.worlds.null
TUPLE: null-world < world ;
M: null-world begin-world drop ;
M: null-world end-world drop ;
M: null-world draw-world* drop ;
M: null-world resize-world drop ;
M: null-world pref-dim* drop { 512 512 } ;
: null-window ( title -- world )
<world-attributes>
swap >>title
null-world >>world-class
{
windowed
double-buffered
backing-store
T{ depth-bits f 24 }
} >>pixel-format-attributes
f swap open-window* ;
: into-window ( world quot -- world )
[ dup handle>> ] dip with-gl-context ; inline