From 20216d0d2b2674da8d93a1b7885b67abc0957ed2 Mon Sep 17 00:00:00 2001 From: the_fiddler Date: Mon, 9 Nov 2009 19:14:14 +0000 Subject: [PATCH] * OpenTK/Test/Multithreading.cs: Replaced anonymous delegate by a private function for easier debugging. Switch to/from fullscreen when Key.Space is pressed. --- Source/Examples/OpenTK/Test/Multithreading.cs | 30 +++++++++++++------ 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/Source/Examples/OpenTK/Test/Multithreading.cs b/Source/Examples/OpenTK/Test/Multithreading.cs index 62a468ba..cf056831 100644 --- a/Source/Examples/OpenTK/Test/Multithreading.cs +++ b/Source/Examples/OpenTK/Test/Multithreading.cs @@ -37,20 +37,13 @@ namespace Examples.Tests { public static void Main() { - const int ThreadCount = 4; + const int ThreadCount = 2; List threads = new List(); // launch threads for (int i = 0; i < ThreadCount; i++) { - Thread t = new Thread(delegate() - { - using (Tutorial.T03_Immediate_Mode_Cube game = new Examples.Tutorial.T03_Immediate_Mode_Cube()) - { - Utilities.SetWindowTitle(game); - game.Run(30.0); - } - }); + Thread t = new Thread(RunGame); t.IsBackground = true; t.Priority = ThreadPriority.BelowNormal; t.Start(); @@ -63,5 +56,24 @@ namespace Examples.Tests t.Join(); } } + + static void RunGame() + { + using (Tutorial.T03_Immediate_Mode_Cube game = new Examples.Tutorial.T03_Immediate_Mode_Cube()) + { + Utilities.SetWindowTitle(game); + game.Keyboard.KeyUp += delegate(object sender, OpenTK.Input.KeyboardKeyEventArgs e) + { + if (e.Key == OpenTK.Input.Key.Space) + { + if (game.WindowState == OpenTK.WindowState.Fullscreen) + game.WindowState = OpenTK.WindowState.Normal; + else + game.WindowState = OpenTK.WindowState.Fullscreen; + } + }; + game.Run(30.0); + } + } } }