From: jpbruyere Date: Wed, 9 Sep 2015 10:10:12 +0000 (+0200) Subject: * Tests.csproj: X-Git-Tag: 0.2~50 X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=ea0ee8408e82a19c00637aaa054165bbb49805ba;p=jp%2Fcrow.git * 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 --- 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_fps.cs b/Tests/GOLIBTest_fps.cs deleted file mode 100644 index c46efcb2..00000000 --- a/Tests/GOLIBTest_fps.cs +++ /dev/null @@ -1,118 +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_fps : 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)); - } - - ValueChanged.Raise(this, new ValueChangeEventArgs ("fps", _fps)); - ValueChanged.Raise (this, new ValueChangeEventArgs ("update", - this.updateTime.ElapsedMilliseconds.ToString () + " ms")); - } - } - - public int fpsMin = int.MaxValue; - public int fpsMax = 0; - - void resetFps () - { - fpsMin = int.MaxValue; - 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; - } - - protected override void OnLoad (EventArgs e) - { - base.OnLoad (e); - LoadInterface("Interfaces/fps.goml"); - - - //ValueChanged += (object sender, ValueChangeEventArgs vce) => labFps.Text = vce.NewValue.ToString (); - - - } - - 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_fps win = new GOLIBTest_fps( )) { - win.Run (60.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/GOLIBTests.cs b/Tests/GOLIBTests.cs new file mode 100644 index 00000000..a7645cb9 --- /dev/null +++ b/Tests/GOLIBTests.cs @@ -0,0 +1,133 @@ +#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 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; + + 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)); + } + + ValueChanged.Raise(this, new ValueChangeEventArgs ("fps", _fps)); + ValueChanged.Raise (this, new ValueChangeEventArgs ("update", + this.updateTime.ElapsedMilliseconds.ToString () + " ms")); + } + } + + public int fpsMin = int.MaxValue; + public int fpsMax = 0; + + void resetFps () + { + fpsMin = int.MaxValue; + fpsMax = 0; + _fps = 0; + } + public string update = ""; + #endregion + + protected override void OnLoad (EventArgs e) + { + base.OnLoad (e); + LoadInterface("Interfaces/" + testFiles[idx]); + } + protected override void OnUpdateFrame (FrameEventArgs e) + { + base.OnUpdateFrame (e); + + fps = (int)RenderFrequency; + + + if (frameCpt > 200) { + resetFps (); + frameCpt = 0; + } + 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]); + + } + + [STAThread] + static void Main () + { + Console.WriteLine ("starting example"); + + using (GOLIBTests win = new GOLIBTests( )) { + win.Run (30.0); + } + } + } +} \ No newline at end of file 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 ();