X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=test3%2FMainPage.xaml.cs;h=7aa4b92e753551fe4e05e67d5f02a0a982e3d361;hb=e05ab8e68d381f8f5c9a2ddb7c63b89a7bb6371a;hp=082ec8750f3d971cdb49bdd4bd9e5814df77e02e;hpb=0cca967824aa4a8701bed6a2d9015ed30c0b343d;p=psychlops%2Fsilverlight.git diff --git a/test3/MainPage.xaml.cs b/test3/MainPage.xaml.cs index 082ec87..7aa4b92 100644 --- a/test3/MainPage.xaml.cs +++ b/test3/MainPage.xaml.cs @@ -4,65 +4,55 @@ namespace PsychlopsSilverlight3test { public partial class MainPage : System.Windows.Controls.UserControl { - public System.ComponentModel.BackgroundWorker main_routine; + //System.Collections.Generic.IEnumerator main_routine; public System.Windows.Controls.Image master; public PsychlopsMain main; +#if DEBUG + public System.Windows.Controls.TextBlock DebugConsole; +#endif public MainPage() { InitializeComponent(); // Show fps counter - Canvas.default_buffer_frame = main_buffer; + Canvas.default_api_canvas = LayoutRoot; Canvas.default_panel = this; + this.IsTabStop = true; + this.IsEnabled = true; + this.MouseEnter += getFocusMouseEnter; System.Windows.Application.Current.Host.Settings.MaxFrameRate = 60; System.Windows.Application.Current.Host.Settings.EnableFrameRateCounter = true; - System.Windows.Application.Current.Host.Settings.EnableCacheVisualization = true; + System.Windows.Application.Current.Host.Settings.EnableCacheVisualization = false; + // System.Windows.Media.CompositionTarget.Rendering += new System.EventHandler(CompositionTarget_Rendering); //main_routine = new System.ComponentModel.BackgroundWorker(); //main_routine.DoWork += new System.ComponentModel.DoWorkEventHandler(psychlops_main); //main_routine.RunWorkerAsync(); - main = new PsychlopsMain(); - main.initialize(); + Psychlops.Internal.Main.routine = new System.Threading.Thread(main.psychlops_main); + Psychlops.Internal.Main.routine.Start(); + //main.initialize(); + //main_routine = main.psychlops_main(); + + Psychlops.Internal.Main.statusBar = AppStatusBar; + Psychlops.Internal.Main.widgetStack = Controller; + AppStatusBar.Text = System.Windows.Application.Current.Host.Settings.EnableGPUAcceleration.ToString(); } - int background; - private void backgroundWorker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs args) - { - while (true) - { - System.Threading.Thread.Sleep(10); - background++; - } + protected void getFocusMouseEnter(object sender, System.Windows.Input.MouseEventArgs e) { + this.Focus(); } - int frame; private void CompositionTarget_Rendering(object sender, System.EventArgs e) { - frame++; - //Canvas.default_buffer.Invalidate(); - main.each_frames(); + if (Main.canvas != null) Main.canvas.executeFlip(); + //if (nextIntervalFrame-- <= 0) + //{ + // main_routine.MoveNext(); + // nextIntervalFrame = main_routine.Current; + //} } - /* - Canvas cnvs; - Rectangle[] rects; - double tfreq = 1; - - public void initialize() - { - cnvs = new Canvas(500, 500, image, this); - rects = new Rectangle[100]; - for (int i = 0; i < rects.Length; i++) { rects[i] = new Rectangle(10,10); } - cnvs.clear(Color.gray); - } - public void trial() - { - cnvs.clear(new Color(Mouse.left.pressed() ? 1.0 : 0.5)); - foreach (Rectangle rect in rects) { rect.centering().shift(background,0).draw(); } - cnvs.flip(); - } - */ } }