facf2f4bf054 — Leonard Ritter a month ago
* fixed tukdag for new GLMain interface
3 files changed, 13 insertions(+), 11 deletions(-)

M lib/tukan/FIR.sc
M lib/tukan/vm.sc
M testing/tukdag.sc
M lib/tukan/FIR.sc +2 -2
@@ 2701,7 2701,7 @@ sugar FIRfn (name (args...) body...)
         list let name '= expr
     else expr
 
-sugar FIRstatic ((args... '= init...) ('break break...) ('repeat repeat...))
+#sugar FIRstatic ((args... '= init...) ('break break...) ('repeat repeat...))
     print args...
     print init...
     print break...

          
@@ 2731,6 2731,6 @@ sugar FIRstatic ((args... '= init...) ('
 do
     let FIR NoId AnyId SystemKey ImageDim ImageFormat ImageFlags TypeId
         \ PrimitiveMode InterpolationMode DepthTestType FIRTyper FIRfn
-        \ FIRstatic
+        #\ FIRstatic
         \ CullMode
     locals;

          
M lib/tukan/vm.sc +8 -6
@@ 8,6 8,7 @@ using import Array
 using import String
 using import Option
 using import Rc
+using import Capture
 
 using import .sdl
 #using import tukan.module

          
@@ 233,8 234,7 @@ fn... runvm (
     debugprint "initializing resources"
     let ctx = (setupf)
 
-    @@ 'on GLMain.on-draw
-    inline (time size glmain)
+    fn on-draw (vm)
         let gfx = ('force-unwrap vm.gfx)
         if gfx.tx_screen
             GL.BindFramebuffer GL.FRAMEBUFFER 0

          
@@ 246,8 246,7 @@ fn... runvm (
             'draw gfx.screen
             GL.UseProgram 0
 
-    @@ 'on GLMain.on-event
-    inline (event glmain)
+    capture on-event (event) {&ins}
         'append ins.events event
 
     do

          
@@ 303,10 302,13 @@ fn... runvm (
             let w h = (unpack vm.screensize)
             gfx.tx_screen = outs.screen
             if vm.hidden
-                'show-window glmain
+                'show glmain
                 vm.hidden = false
             'clear ins.events
-            let continue? = ('step glmain)
+            let continue? = (not ('handle-events glmain on-event))
+            if continue?
+                on-draw vm
+                'swap glmain
             vm.screensize = (uvec2 ('size glmain))
             if (not continue?)
                 vm.close? = true

          
M testing/tukdag.sc +3 -3
@@ 336,7 336,7 @@ inline gen-level2-test ()
                     let z = (fmul (fadd q0 q1) itsin)
                     fvec4 u v z (fconst 1)
 
-inline gen-level2-test-audio ()
+#inline gen-level2-test-audio ()
     from (methodsof module.builder) let output outputs mul unfold input
     let fir-module = module
 

          
@@ 387,7 387,7 @@ inline graphviz (rootid)
 #let prog = (gen-level1-test-geometry)
 #let prog = (gen-level1-test)
 
-#let prog =
+let prog =
     do
         let prog = (gen-level2-test-geometry)
         let prog = (cleanup prog)

          
@@ 402,7 402,7 @@ inline graphviz (rootid)
         'dump module prog
         print "lowering..."
         'lower module prog
-let prog =
+#let prog =
     do
         let prog = (gen-level2-test-audio)
         'dump module prog