]> gitweb.factorcode.org Git - factor.git/commitdiff
null-world class for interactive OpenGL use
authorJoe Groff <arcata@gmail.com>
Wed, 3 Jun 2009 16:03:34 +0000 (11:03 -0500)
committerJoe Groff <arcata@gmail.com>
Wed, 3 Jun 2009 16:03:34 +0000 (11:03 -0500)
basis/ui/gadgets/worlds/worlds.factor
basis/ui/ui.factor
extra/ui/gadgets/worlds/null/null.factor [new file with mode: 0644]

index 38fb220c69b7ab8be2b4741b50084fb25ee30c87..dfce3d3eee05459beabab4631ca8952e14de4530 100755 (executable)
@@ -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
-
index 144530399c5b5b8a0ebb539a5b7fc194018e4d4f..aee19279a4ee303f27e4e74431d9efc3ad1ede03 100644 (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) ;
diff --git a/extra/ui/gadgets/worlds/null/null.factor b/extra/ui/gadgets/worlds/null/null.factor
new file mode 100644 (file)
index 0000000..26fc3e8
--- /dev/null
@@ -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
+
+