]> O.S.I.I.S - jp/crow.git/commitdiff
proj files cleanup, nuget config
authorjpbruyere <jp.bruyere@hotmail.com>
Wed, 20 Jul 2016 07:39:34 +0000 (09:39 +0200)
committerjpbruyere <jp.bruyere@hotmail.com>
Wed, 20 Jul 2016 07:39:34 +0000 (09:39 +0200)
Crow.OpenTK.nuspec [new file with mode: 0644]
Crow.csproj
Crow.sln
OTKCrow/OpenTKGameWindow.cs
Tests/Tests.csproj
Tests/main.cs [deleted file]
Tests/ui/test.crow

diff --git a/Crow.OpenTK.nuspec b/Crow.OpenTK.nuspec
new file mode 100644 (file)
index 0000000..da83868
--- /dev/null
@@ -0,0 +1,41 @@
+<?xml version="1.0"?>
+<package >
+       <metadata>
+               <id>Crow.OpenTK</id>
+               <version>0.4.1</version>
+               <title>C# Rapid Widget Toolkit</title>
+               <authors>JP Bruyere</authors>
+               <owners>Grand Tetras Software Team</owners>
+               <licenseUrl>https://www.gnu.org/licenses/gpl-3.0.html</licenseUrl>
+               <projectUrl>https://jpbruyere.github.io/Crow/</projectUrl>
+               <iconUrl>https://jpbruyere.github.io/Crow/images/crow.png</iconUrl>
+               <requireLicenseAcceptance>false</requireLicenseAcceptance>
+               <description>
+               CROW is a pure C# widget toolkit with templates, styles, compositing, and bindings.
+               Crow.OpenTK is the OpenTK ready version. 
+               </description>
+               <releaseNotes>second nuget packaging try</releaseNotes>
+               <copyright>Copyright 2016</copyright>
+               <dependencies>
+                       <dependency id="OpenTK.Next"/>
+               </dependencies>
+        <tags>Crow OpenTK OpenGL Widget Interface GUI C# .Net Mono</tags>
+        <references>
+            <reference file="OpenTK.dll" />
+        </references>
+        <frameworkAssemblies>
+            <frameworkAssembly assemblyName="System" />
+            <frameworkAssembly assemblyName="System.Drawing" />
+            <frameworkAssembly assemblyName="System.Xml" />
+        </frameworkAssemblies>
+       </metadata>
+       <files>
+               <file src="build/Release/Crow.dll" target="lib/net45" />
+               <file src="build/Release/OTKCrow.dll" target="lib/net45" />
+               <file src="build/Release/gio-sharp.dll" target="lib/net45" />
+               <file src="build/Release/glib-sharp.dll" target="lib/net45" />
+               <file src="build/Release/cairo-sharp.dll" target="lib/net45" />
+               <file src="build/Release/glib-sharp.dll.config" target="build" />
+               <file src="build/Release/gio-sharp.dll.config" target="build" />
+       </files>
+</package>
index 0955e03efe000f4136a558d545ab8cf8547d382d..722764a14393b90da172ebfd64853b1b53afd4e0 100644 (file)
     </Reference>
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <Import Project="packages\gtk-sharp.Linux.3.14.3.14.7\build\net40\gtk-sharp.Linux.3.14.targets" Condition="Exists('packages\gtk-sharp.Linux.3.14.3.14.7\build\net40\gtk-sharp.Linux.3.14.targets')" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.
   <Target Name="BeforeBuild">
     <EmbeddedResource Include="Templates\ScrollBar.goml" />
     <EmbeddedResource Include="Templates\Button.crow" />
     <EmbeddedResource Include="Templates\ArrowButTemplate.crow" />
-    <EmbeddedResource Include="Images\crow0.svg"/>
+    <EmbeddedResource Include="Images\crow0.svg" />
     <EmbeddedResource Include="Templates\TreeView.crow" />
     <EmbeddedResource Include="Templates\TabItem.crow" />
     <EmbeddedResource Include="Templates\TreeItem.crow" />
