diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2016-07-19 03:35:12 +0200 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2016-07-19 03:35:12 +0200 |
| commit | b24beece9ed58b2700dd5d2d56fa45e446567ab0 (patch) | |
| tree | 8930bbda0c8b8a216718fe986eb3ef5c9635ef75 | |
| parent | 762161320ddf4bcad8b201cc9170f617f4ec2bed (diff) | |
lots of unordered changes, I commited all in a devel branch, which will be the programming branch
34 files changed, 1152 insertions, 1066 deletions
diff --git a/Crow.csproj b/Crow.csproj index eaae1e2e..d9d49339 100644 --- a/Crow.csproj +++ b/Crow.csproj @@ -32,289 +32,109 @@ <CheckForOverflowUnderflow>true</CheckForOverflowUnderflow> <DefineConstants>DEBUG_FOCUS0;DEBUG_LAYOUTING0;TRACE;DEBUG;__linux__;MEASURE_TIME;DEBUG_LOAD0;DEBUG_BINDING0;DEBUG_CLIP_RECTANGLE0</DefineConstants> <Optimize>false</Optimize> + <IntermediateOutputPath>build\obj\Debug</IntermediateOutputPath> + <OutputPath>build\Debug</OutputPath> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <Optimize>True</Optimize> <DebugType>None</DebugType> <DefineConstants>__linux__;MEASURE_TIME</DefineConstants> + <IntermediateOutputPath>build\obj\Release</IntermediateOutputPath> + <OutputPath>build\Release</OutputPath> </PropertyGroup> <ItemGroup> - <Compile Include="src\Colors.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\Point.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\Rectangle.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\Rectangles.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\Size.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\GraphicObjects\GraphicObject.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\GraphicObjects\Container.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\GraphicObjects\Group.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\GraphicObjects\HorizontalStack.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\GraphicObjects\Image.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\GraphicObjects\Label.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\GraphicObjects\TextBox.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\GraphicObjects\ProgressBar.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\GraphicObjects\VerticalStack.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\Cairo\CairoHelpers.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\win32\Win32.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\win32\winApi.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\GraphicObjects\Button.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\GraphicObjects\GraduatedSlider.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\GraphicObjects\Slider.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\GraphicObjects\NumericControl.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\GraphicObjects\Scroller.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\GraphicObjects\ILayoutable.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\Enums.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\GraphicObjects\GenericStack.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\CompilerServices\CompilerServices.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\GraphicObjects\AnalogMeter.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\GraphicObjects\Border.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\Font.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\GraphicObjects\Window.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\GraphicObjects\ListBox.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\ExtensionsMethods.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\Interface.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\LayoutingQueueItem.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\GraphicObjects\Spinner.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\DynAttribute.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\GraphicObjects\IValueChange.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\Picture.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\SvgPicture.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\BmpPicture.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\GraphicObjects\TemplatedControl.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\GraphicObjects\RadioButton.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\GraphicObjects\Expandable.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\GraphicObjects\PrivateContainer.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\GraphicObjects\TemplatedContainer.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\GraphicObjects\Popper.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\TextChangeEventArgs.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\ReflexionExtensions.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\XCursor.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\GraphicObjects\Grid.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\GraphicObjects\TextRun.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\GraphicObjects\MessageBox.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\SelectionChangeEventArgs.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\ValueChangeEventArgs.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\GraphicObjects\FileDialog.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\GraphicObjects\CheckBox.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\GraphicObjects\ComboBox.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\GraphicObjects\GroupBox.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\GraphicObjects\ScrollBar.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\BubblingMouseButtonEventArgs.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\SolidColor.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\Gradient.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\Fill\Fill.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\LayoutingEventArgs.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\ScrollingEventArgs.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\GraphicObjects\Trend.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\GraphicObjects\Splitter.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\GraphicObjects\TreeView.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\GraphicObjects\TabView.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\GraphicObjects\TabItem.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\GraphicObjects\DummyTemplate.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\Input\KeyboardKeyEventArgs.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\Input\Buttons.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\Input\ButtonState.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\Input\Key.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\Input\KeyboardState.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\Input\KeyModifiers.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\Input\MouseButton.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\Input\MouseEventArgs.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\Input\MouseScroll.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\Input\MouseState.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\rsvg\DimensionData.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\rsvg\Global.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\rsvg\Handle.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\rsvg\Pixbuf.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\rsvg\RsvgSharp.SizeFuncNative.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\rsvg\SizeFunc.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\MouseCursorChangedEventArgs.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\GraphicObjects\IBindable.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\Input\KeyPressEventArgs.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\Configuration.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="src\Measure.cs"> - <LogicalName></LogicalName> - </Compile> + <Compile Include="src\Colors.cs" /> + <Compile Include="src\Point.cs" /> + <Compile Include="src\Rectangle.cs" /> + <Compile Include="src\Rectangles.cs" /> + <Compile Include="src\Size.cs" /> + <Compile Include="src\GraphicObjects\GraphicObject.cs" /> + <Compile Include="src\GraphicObjects\Container.cs" /> + <Compile Include="src\GraphicObjects\Group.cs" /> + <Compile Include="src\GraphicObjects\HorizontalStack.cs" /> + <Compile Include="src\GraphicObjects\Image.cs" /> + <Compile Include="src\GraphicObjects\Label.cs" /> + <Compile Include="src\GraphicObjects\TextBox.cs" /> + <Compile Include="src\GraphicObjects\ProgressBar.cs" /> + <Compile Include="src\GraphicObjects\VerticalStack.cs" /> + <Compile Include="src\Cairo\CairoHelpers.cs" /> + <Compile Include="src\win32\Win32.cs" /> + <Compile Include="src\win32\winApi.cs" /> + <Compile Include="src\GraphicObjects\Button.cs" /> + <Compile Include="src\GraphicObjects\GraduatedSlider.cs" /> + <Compile Include="src\GraphicObjects\Slider.cs" /> + <Compile Include="src\GraphicObjects\NumericControl.cs" /> + <Compile Include="src\GraphicObjects\Scroller.cs" /> + <Compile Include="src\GraphicObjects\ILayoutable.cs" /> + <Compile Include="src\Enums.cs" /> + <Compile Include="src\GraphicObjects\GenericStack.cs" /> + <Compile Include="src\CompilerServices\CompilerServices.cs" /> + <Compile Include="src\GraphicObjects\AnalogMeter.cs" /> + <Compile Include="src\GraphicObjects\Border.cs" /> + <Compile Include="src\Font.cs" /> + <Compile Include="src\GraphicObjects\Window.cs" /> + <Compile Include="src\GraphicObjects\ListBox.cs" /> + <Compile Include="src\ExtensionsMethods.cs" /> + <Compile Include="src\Interface.cs" /> + <Compile Include="src\LayoutingQueueItem.cs" /> + <Compile Include="src\GraphicObjects\Spinner.cs" /> + <Compile Include="src\DynAttribute.cs" /> + <Compile Include="src\GraphicObjects\IValueChange.cs" /> + <Compile Include="src\Picture.cs" /> + <Compile Include="src\SvgPicture.cs" /> + <Compile Include="src\BmpPicture.cs" /> + <Compile Include="src\GraphicObjects\TemplatedControl.cs" /> + <Compile Include="src\GraphicObjects\RadioButton.cs" /> + <Compile Include="src\GraphicObjects\Expandable.cs" /> + <Compile Include="src\GraphicObjects\PrivateContainer.cs" /> + <Compile Include="src\GraphicObjects\TemplatedContainer.cs" /> + <Compile Include="src\GraphicObjects\Popper.cs" /> + <Compile Include="src\TextChangeEventArgs.cs" /> + <Compile Include="src\ReflexionExtensions.cs" /> + <Compile Include="src\XCursor.cs" /> + <Compile Include="src\GraphicObjects\Grid.cs" /> + <Compile Include="src\GraphicObjects\TextRun.cs" /> + <Compile Include="src\GraphicObjects\MessageBox.cs" /> + <Compile Include="src\SelectionChangeEventArgs.cs" /> + <Compile Include="src\ValueChangeEventArgs.cs" /> + <Compile Include="src\GraphicObjects\FileDialog.cs" /> + <Compile Include="src\GraphicObjects\CheckBox.cs" /> + <Compile Include="src\GraphicObjects\ComboBox.cs" /> + <Compile Include="src\GraphicObjects\GroupBox.cs" /> + <Compile Include="src\GraphicObjects\ScrollBar.cs" /> + <Compile Include="src\BubblingMouseButtonEventArgs.cs" /> + <Compile Include="src\SolidColor.cs" /> + <Compile Include="src\Gradient.cs" /> + <Compile Include="src\Fill\Fill.cs" /> + <Compile Include="src\LayoutingEventArgs.cs" /> + <Compile Include="src\ScrollingEventArgs.cs" /> + <Compile Include="src\GraphicObjects\Trend.cs" /> + <Compile Include="src\GraphicObjects\Splitter.cs" /> + <Compile Include="src\GraphicObjects\TreeView.cs" /> + <Compile Include="src\GraphicObjects\TabView.cs" /> + <Compile Include="src\GraphicObjects\TabItem.cs" /> + <Compile Include="src\GraphicObjects\DummyTemplate.cs" /> + <Compile Include="src\Input\KeyboardKeyEventArgs.cs" /> + <Compile Include="src\Input\Buttons.cs" /> + <Compile Include="src\Input\ButtonState.cs" /> + <Compile Include="src\Input\Key.cs" /> + <Compile Include="src\Input\KeyboardState.cs" /> + <Compile Include="src\Input\KeyModifiers.cs" /> + <Compile Include="src\Input\MouseButton.cs" /> + <Compile Include="src\Input\MouseEventArgs.cs" /> + <Compile Include="src\Input\MouseScroll.cs" /> + <Compile Include="src\Input\MouseState.cs" /> + <Compile Include="src\rsvg\DimensionData.cs" /> + <Compile Include="src\rsvg\Global.cs" /> + <Compile Include="src\rsvg\Handle.cs" /> + <Compile Include="src\rsvg\Pixbuf.cs" /> + <Compile Include="src\rsvg\RsvgSharp.SizeFuncNative.cs" /> + <Compile Include="src\rsvg\SizeFunc.cs" /> + <Compile Include="src\MouseCursorChangedEventArgs.cs" /> + <Compile Include="src\GraphicObjects\IBindable.cs" /> + <Compile Include="src\Input\KeyPressEventArgs.cs" /> + <Compile Include="src\Configuration.cs" /> + <Compile Include="src\Measure.cs" /> <Compile Include="src\CompilerServices\MemberReference.cs" /> <Compile Include="src\CompilerServices\Bindings.cs" /> </ItemGroup> @@ -435,13 +255,11 @@ <EmbeddedResource Include="Styles\Window.style" /> <EmbeddedResource Include="Styles\TextBox.style" /> <EmbeddedResource Include="Styles\TextRun.style" /> + <EmbeddedResource Include="Styles\TabItem.style" /> + <EmbeddedResource Include="Styles\Slider.style" /> </ItemGroup> <ItemGroup> - <None Include="README.md"> - <LogicalName></LogicalName> - </None> - <None Include="packages.config"> - <LogicalName></LogicalName> - </None> + <None Include="README.md" /> + <None Include="packages.config" /> </ItemGroup> </Project> @@ -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 @@ <OutputType>Library</OutputType> <RootNamespace>GLC</RootNamespace> <AssemblyName>GLCrow</AssemblyName> - <OutputPath>$(SolutionDir)/build/$(Configuration)</OutputPath> + <OutputPath>$(SolutionDir)/build/$(Configuration)</OutputPath> <IntermediateOutputPath>$(SolutionDir)/build/obj/$(Configuration)</IntermediateOutputPath> <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> <ReleaseVersion>0.4</ReleaseVersion> @@ -27,12 +27,16 @@ <Variable name="vblank_mode" value="1" /> </EnvironmentVariables> </EnvironmentVariables> + <IntermediateOutputPath>$(SolutionDir)\build\obj\$(Configuration)</IntermediateOutputPath> + <OutputPath>$(SolutionDir)\build\$(Configuration)</OutputPath> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|Linux_x86' "> <Optimize>true</Optimize> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <ConsolePause>false</ConsolePause> + <IntermediateOutputPath>$(SolutionDir)\build\obj\$(Configuration)</IntermediateOutputPath> + <OutputPath>$(SolutionDir)\build\$(Configuration)</OutputPath> </PropertyGroup> <ItemGroup> <Reference Include="cairo-sharp"> @@ -61,10 +65,6 @@ <Project>{C2980F9B-4798-4C05-99E2-E174810F7C7B}</Project> <Name>Crow</Name> </ProjectReference> - <ProjectReference Include="..\..\..\src\Pencil.Gaming\Pencil.Gaming\Pencil.Gaming.csproj"> - <Project>{DDB6DB6D-E5DE-4BDB-8AC8-26DF800E9FF0}</Project> - <Name>Pencil.Gaming</Name> - </ProjectReference> </ItemGroup> <ItemGroup> <Compile Include="Window.cs" /> 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 @@ <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">Linux_x86</Platform> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProjectGuid>{350D4F49-9901-4998-9903-BCA7D48DA58C}</ProjectGuid> <OutputType>Library</OutputType> <RootNamespace>OTKCrow</RootNamespace> @@ -14,7 +14,7 @@ <OutputPath>$(SolutionDir)/build/$(Configuration)</OutputPath> <IntermediateOutputPath>$(SolutionDir)/build/obj/$(Configuration)</IntermediateOutputPath> </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|Linux_x86' "> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> @@ -22,13 +22,17 @@ <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <ConsolePause>false</ConsolePause> + <IntermediateOutputPath>$(SolutionDir)\build\obj\$(Configuration)</IntermediateOutputPath> + <OutputPath>$(SolutionDir)\build\$(Configuration)</OutputPath> </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|Linux_x86' "> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>full</DebugType> <Optimize>true</Optimize> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <ConsolePause>false</ConsolePause> + <IntermediateOutputPath>$(SolutionDir)\build\obj\$(Configuration)</IntermediateOutputPath> + <OutputPath>$(SolutionDir)\build\$(Configuration)</OutputPath> </PropertyGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <ItemGroup> @@ -40,18 +44,13 @@ <Package>gtk-sharp-3.0</Package> </Reference> <Reference Include="OpenTK"> - <HintPath>..\packages\OpenTK.1.1.2225.0\lib\net20\OpenTK.dll</HintPath> - </Reference> - <Reference Include="GGL"> - <HintPath>..\..\Chess\build\Debug\GGL.dll</HintPath> + <HintPath>..\packages\OpenTK.1.1.2349.61993\lib\NET40\OpenTK.dll</HintPath> </Reference> </ItemGroup> <ItemGroup> <Compile Include="OpenTKGameWindow.cs" /> - <Compile Include="OpenGL\QuadVAO.cs" /> <Compile Include="OpenGL\Shader.cs" /> - <Compile Include="OpenGL\TexturedShader.cs" /> - <Compile Include="OpenGL\VertexArrayObject.cs" /> + <Compile Include="OpenGL\vaoMesh.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\Crow.csproj"> @@ -60,7 +59,9 @@ </ProjectReference> </ItemGroup> <ItemGroup> - <None Include="OpenTK.dll.config" /> + <Folder Include="OpenGL\" /> + </ItemGroup> + <ItemGroup> <None Include="packages.config" /> </ItemGroup> </Project>
\ 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; + public int vsId, fsId, gsId, pgmId, mvpLocation; - Matrix4 projectionMat = Matrix4.Identity, - modelMat = Matrix4.Identity, - modelViewMat = Matrix4.Identity; - Vector4 color = new Vector4(1,1,1,1); - int texture; + 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 + /// <summary> + /// configure sources and compile + /// </summary> + 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<Vector2>(BufferTarget.ArrayBuffer, - new IntPtr(positionVboData.Length * Vector2.SizeInBytes), - positionVboData, BufferUsageHint.StaticDraw); - - texVboHandle = GL.GenBuffer(); - GL.BindBuffer(BufferTarget.ArrayBuffer, texVboHandle); - GL.BufferData<Vector2>(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<Vector3>(BufferTarget.ArrayBuffer, + new IntPtr(positions.Length * Vector3.SizeInBytes), + positions, BufferUsageHint.StaticDraw); + + if (texCoords != null) { + texVboHandle = GL.GenBuffer (); + GL.BindBuffer (BufferTarget.ArrayBuffer, texVboHandle); + GL.BufferData<Vector2> (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 @@ -<configuration> - <dllmap os="linux" dll="opengl32.dll" target="libGL.so.1"/> - <dllmap os="linux" dll="glu32.dll" target="libGLU.so.1"/> - <dllmap os="linux" dll="openal32.dll" target="libopenal.so.1"/> - <dllmap os="linux" dll="alut.dll" target="libalut.so.0"/> - <dllmap os="linux" dll="opencl.dll" target="libOpenCL.so"/> - <dllmap os="linux" dll="libX11" target="libX11.so.6"/> - <dllmap os="linux" dll="libXi" target="libXi.so.6"/> - <dllmap os="linux" dll="SDL2.dll" target="libSDL2-2.0.so.0"/> - <dllmap os="osx" dll="opengl32.dll" target="/System/Library/Frameworks/OpenGL.framework/OpenGL"/> - <dllmap os="osx" dll="openal32.dll" target="/System/Library/Frameworks/OpenAL.framework/OpenAL" /> - <dllmap os="osx" dll="alut.dll" target="/System/Library/Frameworks/OpenAL.framework/OpenAL" /> - <dllmap os="osx" dll="libGLES.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" /> - <dllmap os="osx" dll="libGLESv1_CM.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" /> - <dllmap os="osx" dll="libGLESv2.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" /> - <dllmap os="osx" dll="opencl.dll" target="/System/Library/Frameworks/OpenCL.framework/OpenCL"/> - <dllmap os="osx" dll="SDL2.dll" target="libSDL2.dylib"/> - <!-- XQuartz compatibility (X11 on Mac) --> - <dllmap os="osx" dll="libGL.so.1" target="/usr/X11/lib/libGL.dylib"/> - <dllmap os="osx" dll="libX11" target="/usr/X11/lib/libX11.dylib"/> - <dllmap os="osx" dll="libXcursor.so.1" target="/usr/X11/lib/libXcursor.dylib"/> - <dllmap os="osx" dll="libXi" target="/usr/X11/lib/libXi.dylib"/> - <dllmap os="osx" dll="libXinerama" target="/usr/X11/lib/libXinerama.dylib"/> - <dllmap os="osx" dll="libXrandr.so.2" target="/usr/X11/lib/libXrandr.dylib"/> -</configuration> 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 @@ <?xml version="1.0" encoding="utf-8"?> <packages> - <package id="OpenTK" version="1.1.2225.0" targetFramework="net45" /> + <package id="OpenTK" version="1.1.2349.61993" targetFramework="net45" /> </packages>
\ No newline at end of file @@ -1,66 +1,34 @@ -CROW -===== +CROW [](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 ------- ``` -<Window Width="800" Height="600" Title="Decks"> - <HorizontalStack> - <ListBox Height="0" Width="150" Background="0,5;0,5;0,5;0,5" Name="deckList" - Data="{DeckList}" HorizontalAlignment="Left" ValueChanged="onDeckListValueChange" - ItemTemplate="#Magic3D.ui.DeckItemTemplate.goml"> - <Template> - <Border BorderWidth="1" MinimumSize="0;100" Height="{TemplatedHeight}" Width="{TemplatedWidth}"> - <HorizontalStack Margin="1" Height="{TemplatedHeight}" Width="{TemplatedWidth}"> - <Scroller Name="scroller1" Height="{TemplatedHeight}" Width="{TemplatedWidth}" - Margin="2" VerticalScrolling="true" ScrollY="{../scrollbar1.Scroll}"> - <VerticalStack Width="{TemplatedWidth}" Height="-1" Name="List" Margin="0" VerticalAlignment="Top"/> - </Scroller> - <Scrollbar Name="scrollbar1" Scroll="{../scroller1.ScrollY}" MaximumScroll="{../scroller1.MaximumScroll}" - Orientation="Vertical" Width="10" Height="{TemplatedHeight}" /> - </HorizontalStack> - </Border> - </Template> - </ListBox> - <HorizontalStack Width="0" Height="0" Background="DimGray" Name="hsDeck"/> - </HorizontalStack> -</Window> ``` 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;; + 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(); + //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 @@ <OutputType>Exe</OutputType> <RootNamespace>Tests</RootNamespace> <AssemblyName>Tests</AssemblyName> - <StartupObject>Tests.GLCrow</StartupObject> + <StartupObject>testCrowOTK.CrowTest</StartupObject> <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> <OutputPath>$(SolutionDir)/build/$(Configuration)</OutputPath> <IntermediateOutputPath>$(SolutionDir)/build/obj/$(Configuration)</IntermediateOutputPath> @@ -23,12 +23,16 @@ <WarningLevel>4</WarningLevel> <ConsolePause>false</ConsolePause> <DefineConstants>DEBUG;TRACE;MEASURE_TIME</DefineConstants> + <IntermediateOutputPath>..\build\obj\Debug</IntermediateOutputPath> + <OutputPath>..\build\Debug</OutputPath> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>none</DebugType> <Optimize>true</Optimize> <WarningLevel>0</WarningLevel> <ConsolePause>false</ConsolePause> + <IntermediateOutputPath>..\build\obj\Release</IntermediateOutputPath> + <OutputPath>..\build\Release</OutputPath> </PropertyGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <ItemGroup> @@ -36,249 +40,178 @@ <Reference Include="System.Data" /> <Reference Include="System.Xml" /> <Reference Include="System.Drawing" /> - <Reference Include="cairo-sharp, Version=1.10.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756"> - <Package>gtk-sharp-3.0</Package> - </Reference> - <Reference Include="gio-sharp, Version=3.0.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f"> - <Package>gio-sharp-3.0</Package> - </Reference> - <Reference Include="glib-sharp, Version=3.0.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f"> - <Package>glib-sharp-3.0</Package> - </Reference> - <Reference Include="gtk-sharp, Version=3.0.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f"> - <Package>gtk-sharp-3.0</Package> - </Reference> - <Reference Include="atk-sharp, Version=3.0.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f"> - <Package>gtk-sharp-3.0</Package> + <Reference Include="OpenTK"> + <HintPath>..\packages\OpenTK.1.1.2349.61993\lib\NET40\OpenTK.dll</HintPath> </Reference> </ItemGroup> <ItemGroup> - <Compile Include="Interfaces\testBorder.goml.cs"> - <LogicalName></LogicalName> - </Compile> - <Compile Include="GLCrow.cs"> - <LogicalName></LogicalName> - </Compile> + <Compile Include="Interfaces\testBorder.goml.cs" /> + <Compile Include="GOLIBTestsOTK.cs" /> + <Compile Include="OTKCrow.cs" /> </ItemGroup> <ItemGroup> <None Include="image\u.svg"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\log.xml"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\testMeter.goml"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\tmpMembers.goml"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\itemTmp.goml"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\tmpDirItem.goml"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> - </None> - <None Include="GOLIBTests.cs"> - <LogicalName></LogicalName> </None> + <None Include="GOLIBTests.cs" /> <None Include="Interfaces\basicTests\0.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\basicTests\1.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\basicTests\2.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\basicTests\4.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\basicTests\5.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\basicTests\6.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\basicTests\7.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\GraphicObject\0.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\GraphicObject\1.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\GraphicObject\2.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Container\0.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Container\1.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Container\2.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Stack\0.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Stack\1.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Stack\2.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Stack\3.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Container\3.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Group\0.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Group\1.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Group\2.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Group\3.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Group\4.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Stack\0h.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Stack\1h.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Stack\2h.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Stack\3h.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Stack\4.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Divers\2.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Divers\4.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Divers\5.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Divers\6.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Divers\clip0.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Divers\clip1.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Divers\clip2.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Divers\clip3.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Divers\clip4.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Divers\fps.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Divers\test_Listbox.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Divers\test_stack.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Divers\test0.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Divers\test1.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Divers\test1.1.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Divers\test1.2.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Divers\test2.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Divers\test2WayBinding.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Divers\test3.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Divers\test5.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Divers\test7.crow"> <LogicalName>Tests.Interfaces.test7.goml</LogicalName> @@ -286,158 +219,119 @@ </None> <None Include="Interfaces\Divers\testAll.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Divers\testBorder.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Divers\testButton.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Divers\testCheckbox.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Divers\testCombobox.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Divers\testContainer.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Divers\testGrid.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Divers\testGroupBox.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Divers\testHStack.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Divers\testPopper.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Divers\testRadioButton.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Divers\testScrollbar.goml"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Divers\testSpinner.goml"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Divers\testStacks.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Divers\testTextBox.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Divers\testWindow.goml"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Divers\testWindow2.goml"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Divers\testWindow3.goml"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Nouveau dossier\testColorList.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Nouveau dossier\test4.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Nouveau dossier\test6.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Nouveau dossier\test4.1.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Nouveau dossier\testMsgBox.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Nouveau dossier\testOutOfClipUpdate.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Nouveau dossier\testFileDialog.goml"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Nouveau dossier\testImage.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Nouveau dossier\testDirViewer.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Nouveau dossier\testTabView.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Nouveau dossier\testTypeViewer.goml"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Nouveau dossier\testLabel.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Nouveau dossier\testRadioButton2.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Expandable\1.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Expandable\0.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Expandable\7.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Expandable\2.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Nouveau dossier\testTreeView.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> </None> <None Include="Interfaces\Splitter\1.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - <LogicalName></LogicalName> - </None> - <None Include="OpenTK.dll.config"> - <LogicalName></LogicalName> - </None> - <None Include="GOLIBTestsOTK.cs"> - <LogicalName></LogicalName> </None> + <None Include="OpenTK.dll.config" /> + <None Include="packages.config" /> + <None Include="main.cs" /> + <None Include="GLCrow.cs" /> </ItemGroup> <ItemGroup> <Folder Include="Interfaces\" /> @@ -459,21 +353,20 @@ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </EmbeddedResource> <EmbeddedResource Include="Interfaces\TmpExpandable.goml" /> - <EmbeddedResource Include="ui\fps.crow" /> <EmbeddedResource Include="ui\tmpWindow.crow" /> + <EmbeddedResource Include="ui\test.crow" /> + <EmbeddedResource Include="ui\LabelButton.style" /> + <EmbeddedResource Include="ui\Popper.template" /> + <EmbeddedResource Include="ui\MenuItem.style" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\Crow.csproj"> <Project>{C2980F9B-4798-4C05-99E2-E174810F7C7B}</Project> <Name>Crow</Name> </ProjectReference> - <ProjectReference Include="..\GLCrow\GLCrow.csproj"> - <Project>{66376B95-9351-4A63-B920-F4BB53FEF0E2}</Project> - <Name>GLCrow</Name> - </ProjectReference> - <ProjectReference Include="..\..\..\src\Pencil.Gaming\Pencil.Gaming\Pencil.Gaming.csproj"> - <Project>{DDB6DB6D-E5DE-4BDB-8AC8-26DF800E9FF0}</Project> - <Name>Pencil.Gaming</Name> + <ProjectReference Include="..\OTKCrow\OTKCrow.csproj"> + <Project>{350D4F49-9901-4998-9903-BCA7D48DA58C}</Project> + <Name>OTKCrow</Name> </ProjectReference> </ItemGroup> </Project> 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<Binding> bindings = new List<Binding> (); + public List<Binding> 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<float> (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 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="OpenTK" version="1.1.2349.61993" targetFramework="net45" /> +</packages>
\ 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 @@ +<?xml version="1.0"?> +<Label Text="{../Caption}" Style="#Tests.ui.LabelButton.style" + Height="Fit" Width="{../WidthPolicy}"/> diff --git a/Tests/ui/fps.crow b/Tests/ui/fps.crow deleted file mode 100755 index 603387f4..00000000 --- a/Tests/ui/fps.crow +++ /dev/null @@ -1,55 +0,0 @@ -<?xml version="1.0"?> -<Window Font="droid bold, 10" Title="Open GL" Width="120" Height="200" - MinimumSize="160;250" - Template="#GLC.ui.tmpWindow.crow" - HorizontalAlignment="Right" Top="10"> - <VerticalStack Height="Fit" Width="95%" Spacing="10"> - <HorizontalStack Height="Fit" Width="Stretched"> - <Label Text="Frame:" Width="25%" TextAlignment="Right" Background="Mantis"/> - <Label Text="{frameTime}" Font="droid , 12" Width="75%" - TextAlignment="Center" Background="Teal"/> - </HorizontalStack> - <HorizontalStack Height="Fit" Width="Stretched"> - <Label Text="Max:" Width="25%" TextAlignment="Right" Background="Mantis"/> - <Label Text="{frameMax}" Font="droid , 12" Width="75%" - TextAlignment="Center" Background="Teal"/> - </HorizontalStack> - <HorizontalStack Height="Fit" Width="Stretched"> - <Label Text="Min:" Width="25%" TextAlignment="Right" Background="Mantis"/> - <Label Text="{frameMin}" Font="droid , 12" Width="75%" - TextAlignment="Center" Background="Teal"/> - </HorizontalStack> - <HorizontalStack Height="Fit" Width="Stretched"> - <Label Text="Fps:" Width="30%" TextAlignment="Right" Background="Onyx"/> - <Label Text="{fps}" Font="droid , 12" Width="70%" - TextAlignment="Center" Background="Teal"/> - </HorizontalStack> - <HorizontalStack Height="Fit" Width="Stretched"> - <Label Text="Min:" Width="30%" TextAlignment="Right" Background="Mantis"/> - <Label Text="{fpsMin}" Font="droid , 12" Width="70%" - TextAlignment="Center" Background="Teal"/> - </HorizontalStack> - <HorizontalStack Height="Fit" Width="Stretched"> - <Label Text="Max:" Width="30%" TextAlignment="Right" Background="Mantis"/> - <Label Text="{fpsMax}" Font="droid , 12" Width="70%" - TextAlignment="Center" Background="Teal"/> - </HorizontalStack> - <Button Caption="Reset Min/Max times" MouseClick="onResetTimes"/> -<!-- <HorizontalStack Fit="true"> - <Label Text="GPU Mem:" TextAlignment="Right"/> - <Label Text="{gpuTotalMem}" Font="droid , 12" Width="50" - TextAlignment="Center" Background="Teal"/> - </HorizontalStack> - <HorizontalStack Fit="true"> - <Label Text="GPU Mem:" TextAlignment="Right"/> - <Label Text="{gpuDedicatedMem}" Font="droid , 12" Width="50" - TextAlignment="Center" Background="Teal"/> - </HorizontalStack> - <HorizontalStack Fit="true"> - <Label Text="GPU Mem:" TextAlignment="Right"/> - <Label Text="{gpuFreeMem}" Font="droid , 12" Width="50" - TextAlignment="Center" Background="Teal"/> - </HorizontalStack>--> - <Button Caption="Update GPU mem info" MouseClick="onUpdateGPUMemInfo"/> - </VerticalStack> -</Window>
\ No newline at end of file diff --git a/Tests/ui/test.crow b/Tests/ui/test.crow new file mode 100755 index 00000000..829beb9c --- /dev/null +++ b/Tests/ui/test.crow @@ -0,0 +1,20 @@ +<?xml version="1.0"?> +<Window Font="droid bold, 10" Title="Open GL" Width="60%" Height="50%"> + <VerticalStack> + <HorizontalStack Background="Jet" Height="Fit" Width="Stretched" Margin="2"> + <Popper Caption="File" Template="#Tests.ui.Popper.template" Width="Fit"> + <Border Fit="True" Foreground="Gray" Background="Jet"> + <VerticalStack Height="Fit" Width="Fit" Margin="2"> + <Label Text="New File" Style="#Tests.ui.MenuItem.style" /> + <Label Text="Open..." Style="#Tests.ui.MenuItem.style"/> + <Label Text="Save..." Style="#Tests.ui.MenuItem.style"/> + <Label Text="Exit" Style="#Tests.ui.MenuItem.style"/> + </VerticalStack> + </Border> + </Popper> + <Label Text="Edit" Style="#Tests.ui.LabelButton.style"/> + <Label Text="Project" Style="#Tests.ui.LabelButton.style"/> + <Label Text="Help" Style="#Tests.ui.LabelButton.style"/> + </HorizontalStack> + </VerticalStack> +</Window>
\ No newline at end of file diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs index 9bd31763..59b4be18 100644 --- a/src/GraphicObjects/GraphicObject.cs +++ b/src/GraphicObjects/GraphicObject.cs @@ -261,13 +261,23 @@ namespace Crow this.RegisterForLayouting (LayoutingType.Height); } } + /// <summary> + /// Used for binding on dimensions, this property will never hold fixed size, but instead only + /// Fit or Stretched + /// </summary> [XmlIgnore]public virtual Measure WidthPolicy { get { return Width.Units == Unit.Percent || Width.IsFixed ? Measure.Stretched : Measure.Fit; } } + /// <summary> + /// Used for binding on dimensions, this property will never hold fixed size, but instead only + /// Fit or Stretched + /// </summary> [XmlIgnore]public virtual Measure HeightPolicy { get { return Height.Units == Unit.Percent || Height.IsFixed ? Measure.Stretched : Measure.Fit; } } - + /// <summary> + /// When set to True, the <see cref="T:Crow.GraphicObject"/>'s width and height will be set to Fit. + /// </summary> [XmlAttributeAttribute()][DefaultValue(false)] public virtual bool Fit { get { return Width == Measure.Fit && Height == Measure.Fit ? true : false; } @@ -729,8 +739,9 @@ namespace Crow LayoutChanged.Raise (this, new LayoutingEventArgs (layoutType)); } - /// <summary> Update layout component, this is where the computation of alignement - /// and size take place </summary> + /// <summary> Update layout component only one at a time, this is where the computation of alignement + /// and size take place. + /// The redrawing will only be triggered if final slot size has changed </summary> /// <returns><c>true</c>, if layouting was possible, <c>false</c> if conditions were not /// met and LQI has to be re-queued</returns> public virtual bool UpdateLayout (LayoutingType layoutType) @@ -759,6 +770,15 @@ namespace Crow } } else Slot.X = Left; + + if (LastSlots.X == Slot.X) + break; + + bmp = null; + + OnLayoutChanges (layoutType); + + LastSlots.X = Slot.X; break; case LayoutingType.Y: if (Top == 0) { @@ -780,6 +800,15 @@ namespace Crow } } else Slot.Y = Top; + + if (LastSlots.Y == Slot.Y) + break; + + bmp = null; + + OnLayoutChanges (layoutType); + + LastSlots.Y = Slot.Y; break; case LayoutingType.Width: if (Visible) { @@ -807,6 +836,15 @@ namespace Crow } } else Slot.Width = 0; + + if (LastSlots.Width == Slot.Width) + break; + + bmp = null; + + OnLayoutChanges (layoutType); + + LastSlots.Width = Slot.Width; break; case LayoutingType.Height: if (Visible) { @@ -834,51 +872,7 @@ namespace Crow } } else Slot.Height = 0; - break; - } - - updateSlot (layoutType); - - //if no layouting remains in queue for item, registre for redraw - if (this.registeredLayoutings == LayoutingType.None && bmp == null) - this.AddToRedrawList (); - - return true; - } - protected void updateSlot(LayoutingType layoutType) - { - switch (layoutType) { - case LayoutingType.X: - if (LastSlots.X == Slot.X) - break; - - bmp = null; - - OnLayoutChanges (layoutType); - - LastSlots.X = Slot.X; - break; - case LayoutingType.Y: - if (LastSlots.Y == Slot.Y) - break; - - bmp = null; - - OnLayoutChanges (layoutType); - - LastSlots.Y = Slot.Y; - break; - case LayoutingType.Width: - if (LastSlots.Width == Slot.Width) - break; - - bmp = null; - - OnLayoutChanges (layoutType); - - LastSlots.Width = Slot.Width; - break; - case LayoutingType.Height: + if (LastSlots.Height == Slot.Height) break; @@ -886,9 +880,15 @@ namespace Crow OnLayoutChanges (layoutType); - LastSlots.Height = Slot.Height; + LastSlots.Height = Slot.Height; break; } + + //if no layouting remains in queue for item, registre for redraw + if (this.registeredLayoutings == LayoutingType.None && bmp == null) + this.AddToRedrawList (); + + return true; } #endregion diff --git a/src/GraphicObjects/HorizontalStack.cs b/src/GraphicObjects/HorizontalStack.cs index 30fded86..ae48f997 100644 --- a/src/GraphicObjects/HorizontalStack.cs +++ b/src/GraphicObjects/HorizontalStack.cs @@ -10,8 +10,7 @@ namespace Crow { public HorizontalStack() : base() - { - Orientation = Crow.Orientation.Horizontal; + { } [XmlIgnore] diff --git a/src/GraphicObjects/Popper.cs b/src/GraphicObjects/Popper.cs index 4fd84554..5e5541fe 100644 --- a/src/GraphicObjects/Popper.cs +++ b/src/GraphicObjects/Popper.cs @@ -89,6 +89,17 @@ namespace Crow } } + public override void OnLayoutChanges (LayoutingType layoutType) + { + base.OnLayoutChanges (layoutType); + + if (_content == null) + return; + + if (layoutType == LayoutingType.Width) + _content.MinimumSize = new Size (this.Slot.Width, _content.MinimumSize.Height); + } + #region GraphicObject overrides public override void ClearBinding () { diff --git a/src/GraphicObjects/Slider.cs b/src/GraphicObjects/Slider.cs index 26720b1d..3b2cebf4 100644 --- a/src/GraphicObjects/Slider.cs +++ b/src/GraphicObjects/Slider.cs @@ -9,6 +9,7 @@ using System.Diagnostics; namespace Crow { + [DefaultStyle ("#Crow.Styles.Slider.style")] public class Slider : NumericControl { #region CTOR @@ -77,6 +78,7 @@ namespace Crow } } #endregion + [XmlAttributeAttribute()][DefaultValue(10.0)] public override double Maximum { get { return base.Maximum; } @@ -90,23 +92,6 @@ namespace Crow } #region GraphicObject Overrides - [XmlAttributeAttribute()][DefaultValue("vgradient|0:Black|0,1:Gray|0,9:Gray|1:LightGray")] - public override Fill Background { - get { return base.Background; } - set { base.Background = value; } - } - [XmlAttributeAttribute()][DefaultValue("Gray")] - public override Fill Foreground { - get { return base.Foreground; } - set { base.Foreground = value; } - } - [XmlAttributeAttribute()][DefaultValue(true)] - public override bool Focusable - { - get { return base.Focusable; } - set { base.Focusable = value; } - } - protected override void onDraw (Context gr) { base.onDraw (gr); diff --git a/src/GraphicObjects/TabItem.cs b/src/GraphicObjects/TabItem.cs index 9fd8180d..38d56c5d 100644 --- a/src/GraphicObjects/TabItem.cs +++ b/src/GraphicObjects/TabItem.cs @@ -25,6 +25,7 @@ using System.Diagnostics; namespace Crow { + [DefaultStyle ("#Crow.Styles.TabItem.style")] [DefaultTemplate("#Crow.Templates.TabItem.crow")] public class TabItem : TemplatedContainer { @@ -66,21 +67,6 @@ namespace Crow internal GraphicObject TabTitle { get { return _tabTitle; }} #endregion - #region GraphicObject overrides - [XmlAttributeAttribute()][DefaultValue(true)] - public override bool Focusable - { - get { return base.Focusable; } - set { base.Focusable = value; } - } - //prevent caching, because drawing order is different depending on selected tab - [XmlAttributeAttribute()][DefaultValue(false)] - public override bool CacheEnabled { - get {return false;} - set { } - } - #endregion - [XmlAttributeAttribute()][DefaultValue(0)] public virtual int TabOffset { get { return tabOffset; } diff --git a/src/GraphicObjects/VerticalStack.cs b/src/GraphicObjects/VerticalStack.cs index afd26429..e3d5e588 100644 --- a/src/GraphicObjects/VerticalStack.cs +++ b/src/GraphicObjects/VerticalStack.cs @@ -10,14 +10,12 @@ namespace Crow public VerticalStack() : base() { - Orientation = Crow.Orientation.Vertical; } [System.Xml.Serialization.XmlIgnore] public override Orientation Orientation { - get { return Orientation.Vertical; } - //set { } + get { return Orientation.Vertical; } } diff --git a/src/Interface.cs b/src/Interface.cs index d0c385e7..b8426e6f 100644 --- a/src/Interface.cs +++ b/src/Interface.cs @@ -30,6 +30,15 @@ using Cairo; namespace Crow { + /// <summary> + /// The Interface Class is the top container of the application. + /// It provides the Dirty bitmap and zone of the interface to be drawn on screen + /// + /// The Interface contains : + /// - rendering and layouting queues and logic. + /// - helpers to load XML interfaces files + /// - global constants and variables of CROW + /// </summary> public class Interface : ILayoutable { #region CTOR @@ -58,6 +67,7 @@ namespace Crow public static int TabSize = 4; public static string LineBreak = "\r\n"; + //TODO: shold be declared in graphicObject public static bool FocusOnHover = false; /// <summary> Time to wait in millisecond before starting repeat loop</summary> public static int DeviceRepeatDelay = 600; @@ -68,11 +78,18 @@ namespace Crow public static bool DesignerMode = false; /// <summary> Threshold to catch borders for sizing </summary> public static int BorderThreshold = 5; + /// <summary> Disable caching for a widget if this threshold is reached </summary> public const int MaxCacheSize = 2048; + /// <summary> Above this count, the layouting is discard for the widget and it + /// will not be rendered on screen </summary> public const int MaxLayoutingTries = 50; + /// <summary> Global font rendering settings for Cairo </summary> public static FontOptions FontRenderingOptions; #endregion + /// <summary> + /// The layouting queue contains layouting commands + /// </summary> public Queue<LayoutingQueueItem> LayoutingQueue; public Queue<GraphicObject> GraphicUpdateQueue = new Queue<GraphicObject>(); public string Clipboard; @@ -98,6 +115,10 @@ namespace Crow } #region default values loading helpers + /// Default values of properties from GraphicObjects are retrieve from XML Attributes. + /// The reflexion process used to retrieve those values being very slow, it is compiled in MSIL + /// and injected as a dynamic method referenced in the DefaultValuesLoader Dictionnary. + /// The compilation is done on the first object instancing, and is also done for custom widgets public delegate void loadDefaultInvoker(object instance); public static Dictionary<String, loadDefaultInvoker> DefaultValuesLoader = new Dictionary<string, loadDefaultInvoker>(); #endregion diff --git a/src/LayoutingQueueItem.cs b/src/LayoutingQueueItem.cs index 933fc57c..82673444 100644 --- a/src/LayoutingQueueItem.cs +++ b/src/LayoutingQueueItem.cs @@ -36,19 +36,26 @@ namespace Crow ArrangeChildren = 0x10, All = 0xFF } - + /// <summary> + /// Element class of the LayoutingQueue + /// </summary> public class LayoutingQueueItem - { + { + /// <summary> Instance of widget to be layouted</summary> public ILayoutable GraphicObject; + /// <summary> Bitfield containing the element of the layout to performs (x|y|width|height)</summary> public LayoutingType LayoutType; + #region CTOR public LayoutingQueueItem (LayoutingType _layoutType, ILayoutable _graphicObject) { LayoutType = _layoutType; GraphicObject = _graphicObject; GraphicObject.RegisteredLayoutings |= LayoutType; } - + #endregion + + public void ProcessLayouting() { if (GraphicObject.Parent == null) { diff --git a/src/Measure.cs b/src/Measure.cs index 64e5cc98..19e8f548 100644 --- a/src/Measure.cs +++ b/src/Measure.cs @@ -22,22 +22,47 @@ using System; namespace Crow { + /// <summary> + /// Measurement unit + /// </summary> public enum Unit { Pixel, Percent } + /// <summary> + /// Measure class allow proportional sizes as well as stretched and fit on content. + /// </summary> public struct Measure { + /// <summary> + /// Integer value of the measure + /// </summary> public int Value; + /// <summary> + /// Measurement unit + /// </summary> public Unit Units; + /// <summary> + /// Fit on content, this special measure is defined as a fixed integer set to -1 pixel + /// </summary> public static Measure Fit = new Measure(-1); - //TODO:implement stretching as 100%, not 0% + /// <summary> + /// Stretched into parent client area. This special measure is defined as a proportional cote + /// set to 100 Percents + /// </summary> public static Measure Stretched = new Measure(100, Unit.Percent); + #region CTOR public Measure (int _value, Unit _units = Unit.Pixel) { Value = _value; Units = _units; } + #endregion + + /// <summary> + /// True is size is fixed in pixels, this means not proportional, stretched nor fit. + /// </summary> public bool IsFixed { get { return Value > 0 && Units == Unit.Pixel; }} + #region Operators public static implicit operator int(Measure m){ return m.Value; @@ -59,6 +84,8 @@ namespace Crow return !(m1.Value == m2.Value && m1.Units == m2.Units); } #endregion + + #region Object overrides public override int GetHashCode () { return Value.GetHashCode (); @@ -75,6 +102,8 @@ namespace Crow Units == Unit.Percent ? Value == 100 ? "Stretched" : Value.ToString () + "%" : Value.ToString (); } + #endregion + public static Measure Parse(string s){ if (string.IsNullOrEmpty (s)) return Measure.Stretched; |