From d5a5d9516969d7a0fb665a72be7269e7bd51ad58 Mon Sep 17 00:00:00 2001 From: jpbruyere Date: Thu, 18 Dec 2014 22:41:10 +0100 Subject: [PATCH] misa a jour --- .gitignore | 7 +- GOLib.csproj | 337 +- GOLib.sln | 46 + Images/Icons/icon_alert.gif | Bin 0 -> 585 bytes {src => Properties}/AssemblyInfo.cs | 72 +- README.md | 17 +- Tests/GOLIBTest_0.cs | 55 + Tests/GOLIBTest_4.cs | 180 + Tests/GOLIBTest_5.cs | 73 + Tests/Interfaces/test0.xml | 4 + Tests/Interfaces/test4.xml | 73 + Tests/Interfaces/test5.xml | 46 + Tests/Tests.csproj | 72 + dependencies/OpenTK.Compatibility.dll | Bin 0 -> 3215872 bytes dependencies/OpenTK.Compatibility.dll.config | 11 + dependencies/OpenTK.Compatibility.dll.mdb | Bin 0 -> 785399 bytes dependencies/OpenTK.GLControl.dll | Bin 0 -> 35328 bytes dependencies/OpenTK.GLControl.xml | 189 + dependencies/OpenTK.dll | Bin 0 -> 4036096 bytes dependencies/OpenTK.dll.config | 25 + dependencies/OpenTK.dll.mdb | Bin 0 -> 289903 bytes dependencies/OpenTK.xml | 442052 ++++++++++++++++ lib/OpenTK.Compatibility.dll | Bin 3223552 -> 0 bytes lib/OpenTK.GLControl.dll | Bin 24576 -> 0 bytes lib/OpenTK.dll | Bin 2719744 -> 0 bytes lib/freetype6.dll | Bin 551096 -> 0 bytes lib/intl.dll | Bin 152489 -> 0 bytes lib/libcairo-2.dll | Bin 1294335 -> 0 bytes lib/libcairo-gobject-2.dll | Bin 44049 -> 0 bytes lib/libcairo-script-interpreter-2.dll | Bin 182789 -> 0 bytes lib/libexpat-1.dll | Bin 143096 -> 0 bytes lib/libfontconfig-1.dll | Bin 279059 -> 0 bytes lib/libpng14-14.dll | Bin 230529 -> 0 bytes lib/zlib1.dll | Bin 100352 -> 0 bytes src/Button.cs | 460 - src/Cairo/CairoHelpers.cs | 119 + src/Colors.cs | 1098 +- src/Container.cs | 139 - src/{enums.cs => Enums.cs} | 140 +- src/EventSource.cs | 14 + src/GenericStack.cs | 101 - src/GraphicObject.cs | 733 - src/GraphicObjects/Button.cs | 266 + src/GraphicObjects/Container.cs | 214 + src/GraphicObjects/GenericStack.cs | 163 + src/GraphicObjects/GraduatedSlider.cs | 51 + src/GraphicObjects/GraphicObject.cs | 951 + src/GraphicObjects/Group.cs | 324 + src/GraphicObjects/GroupBox.cs | 159 + src/{ => GraphicObjects}/HorizontalStack.cs | 43 +- src/GraphicObjects/ILayoutable.cs | 28 + src/{ => GraphicObjects}/Image.cs | 253 +- src/GraphicObjects/Label.cs | 294 + src/GraphicObjects/NumericControl.cs | 119 + src/GraphicObjects/ProgressBar.cs | 110 + src/GraphicObjects/Scroller.cs | 219 + src/GraphicObjects/Slider.cs | 156 + src/GraphicObjects/TextBox.cs | 420 + src/{ => GraphicObjects}/VerticalStack.cs | 41 +- src/Group.cs | 429 - src/GroupBox.cs | 213 - src/HorizontalWrappingWidget.cs | 38 - src/Interface.cs | 567 - src/Label.cs | 302 - src/Mouse.cs | 82 +- src/Mouse3d.cs | 182 - src/OpenTKGameWindow.cs | 585 + src/Panel.cs | 324 - src/PanelWithTitle.cs | 160 - src/Point.cs | 267 +- src/Rectangle.cs | 525 +- src/Rectangles.cs | 368 +- src/ScrollingWidget.cs | 138 - src/Size.cs | 226 +- src/Slider.cs | 143 - src/Spinner.cs | 137 - src/TextBox.cs | 528 - src/ValueChangeEventArgs.cs | 17 + src/VerticalWrappingWidget.cs | 38 - src/WrappedWidgetGroup.cs | 154 - src/directories.cs | 30 +- src/{ => win32}/Win32.cs | 122 +- src/win32/winApi.cs | 1238 + 83 files changed, 450630 insertions(+), 6057 deletions(-) create mode 100644 GOLib.sln create mode 100755 Images/Icons/icon_alert.gif rename {src => Properties}/AssemblyInfo.cs (82%) mode change 100644 => 100755 create mode 100644 Tests/GOLIBTest_0.cs create mode 100644 Tests/GOLIBTest_4.cs create mode 100644 Tests/GOLIBTest_5.cs create mode 100755 Tests/Interfaces/test0.xml create mode 100755 Tests/Interfaces/test4.xml create mode 100755 Tests/Interfaces/test5.xml create mode 100644 Tests/Tests.csproj create mode 100755 dependencies/OpenTK.Compatibility.dll create mode 100644 dependencies/OpenTK.Compatibility.dll.config create mode 100644 dependencies/OpenTK.Compatibility.dll.mdb create mode 100755 dependencies/OpenTK.GLControl.dll create mode 100644 dependencies/OpenTK.GLControl.xml create mode 100755 dependencies/OpenTK.dll create mode 100644 dependencies/OpenTK.dll.config create mode 100644 dependencies/OpenTK.dll.mdb create mode 100644 dependencies/OpenTK.xml delete mode 100644 lib/OpenTK.Compatibility.dll delete mode 100644 lib/OpenTK.GLControl.dll delete mode 100644 lib/OpenTK.dll delete mode 100644 lib/freetype6.dll delete mode 100644 lib/intl.dll delete mode 100644 lib/libcairo-2.dll delete mode 100644 lib/libcairo-gobject-2.dll delete mode 100644 lib/libcairo-script-interpreter-2.dll delete mode 100644 lib/libexpat-1.dll delete mode 100644 lib/libfontconfig-1.dll delete mode 100644 lib/libpng14-14.dll delete mode 100644 lib/zlib1.dll delete mode 100644 src/Button.cs create mode 100755 src/Cairo/CairoHelpers.cs delete mode 100644 src/Container.cs rename src/{enums.cs => Enums.cs} (94%) create mode 100644 src/EventSource.cs delete mode 100644 src/GenericStack.cs delete mode 100644 src/GraphicObject.cs create mode 100644 src/GraphicObjects/Button.cs create mode 100644 src/GraphicObjects/Container.cs create mode 100644 src/GraphicObjects/GenericStack.cs create mode 100644 src/GraphicObjects/GraduatedSlider.cs create mode 100644 src/GraphicObjects/GraphicObject.cs create mode 100644 src/GraphicObjects/Group.cs create mode 100644 src/GraphicObjects/GroupBox.cs rename src/{ => GraphicObjects}/HorizontalStack.cs (56%) create mode 100644 src/GraphicObjects/ILayoutable.cs rename src/{ => GraphicObjects}/Image.cs (53%) create mode 100644 src/GraphicObjects/Label.cs create mode 100644 src/GraphicObjects/NumericControl.cs create mode 100644 src/GraphicObjects/ProgressBar.cs create mode 100644 src/GraphicObjects/Scroller.cs create mode 100644 src/GraphicObjects/Slider.cs create mode 100644 src/GraphicObjects/TextBox.cs rename src/{ => GraphicObjects}/VerticalStack.cs (57%) delete mode 100644 src/Group.cs delete mode 100644 src/GroupBox.cs delete mode 100644 src/HorizontalWrappingWidget.cs delete mode 100644 src/Interface.cs delete mode 100644 src/Label.cs delete mode 100644 src/Mouse3d.cs create mode 100644 src/OpenTKGameWindow.cs delete mode 100644 src/Panel.cs delete mode 100644 src/PanelWithTitle.cs delete mode 100644 src/ScrollingWidget.cs delete mode 100644 src/Slider.cs delete mode 100644 src/Spinner.cs delete mode 100644 src/TextBox.cs create mode 100644 src/ValueChangeEventArgs.cs delete mode 100644 src/VerticalWrappingWidget.cs delete mode 100644 src/WrappedWidgetGroup.cs rename src/{ => win32}/Win32.cs (95%) mode change 100644 => 100755 create mode 100755 src/win32/winApi.cs diff --git a/.gitignore b/.gitignore index 3b3b05fa..5ad7b970 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,9 @@ Win_x86 Debug -/*.sln - /GOLib.suo +/bin/* +/obj/* +/GOLib.userprefs +/Tests/obj/* +/Tests/bin/* diff --git a/GOLib.csproj b/GOLib.csproj index e32dd8f9..0daeaca9 100644 --- a/GOLib.csproj +++ b/GOLib.csproj @@ -1,187 +1,150 @@ - - - - Debug - Linux_x86 - 8.0.30703 - 2.0 - {C2980F9B-4798-4C05-99E2-E174810F7C7B} - Library - Properties - go - Interface - 512 - True - False - False - bin\$(configuration)\$(Platform) - obj\$(Configuration)\ - 4 - False - false - False - OnBuildSuccess - - - False - False - obj\ - Full - - - 4194304 - x86 - False - False - Auto - - - AnyCPU - 4194304 - False - Auto - - - x86 - 4194304 - False - Auto - - - True - False - obj\ - None - - - TRACE;DEBUG;__linux__ - ..\bin\Debug\Linux_x86 - true - - - TRACE;DEBUG;_WIN32 - - - __linux__ - ..\bin\Release\Linux_x86 - - - _WIN32 - - - none - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - - - - - - - - False - lib\OpenTK.dll - - - False - lib\OpenTK.Compatibility.dll - - - False - lib\OpenTK.GLControl.dll - - - ..\..\..\OpenTK\1.0\Binaries\OpenTK\Debug\OpenTK.Compatibility.dll - - - ..\..\..\OpenTK\1.0\Binaries\OpenTK\Debug\OpenTK.dll - - - ..\..\..\OpenTK\1.0\Binaries\OpenTK\Debug\OpenTK.GLControl.dll - - - False - gtk-sharp-2.0 - - - - - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - - \ No newline at end of file + + + + Debug + Linux_x86 + {C2980F9B-4798-4C05-99E2-E174810F7C7B} + Library + Properties + go + golib + 512 + True + False + False + bin\$(configuration)\$(Platform) + obj\$(Configuration)\ + 4 + False + false + False + OnBuildSuccess + 8.0.30703 + 2.0 + + + False + False + obj\ + Full + + + 4194304 + x86 + False + False + Auto + + + AnyCPU + 4194304 + False + Auto + + + x86 + 4194304 + False + Auto + + + True + False + obj\ + None + + + TRACE;DEBUG;__linux__;DEBUG_CLIP_RECTANGLE + bin\Linux_x86\Debug + true + true + + + TRACE;DEBUG;_WIN32 + none + + + __linux__ + bin\Linux_x86\Release + x64 + + + _WIN32 + + + none + bin\Debug + + + bin\Release + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + dependencies\OpenTK.Compatibility.dll + + + dependencies\OpenTK.dll + + + + + + + + + + + + + + + + PreserveNewest + + + diff --git a/GOLib.sln b/GOLib.sln new file mode 100644 index 00000000..7eced5dc --- /dev/null +++ b/GOLib.sln @@ -0,0 +1,46 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GOLib", "GOLib.csproj", "{C2980F9B-4798-4C05-99E2-E174810F7C7B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj", "{74289092-9F70-4941-AFCB-DFD7BE2140B6}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Linux_x86 = Debug|Linux_x86 + Debug|Win_x86 = Debug|Win_x86 + Release|Linux_x86 = Release|Linux_x86 + Release|Win_x86 = Release|Win_x86 + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {74289092-9F70-4941-AFCB-DFD7BE2140B6}.Debug|Any CPU.ActiveCfg = Debug|Linux_x86 + {74289092-9F70-4941-AFCB-DFD7BE2140B6}.Debug|Any CPU.Build.0 = Debug|Linux_x86 + {74289092-9F70-4941-AFCB-DFD7BE2140B6}.Debug|Linux_x86.ActiveCfg = Debug|Linux_x86 + {74289092-9F70-4941-AFCB-DFD7BE2140B6}.Debug|Linux_x86.Build.0 = Debug|Linux_x86 + {74289092-9F70-4941-AFCB-DFD7BE2140B6}.Debug|Win_x86.ActiveCfg = Debug|Linux_x86 + {74289092-9F70-4941-AFCB-DFD7BE2140B6}.Debug|Win_x86.Build.0 = Debug|Linux_x86 + {74289092-9F70-4941-AFCB-DFD7BE2140B6}.Release|Any CPU.ActiveCfg = Release|Linux_x86 + {74289092-9F70-4941-AFCB-DFD7BE2140B6}.Release|Any CPU.Build.0 = Release|Linux_x86 + {74289092-9F70-4941-AFCB-DFD7BE2140B6}.Release|Linux_x86.ActiveCfg = Release|Linux_x86 + {74289092-9F70-4941-AFCB-DFD7BE2140B6}.Release|Linux_x86.Build.0 = Release|Linux_x86 + {74289092-9F70-4941-AFCB-DFD7BE2140B6}.Release|Win_x86.ActiveCfg = Release|Linux_x86 + {74289092-9F70-4941-AFCB-DFD7BE2140B6}.Release|Win_x86.Build.0 = Release|Linux_x86 + {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Debug|Linux_x86.ActiveCfg = Debug|Linux_x86 + {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Debug|Linux_x86.Build.0 = Debug|Linux_x86 + {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Debug|Win_x86.ActiveCfg = Debug|Win_x86 + {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Debug|Win_x86.Build.0 = Debug|Win_x86 + {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Release|Any CPU.Build.0 = Release|Any CPU + {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Release|Linux_x86.ActiveCfg = Release|Linux_x86 + {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Release|Linux_x86.Build.0 = Release|Linux_x86 + {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Release|Win_x86.ActiveCfg = Release|Win_x86 + {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Release|Win_x86.Build.0 = Release|Win_x86 + EndGlobalSection + GlobalSection(MonoDevelopProperties) = preSolution + StartupItem = Tests\Tests.csproj + EndGlobalSection +EndGlobal diff --git a/Images/Icons/icon_alert.gif b/Images/Icons/icon_alert.gif new file mode 100755 index 0000000000000000000000000000000000000000..f3d409618dfce5fb8a892b2ea8a9bcf2debd3dc2 GIT binary patch literal 585 zcmZ?wbhEHb6krfwc;?RV|Mt@V-(LQIefIy``~QEv{l6vQe~-ie6;}V3+5W#i|NqJ2 z{|$owpRPD}?%e-d#s4q#{$H5z|5EY)dWQdBpZ$MazO>5v|L2GQ3mE?2?fw5~*Z&7A zmNt0)pQ`=;N$>ybz5iDhoI8E;|M99RQ>Og?{r3O&hyPb4{C|J{|JR5AKi>bp#sB}e z%l}&>{=b-SYi08E*!2I;r+qr!Zfj#XWy<6$=a2ti@9E`g`@fq1_SG|)8R<87Px!w~ z{rZVb|9?I_yMMKV&of15*t~?Smn$!hZ=CBB=FOZXR zCHi4g$k fpsMax) + fpsMax = _fps; + else if (_fps < fpsMin) + fpsMin = _fps; + } + + } + + public static int fpsMin = int.MaxValue; + public static int fpsMax = 0; + + static void resetFps () + { + fpsMin = int.MaxValue; + fpsMax = 0; + _fps = 0; + } + #endregion + + Group c,c2; + ProgressBar pb, pb2; + Label labMousePos, labPb, labF, labA, labH, labFps, labFpsMin, labFpsMax, labV, + labUpdate; + Slider slTest; + Group colors; + + protected override void OnLoad (EventArgs e) + { + base.OnLoad (e); + + LoadInterface("Interfaces/test4.xml", out c); + //LoadInterface("golibtests/test4.xml", out c2); + //c2.HorizontalAlignment = HorizontalAlignment.Left; + //c2.VerticalAlignment = VerticalAlignment.Top; + c.Background.AdjustAlpha (0.5); + labMousePos = c.FindByName ("labMouse") as Label; + pb = c.FindByName("pbBar") as ProgressBar; + pb2 = c.FindByName("pbBar2") as ProgressBar; + labPb = c.FindByName ("labPb") as Label; + labF = c.FindByName ("labFocus") as Label; + labA = c.FindByName ("labActive") as Label; + labH = c.FindByName ("labHover") as Label; + labFps = c.FindByName ("labFps") as Label; + labFpsMin = c.FindByName ("labFpsMin") as Label; + labFpsMax = c.FindByName ("labFpsMax") as Label; + labV = c.FindByName ("labValue") as Label; + labUpdate = c.FindByName ("labUpdate") as Label; + slTest = c.FindByName ("slider") as Slider; + colors = c.FindByName ("colors") as Group; + + + c.MouseMove += pFps_mousemove; + slTest.ValueChanged += (object sender, ValueChangeEventArgs vce) => { + labV.Text = vce.NewValue.ToString ("00.00"); + }; + + + int i = 0; + foreach (Color col in Color.ColorDic) { + HorizontalStack s = colors.addChild (new HorizontalStack ()); + s.HorizontalAlignment = HorizontalAlignment.Left; + s.addChild (new Button () { + Bounds = new Size(32, 20), + CornerRadius = 5, + Background = col, + } + ); + + s.addChild ( + new Label (col.ToString ()){ + Bounds=new Rectangle(0,0,-1,-1), + } + ); + i++; + if (i > 50) + break; + } + } + void pFps_mousemove(object sender, MouseMoveEventArgs e) + { + if (!e.Mouse.IsButtonDown (MouseButton.Left)) + return; + redrawClip.AddRectangle (c.ScreenCoordinates(c.Slot)); + c.Left += e.XDelta; + c.Top += e.YDelta; + c.LayoutIsValid = false; + c.registerForGraphicUpdate (); + } + 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; + + labFps.Text = fps.ToString(); + labUpdate.Text = this.updateTime.ElapsedMilliseconds.ToString(); + if (frameCpt > 200) { + labFpsMin.Text = fpsMin.ToString(); + labFpsMax.Text = fpsMax.ToString(); + resetFps (); + frameCpt = 0; + + } + frameCpt++; + + if (pb.Value == pb.Maximum) + pb.Value = 0; + pb.Value++; + //pb2.Value = pb.Value; + labPb.Text = pb.Value.ToString (); + if (FocusedWidget==null) + labF.Text = "- none -"; + else + labF.Text = FocusedWidget.Name; + + if (activeWidget==null) + labA.Text = "- none -"; + else + labA.Text = activeWidget.Name; + + if (hoverWidget==null) + labH.Text = "- none -"; + else + labH.Text = hoverWidget.Name; + } + protected override void OnMouseMove (MouseMoveEventArgs e) + { + base.OnMouseMove (e); + labMousePos.Text = e.Position.ToString (); + } + [STAThread] + static void Main () + { + Console.WriteLine ("starting example"); + + using (GOLIBTest_4 win = new GOLIBTest_4( )) { + win.Run (60.0); + } + } + } +} \ No newline at end of file diff --git a/Tests/GOLIBTest_5.cs b/Tests/GOLIBTest_5.cs new file mode 100644 index 00000000..ce515ba8 --- /dev/null +++ b/Tests/GOLIBTest_5.cs @@ -0,0 +1,73 @@ +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; +using System.Collections.Generic; + + +namespace test +{ + class GOLIBTest_5 : OpenTKGameWindow + { + public GOLIBTest_5 () + : base(1024, 600,"test5") + {} + + Container c; + List gl = new List(); + List