From: jpbruyere Date: Thu, 18 Dec 2014 21:41:10 +0000 (+0100) Subject: misa a jour X-Git-Tag: 0.2~112 X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=d5a5d9516969d7a0fb665a72be7269e7bd51ad58;p=jp%2Fcrow.git misa a jour --- 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 00000000..f3d40961 Binary files /dev/null and b/Images/Icons/icon_alert.gif differ diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs new file mode 100755 index 00000000..e86ad8ec --- /dev/null +++ b/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("golib")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("golib")] +[assembly: AssemblyCopyright("Copyright © 2014")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("150376dc-e648-46a2-b692-6429d0a62362")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.1")] +[assembly: AssemblyFileVersion("1.0.0.1")] diff --git a/README.md b/README.md index 4628d890..9fd6d3e0 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,14 @@ GOLib ===== -Graphic Object Library: custom widget library on top of cairo. Support win32, opengl, framebuffer surfaces +Graphic Object Library: custom widget library for OpenTK. -Initially designed to provide fast widget toolkit for game development with OpenTK, the interface code of my game engine -was splitted in this lib to provide generic widgets toolkit for other uses. +Lightweight Widget toolkit for OpenTK using Mono.Cairo as backend. -On linux, OpenTK gives a abstraction layer for periferics. +Due to OpenTK experimental support for kms, I decided to use the +OpenTK window as base container for applications. -On the framme buffer, I use a small self-made multi-threaded lib on top of ev-dev. +Layouting is still a bit consuming, I'm working on simplification. -For win32 surface, i still need to code low level periferic access, no great motivation to do that.... -It support transparency by default (compositing), but a faster lib with no transparency could be achieve easily - -Lots of debug have been made, i release the code, and will try to make it evolves and perhaps find new motivations with -contributors. - -I'll make a small example soon... diff --git a/Tests/GOLIBTest_0.cs b/Tests/GOLIBTest_0.cs new file mode 100644 index 00000000..3cc4e834 --- /dev/null +++ b/Tests/GOLIBTest_0.cs @@ -0,0 +1,55 @@ +#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_0 : OpenTKGameWindow + { + public GOLIBTest_0 () + : base(1024, 600,"test") + {} + + GraphicObject g; + + protected override void OnLoad (EventArgs e) + { + base.OnLoad (e); + LoadInterface("Interfaces/test0.xml", 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_0 win = new GOLIBTest_0( )) { + win.Run (30.0); + } + } + } +} \ No newline at end of file diff --git a/Tests/GOLIBTest_4.cs b/Tests/GOLIBTest_4.cs new file mode 100644 index 00000000..8dbc0c7e --- /dev/null +++ b/Tests/GOLIBTest_4.cs @@ -0,0 +1,180 @@ +#define MONO_CAIRO_DEBUG_DISPOSE + + +using System; +using System.Runtime.InteropServices; +using OpenTK; +using OpenTK.Graphics.OpenGL; +using OpenTK.Input; + +using System.Diagnostics; + + +using go; +using System.Threading; + + +namespace test +{ + class GOLIBTest_4 : OpenTKGameWindow + { + public GOLIBTest_4 () + : base(1024, 800,"test4") + {} + + + #region FPS + static int _fps = 0; + + public static int fps { + get { return _fps; } + set { + _fps = value; + if (_fps > 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