OSDN Git Service

flip ok
[psychlops/silverlight.git] / test3 / MainPage.xaml.cs
index dcfdd2d..f2d8960 100644 (file)
@@ -4,7 +4,7 @@ namespace PsychlopsSilverlight3test
 {\r
        public partial class MainPage : System.Windows.Controls.UserControl\r
        {\r
-               System.Collections.Generic.IEnumerator<int> main_routine;\r
+               //System.Collections.Generic.IEnumerator<int> main_routine;\r
                public System.Windows.Controls.Image master;\r
                public PsychlopsMain main;\r
 #if DEBUG\r
@@ -30,9 +30,10 @@ namespace PsychlopsSilverlight3test
 \r
                        main = new PsychlopsMain();\r
                        //main.initialize();\r
-                       //main_routine = new System.Threading.Thread(ThreadTest2);\r
-                       //main_routine.Start();\r
-                       main_routine = main.psychlops_main();\r
+                       Main.flag = new System.Threading.AutoResetEvent(false);\r
+                       Main.routine = new System.Threading.Thread(main.psychlops_main);\r
+                       Main.routine.Start();\r
+                       //main_routine = main.psychlops_main();\r
 #if DEBUG\r
                        DebugConsole = new System.Windows.Controls.TextBlock();\r
                        TotalRoot.Children.Add(DebugConsole);\r
@@ -45,11 +46,13 @@ namespace PsychlopsSilverlight3test
                int nextIntervalFrame = 1;\r
                private void CompositionTarget_Rendering(object sender, System.EventArgs e)\r
                {\r
+                       if (Main.canvas != null) Main.canvas.executeFlip();\r
+                       Main.flag.Set();\r
                        nextIntervalFrame--;\r
                        if (nextIntervalFrame<=0)\r
                        {\r
-                               main_routine.MoveNext();\r
-                               nextIntervalFrame = main_routine.Current;\r
+                               //main_routine.MoveNext();\r
+                               //nextIntervalFrame = main_routine.Current;\r
                        }\r
                }\r
 \r