OSDN Git Service

5
[psychlops/silverlight.git] / test4 / MainPage.xaml.cs
diff --git a/test4/MainPage.xaml.cs b/test4/MainPage.xaml.cs
new file mode 100644 (file)
index 0000000..a125451
--- /dev/null
@@ -0,0 +1,84 @@
+using Psychlops;\r
+using System;\r
+using System.Windows;\r
+using System.Windows.Media;\r
+using System.Windows.Media.Effects;\r
+using System.Windows.Media.Media3D;\r
+\r
+\r
+namespace PsychlopsSilverlight4test\r
+{\r
+       public partial class MainPage : System.Windows.Controls.UserControl\r
+       {\r
+               //System.Collections.Generic.IEnumerator<int> main_routine;\r
+               public System.Windows.Controls.Image master;\r
+               public PsychlopsSilverlightApp.PsychlopsMain main;\r
+#if DEBUG\r
+               public System.Windows.Controls.TextBlock DebugConsole;\r
+#endif\r
+               System.Windows.Controls.Image img;\r
+               public MainPage()\r
+               {\r
+                       InitializeComponent();\r
+                       // Show fps counter\r
+\r
+                       Canvas.default_api_canvas = LayoutRoot;\r
+                       Canvas.default_panel = this;\r
+                       this.IsTabStop = true;\r
+                       this.IsEnabled = true;\r
+                       this.MouseEnter += getFocusMouseEnter;\r
+                       System.Windows.Application.Current.Host.Settings.MaxFrameRate = 60;\r
+                       System.Windows.Application.Current.Host.Settings.EnableFrameRateCounter = true;\r
+                       System.Windows.Application.Current.Host.Settings.EnableCacheVisualization = false;\r
+                       //System.Windows.Application.Current.Host.Settings.EnableGPUAcceleration = false;\r
+                       //<param name="enableGPUAcceleration" value="true"/>\r
+                       System.Windows.Media.CompositionTarget.Rendering += new System.EventHandler(CompositionTarget_Rendering);\r
+                       //main_routine =  new System.ComponentModel.BackgroundWorker();\r
+                       //main_routine.DoWork += new System.ComponentModel.DoWorkEventHandler(psychlops_main);\r
+                       //main_routine.RunWorkerAsync();\r
+\r
+                       main = new PsychlopsSilverlightApp.PsychlopsMain();\r
+//                     Psychlops.AppState.statusBar.\r
+                       Psychlops.Internal.Main.routine = new System.Threading.Thread(main.psychlops_main);\r
+                       Psychlops.Internal.Main.routine.Start();\r
+                       //main.initialize();\r
+                       //main_routine = main.psychlops_main();\r
+\r
+                       Psychlops.Internal.Main.statusBar = AppStatusBar;\r
+                       Psychlops.Internal.Main.layoutRoot = LayoutRoot;\r
+                       //Psychlops.Internal.Main.widgetStack = Controller;\r
+                       AppStatusBar.Text = "Now starting Psychlops environment... please wait a minute";\r
+\r
+\r
+//eff__ = new Psychlops.Shader.GaborProgram();\r
+//rect__ = new System.Windows.Shapes.Rectangle();\r
+//rect__.Width = 200;\r
+//rect__.Height = 200;\r
+//rect__.Effect = eff__;\r
+//rect__.Fill = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Blue);\r
+               }\r
+               protected void getFocusMouseEnter(object sender, System.Windows.Input.MouseEventArgs e) {\r
+                       this.Focus();\r
+//if(!b) { LayoutRoot.Children.Add(rect__); b = true; }\r
+               }\r
+//System.Windows.Shapes.Rectangle rect__;\r
+//Psychlops.Shader.GaborProgram eff__;\r
+//bool b = false;\r
+\r
+               private void CompositionTarget_Rendering(object sender, System.EventArgs e)\r
+               {\r
+                       //Controller.Children.Clear();\r
+                       if (Main.canvas != null) Main.canvas.executeFlip();\r
+                       //if (nextIntervalFrame-- <= 0)\r
+                       //{\r
+                       //      main_routine.MoveNext();\r
+                       //      nextIntervalFrame = main_routine.Current;\r
+                       //}\r
+               }\r
+\r
+       }\r
+\r
+\r
+\r
+}\r
+\r