From: jpbruyere Date: Tue, 19 Jul 2016 01:35:12 +0000 (+0200) Subject: lots of unordered changes, I commited all in a devel branch, which will be the progra... X-Git-Tag: v0.4~55^2~9 X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=b24beece9ed58b2700dd5d2d56fa45e446567ab0;p=jp%2Fcrow.git lots of unordered changes, I commited all in a devel branch, which will be the programming branch --- diff --git a/Crow.csproj b/Crow.csproj index eaae1e2e..d9d49339 100644 --- a/Crow.csproj +++ b/Crow.csproj @@ -32,289 +32,109 @@ true DEBUG_FOCUS0;DEBUG_LAYOUTING0;TRACE;DEBUG;__linux__;MEASURE_TIME;DEBUG_LOAD0;DEBUG_BINDING0;DEBUG_CLIP_RECTANGLE0 false + build\obj\Debug + build\Debug True None __linux__;MEASURE_TIME + build\obj\Release + build\Release - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -435,13 +255,11 @@ + + - - - - - - + + diff --git a/Crow.sln b/Crow.sln index fd256cc4..9ed39d88 100644 --- a/Crow.sln +++ b/Crow.sln @@ -5,123 +5,40 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Crow", "Crow.csproj", "{C29 EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj", "{74289092-9F70-4941-AFCB-DFD7BE2140B6}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoDevelop.GOLib", "MonoDevelop.GOLib\MonoDevelop.GOLib.csproj", "{E9E14DB5-3C67-4E01-B5C3-4D90D7E31A2E}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoDevelop.Diagram", "..\MonoDevelop.Diagram\MonoDevelop.Diagram.csproj", "{232716B4-D19D-4FD7-B310-94A98FD926F0}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTest", "UnitTest\UnitTest.csproj", "{7BAE4448-E8F4-48B3-BB11-FA78E7F4506B}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OTKCrow", "OTKCrow\OTKCrow.csproj", "{350D4F49-9901-4998-9903-BCA7D48DA58C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GtkCrow", "GtkCrow\GtkCrow.csproj", "{D6F98B08-56B8-405C-9212-F9D26097E35F}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GLCrow", "GLCrow\GLCrow.csproj", "{66376B95-9351-4A63-B920-F4BB53FEF0E2}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pencil.Gaming", "..\..\src\Pencil.Gaming\Pencil.Gaming\Pencil.Gaming.csproj", "{DDB6DB6D-E5DE-4BDB-8AC8-26DF800E9FF0}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU Debug|Linux_x86 = Debug|Linux_x86 Release|Linux_x86 = Release|Linux_x86 - Compatibility-GLFW2|Any CPU = Compatibility-GLFW2|Any CPU - Core-GLFW2|Any CPU = Core-GLFW2|Any CPU - Compatibility-GLFW3|Any CPU = Compatibility-GLFW3|Any CPU - Core-GLFW3|Any CPU = Core-GLFW3|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {232716B4-D19D-4FD7-B310-94A98FD926F0}.Compatibility-GLFW2|Any CPU.ActiveCfg = Debug|Any CPU - {232716B4-D19D-4FD7-B310-94A98FD926F0}.Compatibility-GLFW2|Any CPU.Build.0 = Debug|Any CPU - {232716B4-D19D-4FD7-B310-94A98FD926F0}.Compatibility-GLFW3|Any CPU.ActiveCfg = Debug|Any CPU - {232716B4-D19D-4FD7-B310-94A98FD926F0}.Compatibility-GLFW3|Any CPU.Build.0 = Debug|Any CPU - {232716B4-D19D-4FD7-B310-94A98FD926F0}.Core-GLFW2|Any CPU.ActiveCfg = Debug|Any CPU - {232716B4-D19D-4FD7-B310-94A98FD926F0}.Core-GLFW2|Any CPU.Build.0 = Debug|Any CPU - {232716B4-D19D-4FD7-B310-94A98FD926F0}.Core-GLFW3|Any CPU.ActiveCfg = Debug|Any CPU - {232716B4-D19D-4FD7-B310-94A98FD926F0}.Debug|Linux_x86.ActiveCfg = Debug|Any CPU - {232716B4-D19D-4FD7-B310-94A98FD926F0}.Release|Linux_x86.ActiveCfg = Debug|Any CPU - {350D4F49-9901-4998-9903-BCA7D48DA58C}.Compatibility-GLFW2|Any CPU.ActiveCfg = Debug|Linux_x86 - {350D4F49-9901-4998-9903-BCA7D48DA58C}.Compatibility-GLFW2|Any CPU.Build.0 = Debug|Linux_x86 - {350D4F49-9901-4998-9903-BCA7D48DA58C}.Compatibility-GLFW3|Any CPU.ActiveCfg = Debug|Linux_x86 - {350D4F49-9901-4998-9903-BCA7D48DA58C}.Compatibility-GLFW3|Any CPU.Build.0 = Debug|Linux_x86 - {350D4F49-9901-4998-9903-BCA7D48DA58C}.Core-GLFW2|Any CPU.ActiveCfg = Debug|Linux_x86 - {350D4F49-9901-4998-9903-BCA7D48DA58C}.Core-GLFW2|Any CPU.Build.0 = Debug|Linux_x86 - {350D4F49-9901-4998-9903-BCA7D48DA58C}.Core-GLFW3|Any CPU.ActiveCfg = Debug|Linux_x86 - {350D4F49-9901-4998-9903-BCA7D48DA58C}.Debug|Linux_x86.ActiveCfg = Debug|Linux_x86 - {350D4F49-9901-4998-9903-BCA7D48DA58C}.Release|Linux_x86.ActiveCfg = Release|Linux_x86 - {66376B95-9351-4A63-B920-F4BB53FEF0E2}.Compatibility-GLFW2|Any CPU.ActiveCfg = Debug|Linux_x86 - {66376B95-9351-4A63-B920-F4BB53FEF0E2}.Compatibility-GLFW2|Any CPU.Build.0 = Debug|Linux_x86 - {66376B95-9351-4A63-B920-F4BB53FEF0E2}.Compatibility-GLFW3|Any CPU.ActiveCfg = Debug|Linux_x86 - {66376B95-9351-4A63-B920-F4BB53FEF0E2}.Compatibility-GLFW3|Any CPU.Build.0 = Debug|Linux_x86 - {66376B95-9351-4A63-B920-F4BB53FEF0E2}.Core-GLFW2|Any CPU.ActiveCfg = Debug|Linux_x86 - {66376B95-9351-4A63-B920-F4BB53FEF0E2}.Core-GLFW2|Any CPU.Build.0 = Debug|Linux_x86 - {66376B95-9351-4A63-B920-F4BB53FEF0E2}.Core-GLFW3|Any CPU.ActiveCfg = Debug|Linux_x86 - {66376B95-9351-4A63-B920-F4BB53FEF0E2}.Core-GLFW3|Any CPU.Build.0 = Debug|Linux_x86 - {66376B95-9351-4A63-B920-F4BB53FEF0E2}.Debug|Linux_x86.ActiveCfg = Debug|Linux_x86 - {66376B95-9351-4A63-B920-F4BB53FEF0E2}.Debug|Linux_x86.Build.0 = Debug|Linux_x86 - {66376B95-9351-4A63-B920-F4BB53FEF0E2}.Release|Linux_x86.ActiveCfg = Release|Linux_x86 - {66376B95-9351-4A63-B920-F4BB53FEF0E2}.Release|Linux_x86.Build.0 = Release|Linux_x86 - {74289092-9F70-4941-AFCB-DFD7BE2140B6}.Compatibility-GLFW2|Any CPU.ActiveCfg = Debug|Any CPU - {74289092-9F70-4941-AFCB-DFD7BE2140B6}.Compatibility-GLFW2|Any CPU.Build.0 = Debug|Any CPU - {74289092-9F70-4941-AFCB-DFD7BE2140B6}.Compatibility-GLFW3|Any CPU.ActiveCfg = Debug|Any CPU - {74289092-9F70-4941-AFCB-DFD7BE2140B6}.Compatibility-GLFW3|Any CPU.Build.0 = Debug|Any CPU - {74289092-9F70-4941-AFCB-DFD7BE2140B6}.Core-GLFW2|Any CPU.ActiveCfg = Debug|Any CPU - {74289092-9F70-4941-AFCB-DFD7BE2140B6}.Core-GLFW2|Any CPU.Build.0 = Debug|Any CPU - {74289092-9F70-4941-AFCB-DFD7BE2140B6}.Core-GLFW3|Any CPU.ActiveCfg = Debug|Any CPU - {74289092-9F70-4941-AFCB-DFD7BE2140B6}.Core-GLFW3|Any CPU.Build.0 = Debug|Any CPU + {350D4F49-9901-4998-9903-BCA7D48DA58C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {350D4F49-9901-4998-9903-BCA7D48DA58C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {350D4F49-9901-4998-9903-BCA7D48DA58C}.Debug|Linux_x86.ActiveCfg = Debug|Any CPU + {350D4F49-9901-4998-9903-BCA7D48DA58C}.Debug|Linux_x86.Build.0 = Debug|Any CPU + {350D4F49-9901-4998-9903-BCA7D48DA58C}.Release|Any CPU.ActiveCfg = Debug|Any CPU + {350D4F49-9901-4998-9903-BCA7D48DA58C}.Release|Any CPU.Build.0 = Debug|Any CPU + {350D4F49-9901-4998-9903-BCA7D48DA58C}.Release|Linux_x86.ActiveCfg = Release|Any CPU + {350D4F49-9901-4998-9903-BCA7D48DA58C}.Release|Linux_x86.Build.0 = Release|Any CPU + {74289092-9F70-4941-AFCB-DFD7BE2140B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {74289092-9F70-4941-AFCB-DFD7BE2140B6}.Debug|Any CPU.Build.0 = Debug|Any CPU {74289092-9F70-4941-AFCB-DFD7BE2140B6}.Debug|Linux_x86.ActiveCfg = Debug|Any CPU {74289092-9F70-4941-AFCB-DFD7BE2140B6}.Debug|Linux_x86.Build.0 = Debug|Any CPU + {74289092-9F70-4941-AFCB-DFD7BE2140B6}.Release|Any CPU.ActiveCfg = Debug|Any CPU + {74289092-9F70-4941-AFCB-DFD7BE2140B6}.Release|Any CPU.Build.0 = Debug|Any CPU {74289092-9F70-4941-AFCB-DFD7BE2140B6}.Release|Linux_x86.ActiveCfg = Release|Any CPU {74289092-9F70-4941-AFCB-DFD7BE2140B6}.Release|Linux_x86.Build.0 = Release|Any CPU - {7BAE4448-E8F4-48B3-BB11-FA78E7F4506B}.Compatibility-GLFW2|Any CPU.ActiveCfg = Debug|Any CPU - {7BAE4448-E8F4-48B3-BB11-FA78E7F4506B}.Compatibility-GLFW2|Any CPU.Build.0 = Debug|Any CPU - {7BAE4448-E8F4-48B3-BB11-FA78E7F4506B}.Compatibility-GLFW3|Any CPU.ActiveCfg = Debug|Any CPU - {7BAE4448-E8F4-48B3-BB11-FA78E7F4506B}.Compatibility-GLFW3|Any CPU.Build.0 = Debug|Any CPU - {7BAE4448-E8F4-48B3-BB11-FA78E7F4506B}.Core-GLFW2|Any CPU.ActiveCfg = Debug|Any CPU - {7BAE4448-E8F4-48B3-BB11-FA78E7F4506B}.Core-GLFW2|Any CPU.Build.0 = Debug|Any CPU - {7BAE4448-E8F4-48B3-BB11-FA78E7F4506B}.Core-GLFW3|Any CPU.ActiveCfg = Debug|Any CPU - {7BAE4448-E8F4-48B3-BB11-FA78E7F4506B}.Debug|Linux_x86.ActiveCfg = Debug|Any CPU - {7BAE4448-E8F4-48B3-BB11-FA78E7F4506B}.Release|Linux_x86.ActiveCfg = Release|Any CPU - {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Compatibility-GLFW2|Any CPU.ActiveCfg = Debug|Any CPU - {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Compatibility-GLFW2|Any CPU.Build.0 = Debug|Any CPU - {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Compatibility-GLFW3|Any CPU.ActiveCfg = Debug|Any CPU - {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Compatibility-GLFW3|Any CPU.Build.0 = Debug|Any CPU - {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Core-GLFW2|Any CPU.ActiveCfg = Debug|Any CPU - {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Core-GLFW2|Any CPU.Build.0 = Debug|Any CPU - {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Core-GLFW3|Any CPU.ActiveCfg = Debug|Any CPU - {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Core-GLFW3|Any CPU.Build.0 = Debug|Any CPU + {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|Any CPU {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Debug|Linux_x86.Build.0 = Debug|Any CPU + {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Release|Any CPU.ActiveCfg = Debug|Any CPU + {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Release|Any CPU.Build.0 = Debug|Any CPU {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Release|Linux_x86.ActiveCfg = Release|Any CPU {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Release|Linux_x86.Build.0 = Release|Any CPU - {D6F98B08-56B8-405C-9212-F9D26097E35F}.Compatibility-GLFW2|Any CPU.ActiveCfg = Debug|Linux_x86 - {D6F98B08-56B8-405C-9212-F9D26097E35F}.Compatibility-GLFW2|Any CPU.Build.0 = Debug|Linux_x86 - {D6F98B08-56B8-405C-9212-F9D26097E35F}.Compatibility-GLFW3|Any CPU.ActiveCfg = Debug|Linux_x86 - {D6F98B08-56B8-405C-9212-F9D26097E35F}.Compatibility-GLFW3|Any CPU.Build.0 = Debug|Linux_x86 - {D6F98B08-56B8-405C-9212-F9D26097E35F}.Core-GLFW2|Any CPU.ActiveCfg = Debug|Linux_x86 - {D6F98B08-56B8-405C-9212-F9D26097E35F}.Core-GLFW2|Any CPU.Build.0 = Debug|Linux_x86 - {D6F98B08-56B8-405C-9212-F9D26097E35F}.Core-GLFW3|Any CPU.ActiveCfg = Debug|Linux_x86 - {D6F98B08-56B8-405C-9212-F9D26097E35F}.Debug|Linux_x86.ActiveCfg = Debug|Linux_x86 - {D6F98B08-56B8-405C-9212-F9D26097E35F}.Release|Linux_x86.ActiveCfg = Release|Linux_x86 - {DDB6DB6D-E5DE-4BDB-8AC8-26DF800E9FF0}.Compatibility-GLFW2|Any CPU.ActiveCfg = Core-GLFW3|Any CPU - {DDB6DB6D-E5DE-4BDB-8AC8-26DF800E9FF0}.Compatibility-GLFW2|Any CPU.Build.0 = Core-GLFW3|Any CPU - {DDB6DB6D-E5DE-4BDB-8AC8-26DF800E9FF0}.Compatibility-GLFW3|Any CPU.ActiveCfg = Compatibility-GLFW3|Any CPU - {DDB6DB6D-E5DE-4BDB-8AC8-26DF800E9FF0}.Compatibility-GLFW3|Any CPU.Build.0 = Compatibility-GLFW3|Any CPU - {DDB6DB6D-E5DE-4BDB-8AC8-26DF800E9FF0}.Core-GLFW2|Any CPU.ActiveCfg = Core-GLFW2|Any CPU - {DDB6DB6D-E5DE-4BDB-8AC8-26DF800E9FF0}.Core-GLFW2|Any CPU.Build.0 = Core-GLFW2|Any CPU - {DDB6DB6D-E5DE-4BDB-8AC8-26DF800E9FF0}.Core-GLFW3|Any CPU.ActiveCfg = Core-GLFW3|Any CPU - {DDB6DB6D-E5DE-4BDB-8AC8-26DF800E9FF0}.Core-GLFW3|Any CPU.Build.0 = Core-GLFW3|Any CPU - {DDB6DB6D-E5DE-4BDB-8AC8-26DF800E9FF0}.Debug|Linux_x86.ActiveCfg = Core-GLFW3|Any CPU - {DDB6DB6D-E5DE-4BDB-8AC8-26DF800E9FF0}.Debug|Linux_x86.Build.0 = Core-GLFW3|Any CPU - {DDB6DB6D-E5DE-4BDB-8AC8-26DF800E9FF0}.Release|Linux_x86.ActiveCfg = Core-GLFW3|Any CPU - {DDB6DB6D-E5DE-4BDB-8AC8-26DF800E9FF0}.Release|Linux_x86.Build.0 = Core-GLFW3|Any CPU - {E9E14DB5-3C67-4E01-B5C3-4D90D7E31A2E}.Compatibility-GLFW2|Any CPU.ActiveCfg = Debug|Any CPU - {E9E14DB5-3C67-4E01-B5C3-4D90D7E31A2E}.Compatibility-GLFW2|Any CPU.Build.0 = Debug|Any CPU - {E9E14DB5-3C67-4E01-B5C3-4D90D7E31A2E}.Compatibility-GLFW3|Any CPU.ActiveCfg = Debug|Any CPU - {E9E14DB5-3C67-4E01-B5C3-4D90D7E31A2E}.Compatibility-GLFW3|Any CPU.Build.0 = Debug|Any CPU - {E9E14DB5-3C67-4E01-B5C3-4D90D7E31A2E}.Core-GLFW2|Any CPU.ActiveCfg = Debug|Any CPU - {E9E14DB5-3C67-4E01-B5C3-4D90D7E31A2E}.Core-GLFW2|Any CPU.Build.0 = Debug|Any CPU - {E9E14DB5-3C67-4E01-B5C3-4D90D7E31A2E}.Core-GLFW3|Any CPU.ActiveCfg = Debug|Any CPU - {E9E14DB5-3C67-4E01-B5C3-4D90D7E31A2E}.Debug|Linux_x86.ActiveCfg = Debug|Any CPU - {E9E14DB5-3C67-4E01-B5C3-4D90D7E31A2E}.Release|Linux_x86.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(MonoDevelopProperties) = preSolution Policies = $0 diff --git a/GLCrow/GLCrow.csproj b/GLCrow/GLCrow.csproj index a5ab35ab..8c1cd3c7 100644 --- a/GLCrow/GLCrow.csproj +++ b/GLCrow/GLCrow.csproj @@ -9,7 +9,7 @@ Library GLC GLCrow - $(SolutionDir)/build/$(Configuration) + $(SolutionDir)/build/$(Configuration) $(SolutionDir)/build/obj/$(Configuration) v4.5 0.4 @@ -27,12 +27,16 @@ + $(SolutionDir)\build\obj\$(Configuration) + $(SolutionDir)\build\$(Configuration) true prompt 4 false + $(SolutionDir)\build\obj\$(Configuration) + $(SolutionDir)\build\$(Configuration) @@ -61,10 +65,6 @@ {C2980F9B-4798-4C05-99E2-E174810F7C7B} Crow - - {DDB6DB6D-E5DE-4BDB-8AC8-26DF800E9FF0} - Pencil.Gaming - diff --git a/OTKCrow/OTKCrow.csproj b/OTKCrow/OTKCrow.csproj index 65c9678e..bd5f22eb 100644 --- a/OTKCrow/OTKCrow.csproj +++ b/OTKCrow/OTKCrow.csproj @@ -2,7 +2,7 @@ Debug - Linux_x86 + AnyCPU {350D4F49-9901-4998-9903-BCA7D48DA58C} Library OTKCrow @@ -14,7 +14,7 @@ $(SolutionDir)/build/$(Configuration) $(SolutionDir)/build/obj/$(Configuration) - + true full false @@ -22,13 +22,17 @@ prompt 4 false + $(SolutionDir)\build\obj\$(Configuration) + $(SolutionDir)\build\$(Configuration) - + full true prompt 4 false + $(SolutionDir)\build\obj\$(Configuration) + $(SolutionDir)\build\$(Configuration) @@ -40,18 +44,13 @@ gtk-sharp-3.0 - ..\packages\OpenTK.1.1.2225.0\lib\net20\OpenTK.dll - - - ..\..\Chess\build\Debug\GGL.dll + ..\packages\OpenTK.1.1.2349.61993\lib\NET40\OpenTK.dll - - - + @@ -60,7 +59,9 @@ - + + + \ No newline at end of file diff --git a/OTKCrow/OpenGL/QuadVAO.cs b/OTKCrow/OpenGL/QuadVAO.cs deleted file mode 100644 index 36231cc1..00000000 --- a/OTKCrow/OpenGL/QuadVAO.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; -using OpenTK; - -namespace Crow -{ - public class QuadVAO : VertexArrayObject - { - public QuadVAO (float x, float y, float width, float height):base( - new Vector2[] { - new Vector2 (x, y), - new Vector2 (x, y + height), - new Vector2 (x + width, y), - new Vector2 (x + width, y + height) - }, - new Vector2[] { - new Vector2 (0, 1), - new Vector2 (0, 0), - new Vector2 (1, 1), - new Vector2 (1, 0) - }, - new int[] { 0, 1, 2, 3 }) - { - - } - public QuadVAO (float x, float y, float width, float height, - float texX, float texY, float texW, float texH):base( - new Vector2[] { - new Vector2 (x, y), - new Vector2 (x, y + height), - new Vector2 (x + width, y), - new Vector2 (x + width, y + height) - }, - new Vector2[] { - new Vector2 (texX, texY+texH), - new Vector2 (texX, texY), - new Vector2 (texX+texW, texY+texH), - new Vector2 (texX+texW, texY) - }, - new int[] { 0, 1, 2, 3 }) - { - - } - } -} diff --git a/OTKCrow/OpenGL/Shader.cs b/OTKCrow/OpenGL/Shader.cs index b4603ad8..54f9140a 100644 --- a/OTKCrow/OpenGL/Shader.cs +++ b/OTKCrow/OpenGL/Shader.cs @@ -4,76 +4,54 @@ using System.IO; using System.Reflection; using OpenTK; using OpenTK.Graphics.OpenGL; +using System.Collections.Generic; -namespace Crow +namespace Tetra { public class Shader : IDisposable { #region CTOR public Shader () { - Compile (); + Init (); } - public Shader (string vertResId, string fragResId) + public Shader (string vertResPath, string fragResPath = null, string geomResPath = null) { + VertSourcePath = vertResPath; + FragSourcePath = fragResPath; + GeomSourcePath = geomResPath; - Stream s = tryGetStreamForResource (vertResId); - if (s != null) { - using (StreamReader sr = new StreamReader (s)) { - vertSource = sr.ReadToEnd (); - } - } + loadSourcesFiles (); - s = tryGetStreamForResource (fragResId); - if (s != null) { - using (StreamReader sr = new StreamReader (s)) { - fragSource = sr.ReadToEnd (); - } - } - - Compile (); - } - Stream tryGetStreamForResource(string resId){ - if (string.IsNullOrEmpty (resId)) - return null; - - Stream s = Assembly.GetEntryAssembly (). - GetManifestResourceStream (resId); - return s == null ? - Assembly.GetExecutingAssembly (). - GetManifestResourceStream (resId) : - s; + Init (); } #endregion + public string VertSourcePath, + FragSourcePath, + GeomSourcePath; #region Sources protected string _vertSource = @" #version 330 + precision lowp float; - precision highp float; - - uniform mat4 Projection; - uniform mat4 ModelView; - uniform mat4 Model; - uniform mat4 Normal; + uniform mat4 mvp; - in vec2 in_position; - in vec2 in_tex; + layout(location = 0) in vec3 in_position; + layout(location = 1) in vec2 in_tex; out vec2 texCoord; - void main(void) { texCoord = in_tex; - gl_Position = Projection * ModelView * Model * vec4(in_position, 0, 1); + gl_Position = mvp * vec4(in_position, 1.0); }"; protected string _fragSource = @" #version 330 - precision highp float; + precision lowp float; - uniform vec4 color; uniform sampler2D tex; in vec2 texCoord; @@ -99,18 +77,9 @@ namespace Crow #endregion #region Private and protected fields - protected int vsId, fsId, gsId, pgmId, - modelViewLocation, - modelLocation, - projectionLocation, - normalLocation, - colorLocation; - - Matrix4 projectionMat = Matrix4.Identity, - modelMat = Matrix4.Identity, - modelViewMat = Matrix4.Identity; - Vector4 color = new Vector4(1,1,1,1); - int texture; + public int vsId, fsId, gsId, pgmId, mvpLocation; + + Matrix4 mvp = Matrix4.Identity; #endregion @@ -131,38 +100,59 @@ namespace Crow set { _geomSource = value; } } - public Matrix4 ProjectionMatrix{ - set { projectionMat = value; } - get { return projectionMat; } + public virtual Matrix4 MVP{ + set { mvp = value; } + get { return mvp; } } - public Matrix4 ModelViewMatrix { - set { modelViewMat = value; } - get { return modelViewMat; } + #endregion + + #region Public functions + /// + /// configure sources and compile + /// + public virtual void Init() + { + Compile (); } - public Matrix4 ModelMatrix { - set { modelMat = value; } - get { return modelMat; } + public void Reload(){ + loadSourcesFiles (); + Compile (); } - public Vector4 Color { - set { color = value; } - get { return color; } + public void SetSource(ShaderType shaderType, string _source){ + switch (shaderType) { + case ShaderType.FragmentShader: + fragSource = _source; + return; + case ShaderType.VertexShader: + vertSource = _source; + return; + case ShaderType.GeometryShader: + geomSource = _source; + return; + } } - - public int Texture { - get { return texture; } - set { texture = value; } + public string GetSource(ShaderType shaderType){ + switch (shaderType) { + case ShaderType.FragmentShader: + return fragSource; + case ShaderType.VertexShader: + return vertSource; + case ShaderType.GeometryShader: + return geomSource; + } + return ""; } - - #endregion - - void updateNormalMatrix() - { - Matrix4 normalMat = (modelViewMat).Inverted(); - normalMat.Transpose (); - GL.UniformMatrix4 (normalLocation, false, ref normalMat); + public string GetSourcePath(ShaderType shaderType){ + switch (shaderType) { + case ShaderType.FragmentShader: + return FragSourcePath; + case ShaderType.VertexShader: + return VertSourcePath; + case ShaderType.GeometryShader: + return GeomSourcePath; + } + return ""; } - - #region Public functions public virtual void Compile() { Dispose (); @@ -228,31 +218,16 @@ namespace Crow } protected virtual void GetUniformLocations() { - projectionLocation = GL.GetUniformLocation(pgmId, "Projection"); - modelViewLocation = GL.GetUniformLocation(pgmId, "ModelView"); - modelLocation = GL.GetUniformLocation(pgmId, "Model"); - normalLocation = GL.GetUniformLocation(pgmId, "Normal"); - colorLocation = GL.GetUniformLocation (pgmId, "color"); - + mvpLocation = GL.GetUniformLocation(pgmId, "mvp"); } protected virtual void BindSamplesSlots(){ GL.Uniform1(GL.GetUniformLocation (pgmId, "tex"), 0); } - + public void SetMVP(Matrix4 _mvp){ + GL.UniformMatrix4(mvpLocation, false, ref _mvp); + } public virtual void Enable(){ GL.UseProgram (pgmId); - - GL.UniformMatrix4(projectionLocation, false, ref projectionMat); - GL.UniformMatrix4 (modelLocation, false, ref modelMat); - GL.UniformMatrix4 (modelViewLocation, false, ref modelViewMat); - updateNormalMatrix (); - GL.Uniform4 (colorLocation, color); - - if (texture < 0) - return; - - GL.ActiveTexture (TextureUnit.Texture0); - GL.BindTexture(TextureTarget.Texture2D, texture); } public virtual void Disable(){ GL.UseProgram (0); @@ -271,6 +246,36 @@ namespace Crow } #endregion + void loadSourcesFiles(){ + Stream s; + + if (!string.IsNullOrEmpty (VertSourcePath)) { + s = Crow.Interface.GetStreamFromPath (VertSourcePath); + if (s != null) { + using (StreamReader sr = new StreamReader (s)) { + vertSource = sr.ReadToEnd (); + } + } + } + + if (!string.IsNullOrEmpty (FragSourcePath)) { + s = Crow.Interface.GetStreamFromPath (FragSourcePath); + if (s != null) { + using (StreamReader sr = new StreamReader (s)) { + fragSource = sr.ReadToEnd (); + } + } + } + + if (!string.IsNullOrEmpty (GeomSourcePath)) { + s = Crow.Interface.GetStreamFromPath (GeomSourcePath); + if (s != null) { + using (StreamReader sr = new StreamReader (s)) { + geomSource = sr.ReadToEnd (); + } + } + } + } void compileShader(int shader, string source) { GL.ShaderSource(shader, source); @@ -288,10 +293,14 @@ namespace Crow Debug.WriteLine(source); } } + public override string ToString () + { + return string.Format ("{0} {1} {2}", VertSourcePath, FragSourcePath, GeomSourcePath); + } #region IDisposable implementation public virtual void Dispose () - { + { if (GL.IsProgram (pgmId)) GL.DeleteProgram (pgmId); @@ -305,3 +314,4 @@ namespace Crow #endregion } } + diff --git a/OTKCrow/OpenGL/TexturedShader.cs b/OTKCrow/OpenGL/TexturedShader.cs deleted file mode 100644 index 9e29b690..00000000 --- a/OTKCrow/OpenGL/TexturedShader.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; -using OpenTK.Graphics.OpenGL; - -namespace Crow -{ - public class TexturedShader : Shader - { - public TexturedShader () - { - - fragSource = @" - #version 130 - precision highp float; - - uniform sampler2D tex; - - in vec2 texCoord; - out vec4 out_frag_color; - - void main(void) - { - out_frag_color = texture( tex, texCoord); - }"; - - Compile (); - - } - - protected override void BindSamplesSlots () - { - base.BindSamplesSlots (); - - GL.Uniform1(GL.GetUniformLocation (pgmId, "stencil"),1); - } - public override void Enable () - { - base.Enable (); - - } - } -} diff --git a/OTKCrow/OpenGL/VertexArrayObject.cs b/OTKCrow/OpenGL/VertexArrayObject.cs deleted file mode 100644 index c7b685d9..00000000 --- a/OTKCrow/OpenGL/VertexArrayObject.cs +++ /dev/null @@ -1,93 +0,0 @@ -using System; -using OpenTK; -using OpenTK.Graphics.OpenGL; - -namespace Crow -{ - public class VertexArrayObject : IDisposable - { - public int vaoHandle, - positionVboHandle, - texVboHandle, - eboHandle; - - Vector2[] positionVboData; - public int[] indicesVboData; - Vector2[] texVboData; - - public VertexArrayObject (Vector2[] _positions, Vector2[] _texCoord, int[] _indices) - { - positionVboData = _positions; - texVboData = _texCoord; - indicesVboData = _indices; - - CreateVBOs (); - CreateVAOs (); - } - - void deleteVAOs() - { - GL.DeleteBuffer (positionVboHandle); - GL.DeleteBuffer (texVboHandle); - GL.DeleteBuffer (eboHandle); - GL.DeleteVertexArray (vaoHandle); - } - - void CreateVBOs() - { - positionVboHandle = GL.GenBuffer(); - GL.BindBuffer(BufferTarget.ArrayBuffer, positionVboHandle); - GL.BufferData(BufferTarget.ArrayBuffer, - new IntPtr(positionVboData.Length * Vector2.SizeInBytes), - positionVboData, BufferUsageHint.StaticDraw); - - texVboHandle = GL.GenBuffer(); - GL.BindBuffer(BufferTarget.ArrayBuffer, texVboHandle); - GL.BufferData(BufferTarget.ArrayBuffer, - new IntPtr(texVboData.Length * Vector2.SizeInBytes), - texVboData, BufferUsageHint.StaticDraw); - // - eboHandle = GL.GenBuffer(); - GL.BindBuffer(BufferTarget.ElementArrayBuffer, eboHandle); - GL.BufferData(BufferTarget.ElementArrayBuffer, - new IntPtr(sizeof(uint) * indicesVboData.Length), - indicesVboData, BufferUsageHint.StaticDraw); - - GL.BindBuffer(BufferTarget.ArrayBuffer, 0); - GL.BindBuffer(BufferTarget.ElementArrayBuffer, 0); - } - - void CreateVAOs() - { - vaoHandle = GL.GenVertexArray(); - GL.BindVertexArray(vaoHandle); - - GL.EnableVertexAttribArray(0); - GL.BindBuffer(BufferTarget.ArrayBuffer, positionVboHandle); - GL.VertexAttribPointer(0, 2, VertexAttribPointerType.Float, true, Vector2.SizeInBytes, 0); - - GL.EnableVertexAttribArray(1); - GL.BindBuffer(BufferTarget.ArrayBuffer, texVboHandle); - GL.VertexAttribPointer(1, 2, VertexAttribPointerType.Float, true, Vector2.SizeInBytes, 0); - - GL.BindBuffer(BufferTarget.ElementArrayBuffer, eboHandle); - - GL.BindVertexArray(0); - } - - public void Render(PrimitiveType _primitiveType){ - GL.BindVertexArray(vaoHandle); - GL.DrawElements(_primitiveType, indicesVboData.Length, - DrawElementsType.UnsignedInt, IntPtr.Zero); - GL.BindVertexArray (0); - } - - - #region IDisposable implementation - public void Dispose () - { - deleteVAOs (); - } - #endregion - } -} diff --git a/OTKCrow/OpenGL/vaoMesh.cs b/OTKCrow/OpenGL/vaoMesh.cs new file mode 100644 index 00000000..b076362c --- /dev/null +++ b/OTKCrow/OpenGL/vaoMesh.cs @@ -0,0 +1,145 @@ +using System; +using System.Runtime.InteropServices; +using System.Collections.Generic; +using OpenTK; +using OpenTK.Graphics.OpenGL; +//using System.Drawing; +using System.Drawing.Imaging; +using System.IO; +using System.Threading; +using System.Diagnostics; +using System.Linq; + +namespace Crow +{ + public class vaoMesh : IDisposable + { + public int vaoHandle, + positionVboHandle, + texVboHandle, + eboHandle; + + public Vector3[] positions; + public Vector2[] texCoords; + public int[] indices; + + public vaoMesh() + { + } + + public vaoMesh (Vector3[] _positions, Vector2[] _texCoord, int[] _indices) + { + positions = _positions; + texCoords = _texCoord; + indices = _indices; + + CreateVBOs (); + CreateVAOs (); + } + + public vaoMesh (float x, float y, float z, float width, float height, float TileX = 1f, float TileY = 1f) + { + positions = + new Vector3[] { + new Vector3 (x - width / 2, y + height / 2, z), + new Vector3 (x - width / 2, y - height / 2, z), + new Vector3 (x + width / 2, y + height / 2, z), + new Vector3 (x + width / 2, y - height / 2, z) + }; + texCoords = new Vector2[] { + new Vector2 (0, TileY), + new Vector2 (0, 0), + new Vector2 (TileX, TileY), + new Vector2 (TileX, 0) + }; + indices = new int[] { 0, 1, 2, 3 }; + + CreateVBOs (); + CreateVAOs (); + } + public void CreateBuffers(){ + CreateVBOs (); + CreateVAOs (); + } + protected void CreateVBOs() + { + positionVboHandle = GL.GenBuffer(); + GL.BindBuffer(BufferTarget.ArrayBuffer, positionVboHandle); + GL.BufferData(BufferTarget.ArrayBuffer, + new IntPtr(positions.Length * Vector3.SizeInBytes), + positions, BufferUsageHint.StaticDraw); + + if (texCoords != null) { + texVboHandle = GL.GenBuffer (); + GL.BindBuffer (BufferTarget.ArrayBuffer, texVboHandle); + GL.BufferData (BufferTarget.ArrayBuffer, + new IntPtr (texCoords.Length * Vector2.SizeInBytes), + texCoords, BufferUsageHint.StaticDraw); + } + + GL.BindBuffer(BufferTarget.ArrayBuffer, 0); + + if (indices != null) { + eboHandle = GL.GenBuffer (); + GL.BindBuffer (BufferTarget.ElementArrayBuffer, eboHandle); + GL.BufferData (BufferTarget.ElementArrayBuffer, + new IntPtr (sizeof(uint) * indices.Length), + indices, BufferUsageHint.StaticDraw); + GL.BindBuffer(BufferTarget.ElementArrayBuffer, 0); + } + } + protected void CreateVAOs() + { + vaoHandle = GL.GenVertexArray(); + GL.BindVertexArray(vaoHandle); + + GL.EnableVertexAttribArray(0); + GL.BindBuffer(BufferTarget.ArrayBuffer, positionVboHandle); + GL.VertexAttribPointer(0, 3, VertexAttribPointerType.Float, true, Vector3.SizeInBytes, 0); + + if (texCoords != null) { + GL.EnableVertexAttribArray (1); + GL.BindBuffer (BufferTarget.ArrayBuffer, texVboHandle); + GL.VertexAttribPointer (1, 2, VertexAttribPointerType.Float, true, Vector2.SizeInBytes, 0); + } + if (indices != null) + GL.BindBuffer(BufferTarget.ElementArrayBuffer, eboHandle); + + GL.BindVertexArray(0); + } + + public void Render(BeginMode _primitiveType){ + GL.BindVertexArray(vaoHandle); + if (indices == null) + GL.DrawArrays (_primitiveType, 0, positions.Length); + else + GL.DrawElements(_primitiveType, indices.Length, + DrawElementsType.UnsignedInt, IntPtr.Zero); + GL.BindVertexArray (0); + } + public void Render(BeginMode _primitiveType, int[] _customIndices){ + GL.BindVertexArray(vaoHandle); + GL.DrawElements(_primitiveType, _customIndices.Length, + DrawElementsType.UnsignedInt, _customIndices); + GL.BindVertexArray (0); + } + public void Render(BeginMode _primitiveType, int instances){ + + GL.BindVertexArray(vaoHandle); + GL.DrawElementsInstanced(_primitiveType, indices.Length, + DrawElementsType.UnsignedInt, IntPtr.Zero, instances); + GL.BindVertexArray (0); + } + + #region IDisposable implementation + public void Dispose () + { + GL.DeleteBuffer (positionVboHandle); + GL.DeleteBuffer (texVboHandle); + GL.DeleteBuffer (eboHandle); + GL.DeleteVertexArray (vaoHandle); + } + #endregion + + } +} \ No newline at end of file diff --git a/OTKCrow/OpenTK.dll.config b/OTKCrow/OpenTK.dll.config deleted file mode 100644 index 7098d39e..00000000 --- a/OTKCrow/OpenTK.dll.config +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/OTKCrow/OpenTKGameWindow.cs b/OTKCrow/OpenTKGameWindow.cs index 60fa8b89..61683e34 100644 --- a/OTKCrow/OpenTKGameWindow.cs +++ b/OTKCrow/OpenTKGameWindow.cs @@ -141,12 +141,12 @@ namespace Crow } void CrowInterface_MouseCursorChanged (object sender, MouseCursorChangedEventArgs e) { - this.Cursor = new MouseCursor( - (int)e.NewCursor.Xhot, - (int)e.NewCursor.Yhot, - (int)e.NewCursor.Width, - (int)e.NewCursor.Height, - e.NewCursor.data); +// this.Cursor = new MouseCursor( +// (int)e.NewCursor.Xhot, +// (int)e.NewCursor.Yhot, +// (int)e.NewCursor.Width, +// (int)e.NewCursor.Height, +// e.NewCursor.data); } #region Events @@ -164,7 +164,7 @@ namespace Crow #region graphic context int texID; Tetra.Shader shader; - public static GGL.vaoMesh quad; + public static Crow.vaoMesh quad; void createContext() { @@ -187,8 +187,9 @@ namespace Crow } void OpenGLDraw() { - bool blend = GL.GetBoolean (GetPName.Blend); - bool depthTest = GL.GetBoolean (GetPName.DepthTest); + bool blend, depthTest; + GL.GetBoolean (GetPName.Blend, out blend); + GL.GetBoolean (GetPName.DepthTest, out depthTest); GL.Enable (EnableCap.Blend); GL.Disable (EnableCap.DepthTest); @@ -204,7 +205,7 @@ namespace Crow CrowInterface.IsDirty = false; } } - quad.Render (PrimitiveType.TriangleStrip); + quad.Render (BeginMode.TriangleStrip); GL.BindTexture(TextureTarget.Texture2D, 0); shader.Disable (); if (!blend) @@ -247,7 +248,7 @@ namespace Crow shader.Enable(); shader.SetMVP(OpenTK.Matrix4.CreateOrthographicOffCenter (-0.5f, 0.5f, -0.5f, 0.5f, 1, -1)); GL.UseProgram(0); - quad = new GGL.vaoMesh (0, 0, 0, 1, 1, 1, -1); + quad = new Crow.vaoMesh (0, 0, 0, 1, 1, 1, -1); } protected override void OnUpdateFrame(FrameEventArgs e) @@ -283,8 +284,8 @@ namespace Crow base.OnResize (e); CrowInterface.ProcessResize( new Rectangle( - this.ClientRectangle.X, - this.ClientRectangle.Y, + 0, + 0, this.ClientRectangle.Width, this.ClientRectangle.Height)); createContext (); diff --git a/OTKCrow/packages.config b/OTKCrow/packages.config index 6e6f39d4..25c974be 100644 --- a/OTKCrow/packages.config +++ b/OTKCrow/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/README.md b/README.md index f76082e1..c746e703 100644 --- a/README.md +++ b/README.md @@ -1,66 +1,34 @@ -CROW -===== +CROW [![NuGet Version and Downloads](https://buildstats.info/nuget/Crow.dll)](https://www.nuget.org/packages/Crow.dll/) -CROW stands for 'Collaborative Radiant Open Widgets' which is a pure c# widget toolkit with templates and bindings. -Running under Mono, With multi-platform libraries (Cairo, OpenTK) it should run on any target. -The main advantage of this toolkit is it's simplicity and it's coherence. Thanks to the job done by -OpenTK team on linux drm/kms support, Crow may run without a X server directely in console. +**CROW** is a pure **C#** widget toolkit originaly developed for easy developement with OpenTK. +Running under Mono, With multi-platform libraries it should run on any target. + +**CROW** use **Mono.Cairo** for rendering. The resulting widgets are outputed to an in memory bitmap +and a clipping system ensure only dirty region are updated. Depending on the graphical context, this bitmap +may be used as Texture, Pixbuf, etc... + +**Crow** has full transparency support, but a fast opaque rendering queue exist for heavy critical application. + +Thanks to the job done by OpenTK team on linux drm/kms support, Crow may run without a X server directely in console. -Graphic Rendering stack could easily be changed by implementing ICrowHost, and a custom (and lighter) opengl rendering replacement for cairo is on the stack. FEATURES ======== -- Use OpenTK as top container for device abstraction layer by default, (other container: GTK, GDK) -- Curent drawing routines use Mono.Cairo -- Allow easy creation of XAML like interface under linux directely in console mode, without X - It only required Mono with cairo libraries, OpenTK, Mesa, GBM and DRM libraries. -- Templated controls, with dynamic binding. +- **XML** interface definition. +- Templates and styling +- Dynamic binding system with code injection. - Inlined delegate in XML Example ------- ``` - - - - - - - - ``` Building ======== -#####Build latest OpenTK: -``` -git clone https://github.com/opentk/opentk # Download source code from git -cd opentk # Enter the source directory -msbuild /p:Configuration=Release OpenTK.sln # Build on .Net (Windows) -xbuild /p:Configuration=Release OpenTK.sln # Build on Mono (Linux / Mac OS X) -``` -#####Install Cairo and RSVG cli bindings -######On Debian: - -``` -sudo apt-get install libmono-cairo4.0-cil libglib3.0-cil librsvg2-2.18-cil -``` #####Build Crow ``` git clone https://github.com/jpbruyere/Crow.git # Download source code from git diff --git a/Styles/Slider.style b/Styles/Slider.style new file mode 100644 index 00000000..e767555c --- /dev/null +++ b/Styles/Slider.style @@ -0,0 +1,4 @@ +Background = vgradient|0:Black|0,1:Gray|0,9:Gray|1:LightGray +Foreground = Gray +Focusable = true +Fit = true diff --git a/Styles/TabItem.style b/Styles/TabItem.style new file mode 100644 index 00000000..9562848d --- /dev/null +++ b/Styles/TabItem.style @@ -0,0 +1,2 @@ +Focusable = true +CacheEnabled = false diff --git a/Tests/GOLIBTestsOTK.cs b/Tests/GOLIBTestsOTK.cs index 1383d029..316c73c2 100644 --- a/Tests/GOLIBTestsOTK.cs +++ b/Tests/GOLIBTestsOTK.cs @@ -89,16 +89,24 @@ namespace testOTK { base.OnLoad (e); //this.AddWidget(new test4()); - KeyboardKeyDown += GOLIBTests_KeyboardKeyDown1;; - - testFiles = Directory.GetFiles(@"Interfaces/Stack", "*.crow").ToArray(); - //testFiles = Directory.GetFiles(@"Interfaces/Stack", "*.crow").ToArray(); - //testFiles = Directory.GetFiles(@"Interfaces/GraphicObject", "*.crow").Concat(testFiles).ToArray(); + KeyboardKeyDown += GOLIBTests_KeyboardKeyDown1; + + //testFiles = new string [] { @"Interfaces/Divers/testBind0.crow" }; + testFiles = new string [] { @"Interfaces/Divers/testCombobox.crow" }; + testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/GraphicObject", "*.crow")).ToArray (); + //testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/basicTests", "*.crow")).ToArray (); + testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Container", "*.crow")).ToArray (); + testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Group", "*.crow")).ToArray (); + testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Stack", "*.crow")).ToArray (); + testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Splitter", "*.crow")).ToArray (); + testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Expandable", "*.crow")).ToArray (); + testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Divers", "*.crow")).ToArray (); //testFiles = Directory.GetFiles(@"Interfaces", "*.crow").Concat(testFiles).ToArray(); this.Title = testFiles [idx]; - GraphicObject obj = CrowInterface.LoadInterface(testFiles[idx]); - obj.DataSource = this; + CrowInterface.LoadInterface(testFiles[idx]).DataSource = this; + + //CrowInterface.LoadInterface ("#Tests.ui.fps.crow").DataSource = this; } void GOLIBTests_KeyboardKeyDown1 (object sender, OpenTK.Input.KeyboardKeyEventArgs e) @@ -124,23 +132,6 @@ namespace testOTK obj.DataSource = this; } -// protected override void OnUpdateFrame (FrameEventArgs e) -// { -// //if (frameCpt % 8 == 0) -// base.OnUpdateFrame (e); -// -// fps = (int)RenderFrequency; -// -// -// if (frameCpt > 50) { -// resetFps (); -// frameCpt = 0; -// GC.Collect(); -// GC.WaitForPendingFinalizers(); -// NotifyValueChanged("memory", GC.GetTotalMemory (false).ToString()); -// } -// frameCpt++; -// } void onButClick(object send, MouseButtonEventArgs e) { Console.WriteLine ("button clicked:" + send.ToString()); @@ -161,16 +152,16 @@ namespace testOTK //win.KeyPressEvent += win.Win_KeyPressEvent; } - void Win_KeyPressEvent (object o, Gtk.KeyPressEventArgs args) - { - CrowInterface.ClearInterface (); - idx++; - if (idx == testFiles.Length) - idx = 0; - this.Title = testFiles [idx]; - GraphicObject obj = CrowInterface.LoadInterface(testFiles[2]); - obj.DataSource = this; - } +// void Win_KeyPressEvent (object o, Gtk.KeyPressEventArgs args) +// { +// CrowInterface.ClearInterface (); +// idx++; +// if (idx == testFiles.Length) +// idx = 0; +// this.Title = testFiles [idx]; +// GraphicObject obj = CrowInterface.LoadInterface(testFiles[2]); +// obj.DataSource = this; +// } diff --git a/Tests/OTKCrow.cs b/Tests/OTKCrow.cs new file mode 100644 index 00000000..1dee2f0e --- /dev/null +++ b/Tests/OTKCrow.cs @@ -0,0 +1,45 @@ +#define MONO_CAIRO_DEBUG_DISPOSE + + +using System; +using System.Runtime.InteropServices; +using OpenTK; +using OpenTK.Graphics.OpenGL; + +using System.Diagnostics; + +//using GGL; +using Crow; +using System.Threading; +using System.Collections.Generic; +using System.Linq; +using System.IO; + + +namespace testCrowOTK +{ + class CrowTest : OpenTKGameWindow + { + public CrowTest () + : base(800, 600,"Crow Test with OpenTK") + { + VSync = VSyncMode.Off; + Interface.CurrentInterface = CrowInterface; + } + + + protected override void OnLoad (EventArgs e) + { + base.OnLoad (e); + + CrowInterface.LoadInterface ("#Tests.ui.test.crow").DataSource = this; + } + + [STAThread] + static void Main () + { + CrowTest win = new CrowTest (); + win.Run (30); + } + } +} \ No newline at end of file diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj index eba8a6ee..29862e56 100644 --- a/Tests/Tests.csproj +++ b/Tests/Tests.csproj @@ -8,7 +8,7 @@ Exe Tests Tests - Tests.GLCrow + testCrowOTK.CrowTest v4.5 $(SolutionDir)/build/$(Configuration) $(SolutionDir)/build/obj/$(Configuration) @@ -23,12 +23,16 @@ 4 false DEBUG;TRACE;MEASURE_TIME + ..\build\obj\Debug + ..\build\Debug none true 0 false + ..\build\obj\Release + ..\build\Release @@ -36,249 +40,178 @@ - - gtk-sharp-3.0 - - - gio-sharp-3.0 - - - glib-sharp-3.0 - - - gtk-sharp-3.0 - - - gtk-sharp-3.0 + + ..\packages\OpenTK.1.1.2349.61993\lib\NET40\OpenTK.dll - - - - - - + + + PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - - - - + PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - Tests.Interfaces.test7.goml @@ -286,158 +219,119 @@ PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - PreserveNewest - - - - - - - + + + + @@ -459,21 +353,20 @@ PreserveNewest - + + + + {C2980F9B-4798-4C05-99E2-E174810F7C7B} Crow - - {66376B95-9351-4A63-B920-F4BB53FEF0E2} - GLCrow - - - {DDB6DB6D-E5DE-4BDB-8AC8-26DF800E9FF0} - Pencil.Gaming + + {350D4F49-9901-4998-9903-BCA7D48DA58C} + OTKCrow diff --git a/Tests/main.cs b/Tests/main.cs new file mode 100644 index 00000000..5ec562e8 --- /dev/null +++ b/Tests/main.cs @@ -0,0 +1,467 @@ +#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 Crow; +using System.Threading; +using GGL; +using System.Collections.Generic; +using System.IO; + + +namespace Opuz2015 +{ + public enum GameState { Init, CutStart, CutFinished, Play, Finished}; + + class MainWin : OpenTKGameWindow, IBindable + { + #region IBindable implementation + List bindings = new List (); + public List Bindings { + get { return bindings; } + } + #endregion + + #region scene matrix and vectors + public static Matrix4 modelview; + public static Matrix4 projection; + public static int[] viewport = new int[4]; + + public float EyeDist { + get { return eyeDist; } + set { + eyeDist = value; + UpdateViewMatrix (); + } + } + public Vector3 vEyeTarget = new Vector3(0, 0, 0f); + public Vector3 vEye; + public Vector3 vLookInit = Vector3.Normalize(new Vector3(0.0f, -0.7f, 0.7f)); + public Vector3 vLook = Vector3.Normalize(new Vector3(0.0f, -0.1f, 0.9f)); // Camera vLook Vector + public float zFar = 6000.0f; + public float zNear = 1.0f; + public float fovY = (float)Math.PI / 4; + + float eyeDist = 1000f; + float eyeDistTarget = 1000f; + float MoveSpeed = 100.0f; + float RotationSpeed = 0.02f; + float ZoomSpeed = 2f; + float viewZangle, viewXangle; + + public Vector4 vLight = new Vector4 (0.5f, 0.5f, -1f, 0f); + #endregion + + #region GL + public static PuzzleShader mainShader; + static RenderCache mainCache; + public static bool RebuildCache = false; + + //public static GameLib.EffectShader selMeshShader; + + + void initOpenGL() + { + GL.ClearColor(0.0f, 0.0f, 0.2f, 1.0f); + GL.DepthFunc(DepthFunction.Lequal); + GL.Enable(EnableCap.CullFace); + GL.CullFace (CullFaceMode.Back); + + GL.PrimitiveRestartIndex (uint.MaxValue); + GL.Enable (EnableCap.PrimitiveRestart); + GL.Enable (EnableCap.Blend); + GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); + + GL.Enable (EnableCap.SampleShading); + GL.MinSampleShading (0.5f); + + mainShader = new PuzzleShader(); + + //selMeshShader = new GameLib.EffectShader ("Opuz2015.shaders.Border"); + + + mainCache = new RenderCache (ClientSize); + + ErrorCode err = GL.GetError (); + Debug.Assert (err == ErrorCode.NoError, "OpenGL Error"); + + } + #endregion + + #region Interface + GraphicObject mainMenu = null; + GraphicObject finishedMessage = null; + GraphicObject imgSelection = null; + + void initInterface(){ + //special event handlers fired only if mouse not in interface objects + //for scene mouse handling + MouseMove += Mouse_Move; + MouseButtonDown += Mouse_ButtonDown; + MouseButtonUp += Mouse_ButtonUp; + MouseWheelChanged += Mouse_WheelChanged; + //KeyboardKeyDown += MainWin_KeyboardKeyDown; + + CrowInterface.LoadInterface("#Opuz2015.ui.fps.crow").DataSource = this; + mainMenu = CrowInterface.LoadInterface("#Opuz2015.ui.MainMenu.goml"); + mainMenu.DataSource = this; + mainMenu.Visible = false; + + Crow.CompilerServices.ResolveBindings (this.Bindings); + mainMenu.Visible = true; + } + void showFinishedMsg(){ + if (finishedMessage != null) + return; + finishedMessage = CrowInterface.LoadInterface("#Opuz2015.ui.Finished.goml"); + finishedMessage.DataSource = this; + } + void onImageClick (object sender, Crow.MouseButtonEventArgs e){ + if (imgSelection == null) { + imgSelection = CrowInterface.LoadInterface ("#Opuz2015.ui.ImageSelect.goml"); + imgSelection.DataSource = this; + } + imgSelection.Visible = true; + mainMenu.Visible = false; + } + void onSelectedImageChanged(object sender, SelectionChangeEventArgs e){ + mainMenu.Visible = true; + imgSelection.Visible = false; + ImagePath = e.NewValue.ToString(); + } + void onCutPuzzle (object sender, Crow.MouseButtonEventArgs e) + { + mainMenu.Visible = false; + currentState = GameState.CutStart; + } + void onButQuitClick (object sender, Crow.MouseButtonEventArgs e){ + closeGame (); + + } + void onBackToMainMenu (object sender, Crow.MouseButtonEventArgs e) + { + closeCurrentPuzzle (); + } + #endregion + + GameState currentState = GameState.Init; + Puzzle puzzle; + + int nbPceX = 5; + int nbPceY = 3; + string imagePath = @"Images/0.jpg"; + const float zSelPce = 8.0f; + + bool puzzleIsReady { get { return puzzle == null ? false : puzzle.Ready; } } + + public string[] Images + { + get { + return Directory.GetFiles( + System.IO.Path.GetDirectoryName( + System.Reflection.Assembly.GetExecutingAssembly().Location ) + "/Images"); + } + } + public int NbPceX { + get { + return nbPceX; + } + set { + if (value == nbPceX) + return; + nbPceX = value; + NotifyValueChanged ("NbPceX", nbPceX); + } + } + public int NbPceY { + get { return nbPceY; } + set { + if (value == nbPceY) + return; + nbPceY = value; + NotifyValueChanged ("NbPceY", nbPceY); + } + } + public string ImagePath { + get { return imagePath; } + set { + imagePath = value; + NotifyValueChanged ("ImagePath", imagePath); + } + } + + void updateCache(){ + if (puzzle == null) + return; + if (!puzzle.Ready) + return; + + mainCache.Bind (true); + mainShader.Enable (); + mainShader.Color = new Vector4 (1, 1, 1, 1); + mainShader.ColorMultiplier = 1f; + mainShader.Model = Matrix4.Identity; + + puzzle.Render (); + + GL.BindFramebuffer (FramebufferTarget.Framebuffer, 0); + RebuildCache = false; + } + + void closeGame(){ + if (puzzle != null) + puzzle.Dispose(); + this.Quit (null,null); + } + void closeCurrentPuzzle(){ + currentState = GameState.Init; + + if (finishedMessage != null) { + CrowInterface.DeleteWidget (finishedMessage); + finishedMessage = null; + } + mainMenu.Visible = true; + if (puzzle != null) + puzzle.Dispose(); + puzzle = null; + } + + #region OTK window overrides + protected override void OnLoad (EventArgs e) + { + base.OnLoad (e); + + initInterface (); + + initOpenGL (); + } + public override void GLClear () + { + GL.ClearColor(0.2f, 0.2f, 0.4f, 0.0f); + GL.Clear (ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); + } + public override void OnRender (FrameEventArgs e) + { + if (currentState < GameState.Play) + return; + RenderCache.EnableCacheShader (); + + mainCache.PaintCache (); + + mainShader.Enable (); + puzzle.Render (puzzle.Selection.ToArray ()); + } + protected override void OnResize (EventArgs e) + { + base.OnResize (e); + mainCache.CacheSize = ClientSize; + UpdateViewMatrix(); + } + protected override void OnUpdateFrame (FrameEventArgs e) + { + base.OnUpdateFrame (e); + + switch (currentState) { + case GameState.Init: + return; + case GameState.CutStart: + if (puzzle != null) + puzzle.Dispose (); + puzzle = new Puzzle (NbPceX, NbPceY, ImagePath); + mainShader.Enable (); + mainShader.ImgSize = new Vector2 (puzzle.Image.Width, puzzle.Image.Height); + puzzle.Shuffle (); + eyeDistTarget = puzzle.Image.Width * 1.5f; + EyeDist = eyeDistTarget; + currentState = GameState.Play; + RebuildCache = true; + return; + case GameState.CutFinished: + return; + } + + GGL.Animation.ProcessAnimations (); + + if (RebuildCache) + updateCache (); + + } + #endregion + + #region vLookCalculations + public void UpdateViewMatrix() + { + Rectangle r = this.ClientRectangle; + GL.Viewport( r.X, r.Y, r.Width, r.Height); + projection = Matrix4.CreatePerspectiveFieldOfView (fovY, r.Width / (float)r.Height, zNear, zFar); + vLook = Vector3.Transform (vLookInit, + Matrix4.CreateRotationX (viewXangle)* + Matrix4.CreateRotationZ (viewZangle)); + vLook.Normalize(); + vEye = vEyeTarget + vLook * eyeDist; + modelview = Matrix4.LookAt(vEye, vEyeTarget, Vector3.UnitZ); + GL.GetInteger(GetPName.Viewport, viewport); + + mainShader.Enable (); + mainShader.SetMVP(modelview * projection); + RebuildCache = true; + } + #endregion + + #region Keyboard + protected override void OnKeyDown (OpenTK.Input.KeyboardKeyEventArgs e) + { + base.OnKeyDown (e); + switch (e.Key) { + case OpenTK.Input.Key.Space: + if (puzzle != null) + puzzle.resolve (); + break; + case OpenTK.Input.Key.Escape: + if (puzzleIsReady) + closeCurrentPuzzle (); + else + closeGame (); + break; + } + } + #endregion + + #region Mouse + void Mouse_ButtonDown (object sender, OpenTK.Input.MouseButtonEventArgs e) + { + if (!puzzleIsReady) + return; + + if (e.Button == OpenTK.Input.MouseButton.Left) { + Piece[] tmp = null; + + lock (puzzle.Mutex) + tmp = puzzle.ZOrderedPieces.ToArray(); + + for (int i = tmp.Length-1; i >= 0; i--) { + Piece p = tmp [i]; + if (p.MouseIsIn (vMousePos)) { + //this.CursorVisible = false; + puzzle.SelectedPiece = p; + p.ResetVisitedStatus (); + p.PutOnTop (); + p.ResetVisitedStatus (); + p.Move (0f, 0f, zSelPce); + break; + } + } + } else if (e.Button == OpenTK.Input.MouseButton.Right) { + if (puzzle.SelectedPiece == null) + return; + puzzle.SelectedPiece.ResetVisitedStatus (); + puzzle.SelectedPiece.Rotate (puzzle.SelectedPiece); + } + + } + void Mouse_ButtonUp (object sender, OpenTK.Input.MouseButtonEventArgs e) + { + if (!puzzleIsReady) + return; + if (puzzle.SelectedPiece == null || e.Button != OpenTK.Input.MouseButton.Left) + return; + + puzzle.SelectedPiece.ResetVisitedStatus (); + puzzle.SelectedPiece.Move (0f, 0f, -zSelPce); + puzzle.SelectedPiece.ResetVisitedStatus (); + puzzle.SelectedPiece.Test (); + puzzle.SelectedPiece.ResetVisitedStatus (); + if (puzzle.SelectedPiece.PuzzleIsFinished) { + showFinishedMsg (); + } + //ensure newly linked pce are on top of others + puzzle.SelectedPiece.ResetVisitedStatus (); + puzzle.SelectedPiece.PutOnTop (); + puzzle.SelectedPiece = null; + } + Vector3 vMousePos; + void Mouse_Move(object sender, OpenTK.Input.MouseMoveEventArgs e) + { + if (!puzzleIsReady) + return; + if (e.XDelta != 0 || e.YDelta != 0) + { + Vector3 vMouse = glHelper.UnProject(ref projection, ref modelview, viewport, new Vector2 (e.X, e.Y)).Xyz; + Vector3 vMouseRay = Vector3.Normalize(vMouse - vEye); + float a = -vMouse.Z / vMouseRay.Z; + Vector3 vNewMousePos = vMouse + vMouseRay * a; + Vector3 vMouseDelta = vNewMousePos - vMousePos; + vMousePos = vNewMousePos; + + if (e.Mouse.MiddleButton == OpenTK.Input.ButtonState.Pressed) { + //viewZangle -= (float)e.XDelta * RotationSpeed; + viewXangle -= (float)e.YDelta * RotationSpeed; + if (viewXangle < - 0.75f) + viewXangle = -0.75f; + else if (viewXangle > MathHelper.PiOver4) + viewXangle = MathHelper.PiOver4; + UpdateViewMatrix (); + return; + } + if (e.Mouse.LeftButton == OpenTK.Input.ButtonState.Pressed) { + if (puzzle.SelectedPiece != null) { + Piece p = puzzle.SelectedPiece; + p.ResetVisitedStatus (); + p.Move (vMouseDelta.X, vMouseDelta.Y); + return; + } + } + if (e.Mouse.RightButton == OpenTK.Input.ButtonState.Pressed) { + Matrix4 m = Matrix4.CreateTranslation (-e.XDelta, e.YDelta, 0); + vEyeTarget = Vector3.Transform (vEyeTarget, m); + UpdateViewMatrix(); + return; + } + } + + } + void Mouse_WheelChanged(object sender, OpenTK.Input.MouseWheelEventArgs e) + { + if (!puzzleIsReady) + return; + float speed = MoveSpeed; + if (Keyboard[OpenTK.Input.Key.ShiftLeft]) + speed *= 0.1f; + else if (Keyboard[OpenTK.Input.Key.ControlLeft]) + speed *= 20.0f; + + eyeDistTarget -= e.Delta * speed; + if (eyeDistTarget < zNear+10) + eyeDistTarget = zNear+10; + else if (eyeDistTarget > zFar-100) + eyeDistTarget = zFar-100; + Animation.StartAnimation(new Animation (this, "EyeDist", eyeDistTarget, (eyeDistTarget - eyeDist) * 0.2f)); + } + #endregion + + #region CTOR and Main + public MainWin (int numSamples = 4) + : base(1024, 800, 32, 24, 0, numSamples, "Opuz") + { + } + + [STAThread] + static void Main () + { + Console.WriteLine ("starting example"); + + using (MainWin win = new MainWin( )) { + win.Run (30.0); + } + } + #endregion + } +} \ No newline at end of file diff --git a/Tests/packages.config b/Tests/packages.config new file mode 100644 index 00000000..25c974be --- /dev/null +++ b/Tests/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Tests/ui/LabelButton.style b/Tests/ui/LabelButton.style new file mode 100644 index 00000000..d376121f --- /dev/null +++ b/Tests/ui/LabelButton.style @@ -0,0 +1,8 @@ +MouseEnter = {Background = Gray;Foreground = White} +Fit = true +MouseLeave = {Background=Transparent;Foreground=Gray} +MouseDown = {Background=Red;Foreground=White} +MouseUp = {Background=Gray;Foreground=White} +Foreground=Gray +Margin=5 +CornerRadius=5 diff --git a/Tests/ui/MenuItem.style b/Tests/ui/MenuItem.style new file mode 100644 index 00000000..8011ebcc --- /dev/null +++ b/Tests/ui/MenuItem.style @@ -0,0 +1,11 @@ +Height = Fit +Width = Stretched +MinimumSize=60;10 +Margin=2 +CornerRadius=0 +TextAlignment=Left +Foreground=Gray +MouseEnter = {Background=SeaGreen;Foreground=White} +MouseLeave = {Background=Transparent;Foreground=Gray} +MouseDown = {Background=White;Foreground=DimGray} +MouseUp = {Background=SeaGreen;Foreground=White} diff --git a/Tests/ui/Popper.template b/Tests/ui/Popper.template new file mode 100755 index 00000000..ffcd8d45 --- /dev/null +++ b/Tests/ui/Popper.template @@ -0,0 +1,3 @@ + +