index 9ed39d880c827040991170ab7ef536d824ef5222..d24e6d4fb2f06db8558cf7a03cd94022d3d2b843 100644 (file)
--- a/Crow.sln
+++ b/Crow.sln
@@ -11,34 +11,20 @@ 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
        EndGlobalSection
        GlobalSection(ProjectConfigurationPlatforms) = postSolution
                {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
+               {350D4F49-9901-4998-9903-BCA7D48DA58C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {350D4F49-9901-4998-9903-BCA7D48DA58C}.Release|Any CPU.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
+               {74289092-9F70-4941-AFCB-DFD7BE2140B6}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {74289092-9F70-4941-AFCB-DFD7BE2140B6}.Release|Any CPU.Build.0 = Release|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
+               {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Release|Any CPU.Build.0 = Release|Any CPU
        EndGlobalSection
        GlobalSection(MonoDevelopProperties) = preSolution
                Policies = $0
@@ -60,7 +46,7 @@ Global
                $4.inheritsSet = Mono
                $4.inheritsScope = text/x-csharp
                $4.scope = text/x-csharp
-               description = @C.R.O.W. Collaborative Radiant Open Widgets\n\nA pure c# toolkit with XML definition of interface with binding and\ndynamic delegates
+               description = @C.R.O.W. c# Rapid Open Widgets\n\nCrow is a pure c# widget toolkit with XML definition of interface, bindings, styling...\n
                version = 0.4
        EndGlobalSection
 EndGlobal
index 11dd5d2e6facb1dd96647cdae9102fdd2bcf62f5..1dcd6066cf180a825a7ba41b02ed268968b3f5be 100644 (file)
@@ -91,28 +91,16 @@ namespace Crow
                #endregion
 
                #region ctor
-//             public OpenTKGameWindow(int _width, int _height, string _title="golib")
-//                     : base(_width, _height, new OpenTK.Graphics.GraphicsMode(32, 24, 0, 1), _title,
-//                             GameWindowFlags.Fullscreen,
-//                             DisplayDevice.Default,
-//                             3,0,OpenTK.Graphics.GraphicsContextFlags.Default)
-               public OpenTKGameWindow(int _width, int _height, string _title="Crow")
-                       : base(_width, _height, new OpenTK.Graphics.GraphicsMode(32, 24, 0, 1),
-                               _title,GameWindowFlags.Default,DisplayDevice.GetDisplay(DisplayIndex.Second),
-                               3,3,OpenTK.Graphics.GraphicsContextFlags.Default)
-//             public OpenTKGameWindow(int _width, int _height, string _title="golib")
-//                     : base(_width, _height, new OpenTK.Graphics.GraphicsMode(32, 24, 0, 8), _title)
+               public OpenTKGameWindow(int _width = 800, int _height = 600, string _title="Crow",
+                       int colors = 32, int depth = 24, int stencil = 0, int samples = 1,
+                       int major=3, int minor=3)
+                       : this(_width, _height, new OpenTK.Graphics.GraphicsMode(colors, depth, stencil, samples),
+                               _title,GameWindowFlags.Default,DisplayDevice.Default,
+                               major,minor,OpenTK.Graphics.GraphicsContextFlags.Default)
                {
-                       CrowInterface = new Interface ();
-                       Thread t = new Thread (interfaceThread);
-                       t.IsBackground = true;
-                       t.Start ();
-//                     interfaceThread ();
                }
-               public OpenTKGameWindow(int _width, int _height, int colors, int depth, int stencil, int samples, string _title="Crow")
-                       : base(_width, _height, new OpenTK.Graphics.GraphicsMode(colors, depth, stencil, samples),
-                               _title,GameWindowFlags.Default,DisplayDevice.GetDisplay(DisplayIndex.Second),
-                               3,3,OpenTK.Graphics.GraphicsContextFlags.Default)
+               public OpenTKGameWindow (int width, int height, OpenTK.Graphics.GraphicsMode mode, string title, GameWindowFlags options, DisplayDevice device, int major, int minor, OpenTK.Graphics.GraphicsContextFlags flags)
+                       : base(width,height,mode,title,options,device,major,minor,flags)
                {
                        CrowInterface = new Interface ();
 
@@ -120,6 +108,7 @@ namespace Crow
                        t.IsBackground = true;
                        t.Start ();
                }
+
                #endregion
 
                void interfaceThread()
index 0a51a8ced2895ac330b572cf25fd466b49b05a8f..fe7570b35409c2a1c3e4936b8161119b3dbcefa9 100644 (file)
@@ -8,7 +8,7 @@
     <OutputType>Exe</OutputType>
     <RootNamespace>Tests</RootNamespace>
     <AssemblyName>Tests</AssemblyName>
-    <StartupObject>testCrowOTK.CrowTest</StartupObject>
+    <StartupObject>testOTK.GOLIBTests</StartupObject>
     <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
     <OutputPath>$(SolutionDir)/build/$(Configuration)</OutputPath>
     <IntermediateOutputPath>$(SolutionDir)/build/obj/$(Configuration)</IntermediateOutputPath>
     <WarningLevel>4</WarningLevel>
     <ConsolePause>false</ConsolePause>
     <DefineConstants>DEBUG;TRACE;MEASURE_TIME</DefineConstants>
+    <IntermediateOutputPath>$(SolutionDir)\build\obj\$(Configuration)</IntermediateOutputPath>
+    <OutputPath>$(SolutionDir)\build\Debug</OutputPath>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     <DebugType>none</DebugType>
     <Optimize>true</Optimize>
     <WarningLevel>0</WarningLevel>
     <ConsolePause>false</ConsolePause>
+    <IntermediateOutputPath>$(SolutionDir)\build\obj\$(Configuration)</IntermediateOutputPath>
+    <OutputPath>$(SolutionDir)\build\Release</OutputPath>
   </PropertyGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
   <ItemGroup>
@@ -36,8 +40,8 @@
     <Reference Include="System.Data" />
     <Reference Include="System.Xml" />
     <Reference Include="System.Drawing" />
-    <Reference Include="OpenTK">      
-      <HintPath>..\packages\OpenTK.Next.1.2.2336.6514-pre\lib\net20\OpenTK.dll</HintPath>
+    <Reference Include="OpenTK">
+      <HintPath>$(SolutionDir)\packages\OpenTK.Next.1.2.2336.6514-pre\lib\net20\OpenTK.dll</HintPath>
     </Reference>
   </ItemGroup>
   <ItemGroup>
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
     <None Include="OpenTK.dll.config" />
-    <None Include="main.cs" />
     <None Include="GLCrow.cs" />
   </ItemGroup>
   <ItemGroup>
diff --git a/Tests/main.cs b/Tests/main.cs
deleted file mode 100644 (file)
index 5ec562e..0000000
+++ /dev/null
@@ -1,467 +0,0 @@
-#define MONO_CAIRO_DEBUG_DISPOSE
-
-
-using System;
-using System.Runtime.InteropServices;
-using OpenTK;
-using OpenTK.Graphics.OpenGL;
-using OpenTK.Input;
-
-using System.Diagnostics;
-
-//using GGL;
-using 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
index 829beb9c2a057a5bb5f4c6919e4fb297cf1996a6..d0450fedf0e4bd25911409bae6d74a6d116c8356 100755 (executable)
@@ -15,6 +15,9 @@
                        <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>      
+               </HorizontalStack>
+               <CheckBox Text="Test"/>
+               <Image Width="100" Height="100"
+               Path="#Crow.Images.Icons.exit2.svg"     />
        </VerticalStack>
 </Window>
\ No newline at end of file