From ea0ee8408e82a19c00637aaa054165bbb49805ba Mon Sep 17 00:00:00 2001 From: jpbruyere Date: Wed, 9 Sep 2015 12:10:12 +0200 Subject: [PATCH] * Tests.csproj: * GOLIBTests.cs: * GOLIBTest_1.cs: * GOLIBTest_0.cs: * GOLIBTest_5.cs: * GOLIBTest_3.cs: * GOLIBTest_fps.cs: * GOLIBTest_4.1.cs: * GOLIBTest_1.2.cs: * GOLIBTest_1.1.cs: * GOLIBTest_meter.cs: * GOLIBTest_Label.cs: * GOLIBTest_stack.cs: * GOLIBTest_HStack.cs: * GOLIBTest_Spinner.cs: * GOLIBTest_Scrollbar.cs: * GOLIBTest_Container.cs: * GOLIBTest_Expandable.cs: code cleaning, grouped tests * Interface.cs: * OpenTKGameWindow.cs: ClearInterface function --- Tests/GOLIBTest_0.cs | 7 +- Tests/GOLIBTest_1.1.cs | 55 ---------- Tests/GOLIBTest_1.2.cs | 55 ---------- Tests/GOLIBTest_1.cs | 55 ---------- Tests/GOLIBTest_2.cs | 55 ---------- Tests/GOLIBTest_3.cs | 51 ---------- Tests/GOLIBTest_4.1.cs | 55 ---------- Tests/GOLIBTest_5.cs | 6 -- Tests/GOLIBTest_Container.cs | 116 ---------------------- Tests/GOLIBTest_Expandable.cs | 56 ----------- Tests/GOLIBTest_HStack.cs | 42 -------- Tests/GOLIBTest_Label.cs | 116 ---------------------- Tests/GOLIBTest_Scrollbar.cs | 56 ----------- Tests/GOLIBTest_Spinner.cs | 55 ---------- Tests/GOLIBTest_meter.cs | 110 -------------------- Tests/GOLIBTest_stack.cs | 47 --------- Tests/{GOLIBTest_fps.cs => GOLIBTests.cs} | 89 ++++++++++------- Tests/Tests.csproj | 19 +--- src/Interface.cs | 4 +- src/OpenTKGameWindow.cs | 8 +- 20 files changed, 63 insertions(+), 994 deletions(-) delete mode 100644 Tests/GOLIBTest_1.1.cs delete mode 100644 Tests/GOLIBTest_1.2.cs delete mode 100644 Tests/GOLIBTest_1.cs delete mode 100644 Tests/GOLIBTest_2.cs delete mode 100755 Tests/GOLIBTest_3.cs delete mode 100644 Tests/GOLIBTest_4.1.cs delete mode 100644 Tests/GOLIBTest_Container.cs delete mode 100644 Tests/GOLIBTest_Expandable.cs delete mode 100755 Tests/GOLIBTest_HStack.cs delete mode 100644 Tests/GOLIBTest_Label.cs delete mode 100644 Tests/GOLIBTest_Scrollbar.cs delete mode 100644 Tests/GOLIBTest_Spinner.cs delete mode 100644 Tests/GOLIBTest_meter.cs delete mode 100644 Tests/GOLIBTest_stack.cs rename Tests/{GOLIBTest_fps.cs => GOLIBTests.cs} (59%) diff --git a/Tests/GOLIBTest_0.cs b/Tests/GOLIBTest_0.cs index 7ec0de99..88cd45e9 100644 --- a/Tests/GOLIBTest_0.cs +++ b/Tests/GOLIBTest_0.cs @@ -50,12 +50,7 @@ namespace test6 tmp -= 1; l.Text = tmp.ToString (); } - protected override void OnRenderFrame (FrameEventArgs e) - { - GL.Clear (ClearBufferMask.ColorBufferBit); - base.OnRenderFrame (e); - SwapBuffers (); - } + protected override void OnKeyDown (KeyboardKeyEventArgs e) { switch (e.Key) { diff --git a/Tests/GOLIBTest_1.1.cs b/Tests/GOLIBTest_1.1.cs deleted file mode 100644 index b9cbdf65..00000000 --- a/Tests/GOLIBTest_1.1.cs +++ /dev/null @@ -1,55 +0,0 @@ -#define MONO_CAIRO_DEBUG_DISPOSE - - -using System; -using System.Runtime.InteropServices; -using OpenTK; -using OpenTK.Graphics.OpenGL; -using OpenTK.Input; - -using System.Diagnostics; - -//using GGL; -using go; -using System.Threading; - - -namespace test -{ - class GOLIBTest_1_1 : OpenTKGameWindow - { - public GOLIBTest_1_1 () - : base(1024, 600,"test") - {} - - Group g; - - protected override void OnLoad (EventArgs e) - { - base.OnLoad (e); - LoadInterface("Interfaces/test1.1.goml", out g); - - } - protected override void OnRenderFrame (FrameEventArgs e) - { - GL.Clear (ClearBufferMask.ColorBufferBit); - base.OnRenderFrame (e); - SwapBuffers (); - } - - protected override void OnUpdateFrame (FrameEventArgs e) - { - base.OnUpdateFrame (e); - } - - [STAThread] - static void Main () - { - Console.WriteLine ("starting example"); - - using (GOLIBTest_1_1 win = new GOLIBTest_1_1( )) { - win.Run (30.0); - } - } - } -} \ No newline at end of file diff --git a/Tests/GOLIBTest_1.2.cs b/Tests/GOLIBTest_1.2.cs deleted file mode 100644 index 3337f06c..00000000 --- a/Tests/GOLIBTest_1.2.cs +++ /dev/null @@ -1,55 +0,0 @@ -#define MONO_CAIRO_DEBUG_DISPOSE - - -using System; -using System.Runtime.InteropServices; -using OpenTK; -using OpenTK.Graphics.OpenGL; -using OpenTK.Input; - -using System.Diagnostics; - -//using GGL; -using go; -using System.Threading; - - -namespace test -{ - class GOLIBTest_1_2 : OpenTKGameWindow - { - public GOLIBTest_1_2 () - : base(1024, 600,"test") - {} - - Container g; - - protected override void OnLoad (EventArgs e) - { - base.OnLoad (e); - LoadInterface("Interfaces/test1.2.goml", out g); - - } - protected override void OnRenderFrame (FrameEventArgs e) - { - GL.Clear (ClearBufferMask.ColorBufferBit); - base.OnRenderFrame (e); - SwapBuffers (); - } - - protected override void OnUpdateFrame (FrameEventArgs e) - { - base.OnUpdateFrame (e); - } - - [STAThread] - static void Main () - { - Console.WriteLine ("starting example"); - - using (GOLIBTest_1_2 win = new GOLIBTest_1_2( )) { - win.Run (30.0); - } - } - } -} \ No newline at end of file diff --git a/Tests/GOLIBTest_1.cs b/Tests/GOLIBTest_1.cs deleted file mode 100644 index f92cd16c..00000000 --- a/Tests/GOLIBTest_1.cs +++ /dev/null @@ -1,55 +0,0 @@ -#define MONO_CAIRO_DEBUG_DISPOSE - - -using System; -using System.Runtime.InteropServices; -using OpenTK; -using OpenTK.Graphics.OpenGL; -using OpenTK.Input; - -using System.Diagnostics; - -//using GGL; -using go; -using System.Threading; - - -namespace test -{ - class GOLIBTest_1 : OpenTKGameWindow - { - public GOLIBTest_1 () - : base(1024, 600,"test") - {} - - Container g; - - protected override void OnLoad (EventArgs e) - { - base.OnLoad (e); - LoadInterface("Interfaces/test1.goml", out g); - - } - protected override void OnRenderFrame (FrameEventArgs e) - { - GL.Clear (ClearBufferMask.ColorBufferBit); - base.OnRenderFrame (e); - SwapBuffers (); - } - - protected override void OnUpdateFrame (FrameEventArgs e) - { - base.OnUpdateFrame (e); - } - - [STAThread] - static void Main () - { - Console.WriteLine ("starting example"); - - using (GOLIBTest_1 win = new GOLIBTest_1( )) { - win.Run (30.0); - } - } - } -} \ No newline at end of file diff --git a/Tests/GOLIBTest_2.cs b/Tests/GOLIBTest_2.cs deleted file mode 100644 index 4af54367..00000000 --- a/Tests/GOLIBTest_2.cs +++ /dev/null @@ -1,55 +0,0 @@ -#define MONO_CAIRO_DEBUG_DISPOSE - - -using System; -using System.Runtime.InteropServices; -using OpenTK; -using OpenTK.Graphics.OpenGL; -using OpenTK.Input; - -using System.Diagnostics; - -//using GGL; -using go; -using System.Threading; - - -namespace test -{ - class GOLIBTest_2 : OpenTKGameWindow - { - public GOLIBTest_2 () - : base(1024, 600,"test") - {} - - Group g; - - protected override void OnLoad (EventArgs e) - { - base.OnLoad (e); - LoadInterface("Interfaces/test2.goml", out g); - - } - protected override void OnRenderFrame (FrameEventArgs e) - { - GL.Clear (ClearBufferMask.ColorBufferBit); - base.OnRenderFrame (e); - SwapBuffers (); - } - - protected override void OnUpdateFrame (FrameEventArgs e) - { - base.OnUpdateFrame (e); - } - - [STAThread] - static void Main () - { - Console.WriteLine ("starting example"); - - using (GOLIBTest_2 win = new GOLIBTest_2( )) { - win.Run (30.0); - } - } - } -} \ No newline at end of file diff --git a/Tests/GOLIBTest_3.cs b/Tests/GOLIBTest_3.cs deleted file mode 100755 index ae233369..00000000 --- a/Tests/GOLIBTest_3.cs +++ /dev/null @@ -1,51 +0,0 @@ -#define MONO_CAIRO_DEBUG_DISPOSE - - -using System; -using System.Runtime.InteropServices; -using OpenTK; -using OpenTK.Graphics.OpenGL; -using OpenTK.Input; - -using System.Diagnostics; - -//using GGL; -using go; -using System.Threading; - - -namespace test -{ - class GOLIBTest_3 : OpenTKGameWindow - { - public GOLIBTest_3 () - : base(1024, 600,"test") - {} - - GraphicObject g; - - protected override void OnLoad (EventArgs e) - { - base.OnLoad (e); - g = LoadInterface("Interfaces/test3.goml"); - - } - protected override void OnRenderFrame (FrameEventArgs e) - { - GL.Clear (ClearBufferMask.ColorBufferBit); - base.OnRenderFrame (e); - SwapBuffers (); - } - - - [STAThread] - static void Main () - { - Console.WriteLine ("starting example"); - - using (GOLIBTest_3 win = new GOLIBTest_3( )) { - win.Run (30.0); - } - } - } -} \ No newline at end of file diff --git a/Tests/GOLIBTest_4.1.cs b/Tests/GOLIBTest_4.1.cs deleted file mode 100644 index 01621df8..00000000 --- a/Tests/GOLIBTest_4.1.cs +++ /dev/null @@ -1,55 +0,0 @@ -#define MONO_CAIRO_DEBUG_DISPOSE - - -using System; -using System.Runtime.InteropServices; -using OpenTK; -using OpenTK.Graphics.OpenGL; -using OpenTK.Input; - -using System.Diagnostics; - -//using GGL; -using go; -using System.Threading; - - -namespace test -{ - class GOLIBTest_4_1 : OpenTKGameWindow - { - public GOLIBTest_4_1 () - : base(1024, 600,"test") - {} - - Group g; - - protected override void OnLoad (EventArgs e) - { - base.OnLoad (e); - LoadInterface("Interfaces/test4.1.goml", out g); - - } - protected override void OnRenderFrame (FrameEventArgs e) - { - GL.Clear (ClearBufferMask.ColorBufferBit); - base.OnRenderFrame (e); - SwapBuffers (); - } - - protected override void OnUpdateFrame (FrameEventArgs e) - { - base.OnUpdateFrame (e); - } - - [STAThread] - static void Main () - { - Console.WriteLine ("starting example"); - - using (GOLIBTest_4_1 win = new GOLIBTest_4_1( )) { - win.Run (30.0); - } - } - } -} \ No newline at end of file diff --git a/Tests/GOLIBTest_5.cs b/Tests/GOLIBTest_5.cs index 87fb5276..1969bcf1 100644 --- a/Tests/GOLIBTest_5.cs +++ b/Tests/GOLIBTest_5.cs @@ -31,12 +31,6 @@ namespace test gl.Add (c.FindByName ("g0")); ll.Add (c.FindByName ("lab0")as Label); } - protected override void OnRenderFrame (FrameEventArgs e) - { - GL.Clear (ClearBufferMask.ColorBufferBit); - base.OnRenderFrame (e); - SwapBuffers (); - } int cpt; protected override void OnUpdateFrame (FrameEventArgs e) diff --git a/Tests/GOLIBTest_Container.cs b/Tests/GOLIBTest_Container.cs deleted file mode 100644 index 3e54e870..00000000 --- a/Tests/GOLIBTest_Container.cs +++ /dev/null @@ -1,116 +0,0 @@ -#define MONO_CAIRO_DEBUG_DISPOSE - - -using System; -using System.Runtime.InteropServices; -using OpenTK; -using OpenTK.Graphics.OpenGL; -using OpenTK.Input; - -using System.Diagnostics; - -//using GGL; -using go; -using System.Threading; - - -namespace test2 -{ - class GOLIBTest_Container : OpenTKGameWindow , IValueChange - { - #region FPS - int _fps = 0; - - public int fps { - get { return _fps; } - set { - if (_fps == value) - return; - - _fps = value; - - if (_fps > fpsMax) { - fpsMax = _fps; - ValueChanged.Raise(this, new ValueChangeEventArgs ("fpsMax", fpsMax)); - } else if (_fps < fpsMin) { - fpsMin = _fps; - ValueChanged.Raise(this, new ValueChangeEventArgs ("fpsMin", fpsMin)); - } - - if (ValueChanged != null) - ValueChanged.Raise(this, new ValueChangeEventArgs ("fps", _fps)); - } - } - string name = "testName"; - - public string Name { - get { - return name; - } - set { - name = value; - } - } - - public int fpsMin = int.MaxValue; - public int fpsMax = 0; - - void resetFps () - { - fpsMin = int.MaxValue; - fpsMax = 0; - _fps = 0; - } - #endregion - - public GOLIBTest_Container () - : base(600, 400,"test") - {} - - Container g; - - protected override void OnLoad (EventArgs e) - { - base.OnLoad (e); - LoadInterface("Interfaces/testContainer.goml", out g); - - } - protected override void OnRenderFrame (FrameEventArgs e) - { - GL.Clear (ClearBufferMask.ColorBufferBit); - base.OnRenderFrame (e); - SwapBuffers (); - } - - private int frameCpt = 0; - protected override void OnUpdateFrame (FrameEventArgs e) - { - base.OnUpdateFrame (e); - - fps = (int)RenderFrequency; - - if (frameCpt > 200) { - resetFps (); - frameCpt = 0; - - } - frameCpt++; - } - - #region IValueChange implementation - - public event EventHandler ValueChanged; - - #endregion - - [STAThread] - static void Main () - { - Console.WriteLine ("starting example"); - - using (GOLIBTest_Container win = new GOLIBTest_Container( )) { - win.Run (30.0); - } - } - } -} \ No newline at end of file diff --git a/Tests/GOLIBTest_Expandable.cs b/Tests/GOLIBTest_Expandable.cs deleted file mode 100644 index d96290c1..00000000 --- a/Tests/GOLIBTest_Expandable.cs +++ /dev/null @@ -1,56 +0,0 @@ -#define MONO_CAIRO_DEBUG_DISPOSE -#define DEBUG_CLIP_RECTANGLE - - -using System; -using System.Runtime.InteropServices; -using OpenTK; -using OpenTK.Graphics.OpenGL; -using OpenTK.Input; - -using System.Diagnostics; - -//using GGL; -using go; -using System.Threading; - - -namespace test -{ - class GOLIBTest_Expandable : OpenTKGameWindow - { - public GOLIBTest_Expandable () - : base(1024, 600,"test") - {} - - Container g; - - protected override void OnLoad (EventArgs e) - { - base.OnLoad (e); - LoadInterface("Interfaces/testExpandable.goml", out g); - - } - protected override void OnRenderFrame (FrameEventArgs e) - { - GL.Clear (ClearBufferMask.ColorBufferBit); - base.OnRenderFrame (e); - SwapBuffers (); - } - - protected override void OnUpdateFrame (FrameEventArgs e) - { - base.OnUpdateFrame (e); - } - - [STAThread] - static void Main () - { - Console.WriteLine ("starting example"); - - using (GOLIBTest_Expandable win = new GOLIBTest_Expandable( )) { - win.Run (30.0); - } - } - } -} \ No newline at end of file diff --git a/Tests/GOLIBTest_HStack.cs b/Tests/GOLIBTest_HStack.cs deleted file mode 100755 index ac8e0a33..00000000 --- a/Tests/GOLIBTest_HStack.cs +++ /dev/null @@ -1,42 +0,0 @@ -#define MONO_CAIRO_DEBUG_DISPOSE - - -using System; -using System.Runtime.InteropServices; -using OpenTK; -using OpenTK.Graphics.OpenGL; -using OpenTK.Input; - -using System.Diagnostics; - -//using GGL; -using go; -using System.Threading; - - -namespace test3 -{ - class GOLIBTest_HStack : OpenTKGameWindow - { - public GOLIBTest_HStack () - : base(1024, 600,"test") - {} - - protected override void OnLoad (EventArgs e) - { - base.OnLoad (e); - LoadInterface("Interfaces/testHStack.goml"); - - } - - [STAThread] - static void Main () - { - Console.WriteLine ("starting example"); - - using (GOLIBTest_HStack win = new GOLIBTest_HStack( )) { - win.Run (30.0); - } - } - } -} \ No newline at end of file diff --git a/Tests/GOLIBTest_Label.cs b/Tests/GOLIBTest_Label.cs deleted file mode 100644 index ca9c0afd..00000000 --- a/Tests/GOLIBTest_Label.cs +++ /dev/null @@ -1,116 +0,0 @@ -#define MONO_CAIRO_DEBUG_DISPOSE - - -using System; -using System.Runtime.InteropServices; -using OpenTK; -using OpenTK.Graphics.OpenGL; -using OpenTK.Input; - -using System.Diagnostics; - -//using GGL; -using go; -using System.Threading; - - -namespace test -{ - class GOLIBTest_Label : OpenTKGameWindow , IValueChange - { - #region FPS - int _fps = 0; - - public int fps { - get { return _fps; } - set { - if (_fps == value) - return; - - _fps = value; - - if (_fps > fpsMax) { - fpsMax = _fps; - ValueChanged.Raise(this, new ValueChangeEventArgs ("fpsMax", fpsMax)); - } else if (_fps < fpsMin) { - fpsMin = _fps; - ValueChanged.Raise(this, new ValueChangeEventArgs ("fpsMin", fpsMin)); - } - - if (ValueChanged != null) - ValueChanged.Raise(this, new ValueChangeEventArgs ("fps", _fps)); - } - } - string name = "testName"; - - public string Name { - get { - return name; - } - set { - name = value; - } - } - - public int fpsMin = int.MaxValue; - public int fpsMax = 0; - - void resetFps () - { - fpsMin = int.MaxValue; - fpsMax = 0; - _fps = 0; - } - #endregion - - public GOLIBTest_Label () - : base(600, 400,"test") - {} - - Label g; - - protected override void OnLoad (EventArgs e) - { - base.OnLoad (e); - LoadInterface("Interfaces/testLabel.goml", out g); - - } - protected override void OnRenderFrame (FrameEventArgs e) - { - GL.Clear (ClearBufferMask.ColorBufferBit); - base.OnRenderFrame (e); - SwapBuffers (); - } - - private int frameCpt = 0; - protected override void OnUpdateFrame (FrameEventArgs e) - { - base.OnUpdateFrame (e); - - fps = (int)RenderFrequency; - - if (frameCpt > 200) { - resetFps (); - frameCpt = 0; - - } - frameCpt++; - } - - #region IValueChange implementation - - public event EventHandler ValueChanged; - - #endregion - - [STAThread] - static void Main () - { - Console.WriteLine ("starting example"); - - using (GOLIBTest_Label win = new GOLIBTest_Label( )) { - win.Run (30.0); - } - } - } -} \ No newline at end of file diff --git a/Tests/GOLIBTest_Scrollbar.cs b/Tests/GOLIBTest_Scrollbar.cs deleted file mode 100644 index 67572d51..00000000 --- a/Tests/GOLIBTest_Scrollbar.cs +++ /dev/null @@ -1,56 +0,0 @@ -#define MONO_CAIRO_DEBUG_DISPOSE -#define DEBUG_CLIP_RECTANGLE - - -using System; -using System.Runtime.InteropServices; -using OpenTK; -using OpenTK.Graphics.OpenGL; -using OpenTK.Input; - -using System.Diagnostics; - -//using GGL; -using go; -using System.Threading; - - -namespace test2 -{ - class GOLIBTest_Scrollbar : OpenTKGameWindow - { - public GOLIBTest_Scrollbar () - : base(1024, 600,"test") - {} - - Group g; - - protected override void OnLoad (EventArgs e) - { - base.OnLoad (e); - LoadInterface("Interfaces/testScrollbar.goml", out g); - - } - protected override void OnRenderFrame (FrameEventArgs e) - { - GL.Clear (ClearBufferMask.ColorBufferBit); - base.OnRenderFrame (e); - SwapBuffers (); - } - - protected override void OnUpdateFrame (FrameEventArgs e) - { - base.OnUpdateFrame (e); - } - - [STAThread] - static void Main () - { - Console.WriteLine ("starting example"); - - using (GOLIBTest_Scrollbar win = new GOLIBTest_Scrollbar( )) { - win.Run (30.0); - } - } - } -} \ No newline at end of file diff --git a/Tests/GOLIBTest_Spinner.cs b/Tests/GOLIBTest_Spinner.cs deleted file mode 100644 index c3b36f03..00000000 --- a/Tests/GOLIBTest_Spinner.cs +++ /dev/null @@ -1,55 +0,0 @@ -#define MONO_CAIRO_DEBUG_DISPOSE - - -using System; -using System.Runtime.InteropServices; -using OpenTK; -using OpenTK.Graphics.OpenGL; -using OpenTK.Input; - -using System.Diagnostics; - -//using GGL; -using go; -using System.Threading; - - -namespace test -{ - class GOLIBTest_Spinner : OpenTKGameWindow - { - public GOLIBTest_Spinner () - : base(1024, 600,"test") - {} - - Container g; - - protected override void OnLoad (EventArgs e) - { - base.OnLoad (e); - LoadInterface("Interfaces/testSpinner.goml", out g); - - } - protected override void OnRenderFrame (FrameEventArgs e) - { - GL.Clear (ClearBufferMask.ColorBufferBit); - base.OnRenderFrame (e); - SwapBuffers (); - } - - protected override void OnUpdateFrame (FrameEventArgs e) - { - base.OnUpdateFrame (e); - } - - [STAThread] - static void Main () - { - Console.WriteLine ("starting example"); - - using (GOLIBTest_Spinner win = new GOLIBTest_Spinner( )) { - win.Run (30.0); - } - } - } -} \ No newline at end of file diff --git a/Tests/GOLIBTest_meter.cs b/Tests/GOLIBTest_meter.cs deleted file mode 100644 index 33669d7e..00000000 --- a/Tests/GOLIBTest_meter.cs +++ /dev/null @@ -1,110 +0,0 @@ -#define MONO_CAIRO_DEBUG_DISPOSE - - -using System; -using System.Runtime.InteropServices; -using OpenTK; -using OpenTK.Graphics.OpenGL; -using OpenTK.Input; - -using System.Diagnostics; - -//using GGL; -using go; -using System.Threading; - - -namespace test -{ - class GOLIBTest_meter : OpenTKGameWindow, IValueChange - { - public GOLIBTest_meter () - : base(1024, 600,"test") - {} - - #region IValueChange implementation - public event EventHandler ValueChanged; - #endregion - - #region FPS - int _fps = 0; - - public int fps { - get { return _fps; } - set { - if (_fps == value) - return; - - _fps = value; - - if (_fps > fpsMax) { - fpsMax = _fps; - ValueChanged.Raise(this, new ValueChangeEventArgs ("fpsMax", fpsMax)); - } else if (_fps < fpsMin) { - fpsMin = _fps; - ValueChanged.Raise(this, new ValueChangeEventArgs ("fpsMin", fpsMin)); - } - - if (ValueChanged != null) - ValueChanged.Raise(this, new ValueChangeEventArgs ("fps", _fps)); - } - } - string name = "testName"; - - public string Name { - get { - return name; - } - set { - name = value; - } - } - - public int fpsMin = int.MaxValue; - public int fpsMax = 0; - - void resetFps () - { - fpsMin = int.MaxValue; - fpsMax = 0; - _fps = 0; - } - #endregion - AnalogMeter g; - - protected override void OnLoad (EventArgs e) - { - base.OnLoad (e); - LoadInterface("Interfaces/testMeter.goml", out g); - } - - protected override void OnRenderFrame (FrameEventArgs e) - { - GL.Clear (ClearBufferMask.ColorBufferBit); - base.OnRenderFrame (e); - SwapBuffers (); - } - private int frameCpt = 0; - protected override void OnUpdateFrame (FrameEventArgs e) - { - base.OnUpdateFrame (e); - - fps = (int)RenderFrequency; - - if (frameCpt > 200) { - resetFps (); - frameCpt = 0; - } - frameCpt++; - } - [STAThread] - static void Main () - { - Console.WriteLine ("starting example"); - - using (GOLIBTest_meter win = new GOLIBTest_meter( )) { - win.Run (30.0); - } - } - } -} \ No newline at end of file diff --git a/Tests/GOLIBTest_stack.cs b/Tests/GOLIBTest_stack.cs deleted file mode 100644 index 18490d6d..00000000 --- a/Tests/GOLIBTest_stack.cs +++ /dev/null @@ -1,47 +0,0 @@ -#define MONO_CAIRO_DEBUG_DISPOSE - - -using System; -using System.Runtime.InteropServices; -using OpenTK; -using OpenTK.Graphics.OpenGL; -using OpenTK.Input; - -using System.Diagnostics; - -//using GGL; -using go; -using System.Threading; - - -namespace test -{ - class GOLIBTest_stack : OpenTKGameWindow - { - public GOLIBTest_stack () - : base(1024, 600,"test") - {} - - protected override void OnLoad (EventArgs e) - { - base.OnLoad (e); - LoadInterface("Interfaces/test_stack.goml"); - - } - - protected override void OnUpdateFrame (FrameEventArgs e) - { - base.OnUpdateFrame (e); - } - - [STAThread] - static void Main () - { - Console.WriteLine ("starting example"); - - using (GOLIBTest_stack win = new GOLIBTest_stack( )) { - win.Run (30.0); - } - } - } -} \ No newline at end of file diff --git a/Tests/GOLIBTest_fps.cs b/Tests/GOLIBTests.cs similarity index 59% rename from Tests/GOLIBTest_fps.cs rename to Tests/GOLIBTests.cs index c46efcb2..a7645cb9 100644 --- a/Tests/GOLIBTest_fps.cs +++ b/Tests/GOLIBTests.cs @@ -16,8 +16,40 @@ using System.Threading; namespace test { - class GOLIBTest_fps : OpenTKGameWindow , IValueChange + class GOLIBTests : OpenTKGameWindow, IValueChange { + #region IValueChange implementation + + public event EventHandler ValueChanged; + + #endregion + + public GOLIBTests () + : base(800, 600,"test") + {} + + int frameCpt = 0; + int idx = 0; + string[] testFiles = { + "test1.goml", + "test1.1.goml", + "test1.2.goml", + "test1.3.goml", + "test2.goml", + "testLabel.goml", + "testContainer.goml", + "test_stack.goml", + "testHStack.goml", + "testScrollbar.goml", + "testSpinner.goml", + "testExpandable.goml", + "testWindow.goml", + "fps.goml", + "testMeter.goml", + "test3.goml", + "test4.1.goml", + }; + #region FPS int _fps = 0; @@ -26,7 +58,7 @@ namespace test set { if (_fps == value) return; - + _fps = value; if (_fps > fpsMax) { @@ -36,7 +68,7 @@ namespace test fpsMin = _fps; ValueChanged.Raise(this, new ValueChangeEventArgs ("fpsMin", fpsMin)); } - + ValueChanged.Raise(this, new ValueChangeEventArgs ("fps", _fps)); ValueChanged.Raise (this, new ValueChangeEventArgs ("update", this.updateTime.ElapsedMilliseconds.ToString () + " ms")); @@ -52,39 +84,14 @@ namespace test fpsMax = 0; _fps = 0; } - #endregion - public string update = ""; - - string name = "testName"; - - public string Name { - get { - return name; - } - set { - name = value; - } - } - - public GOLIBTest_fps () - : base(600, 400,"test") - { - VSync = VSyncMode.Off; - } + #endregion protected override void OnLoad (EventArgs e) { base.OnLoad (e); - LoadInterface("Interfaces/fps.goml"); - - - //ValueChanged += (object sender, ValueChangeEventArgs vce) => labFps.Text = vce.NewValue.ToString (); - - + LoadInterface("Interfaces/" + testFiles[idx]); } - - private int frameCpt = 0; protected override void OnUpdateFrame (FrameEventArgs e) { base.OnUpdateFrame (e); @@ -98,20 +105,28 @@ namespace test } frameCpt++; } + protected override void OnKeyDown (KeyboardKeyEventArgs e) + { + base.OnKeyDown (e); + if (e.Key == Key.Escape) { + this.Quit (); + } + ClearInterface (); + idx++; + if (idx == testFiles.Length) + idx = 0; + this.Title = testFiles [idx]; + LoadInterface("Interfaces/" + testFiles[idx]); - #region IValueChange implementation - - public event EventHandler ValueChanged; - - #endregion + } [STAThread] static void Main () { Console.WriteLine ("starting example"); - using (GOLIBTest_fps win = new GOLIBTest_fps( )) { - win.Run (60.0); + using (GOLIBTests win = new GOLIBTests( )) { + win.Run (30.0); } } } diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj index 6c994d0e..b6f21253 100644 --- a/Tests/Tests.csproj +++ b/Tests/Tests.csproj @@ -8,7 +8,7 @@ Exe Tests Tests - test.GOLIBTest_Window + test.GOLIBTests v4.5 ..\bin\$(configuration) obj\$(configuration) @@ -46,26 +46,11 @@ - - - - - - - - - - - - - - - - + diff --git a/src/Interface.cs b/src/Interface.cs index d7a35f81..63160cf5 100644 --- a/src/Interface.cs +++ b/src/Interface.cs @@ -113,9 +113,7 @@ namespace go return tmp; } public static void Load(string file, out T result, object hostClass = null) - { - //result = (T)(Load (file, hostClass) as object); - + { GOMLResolutionStack.Push(new List()); XmlSerializerNamespaces xn = new XmlSerializerNamespaces(); diff --git a/src/OpenTKGameWindow.cs b/src/OpenTKGameWindow.cs index d34d6bfa..fa68cb89 100755 --- a/src/OpenTKGameWindow.cs +++ b/src/OpenTKGameWindow.cs @@ -88,7 +88,13 @@ namespace go g.Visible = false;//trick to ensure clip is added to refresh zone GraphicObjects.Remove (g); } - + /// Remove all Graphic objects from top container + public void ClearInterface() + { + foreach (GraphicObject g in GraphicObjects) + g.Visible = false; + GraphicObjects.Clear (); + } public void Quit () { this.Exit (); -- 2.47.3