]> O.S.I.I.S - jp/crowedit.git/commitdiff
update to Crow 0.6.0
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Fri, 9 Feb 2018 20:17:24 +0000 (21:17 +0100)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Fri, 9 Feb 2018 21:37:49 +0000 (22:37 +0100)
Crow.dll.config
CrowEdit.csproj
CrowWindow.cs
InterfaceControler.cs
OpenGL/Extensions.cs
OpenGL/Shader.cs
OpenTK.dll.config [new file with mode: 0644]
packages.config

index ef7562ac47aa7b4d9008d121bdc494f83e312639..6341771d7872a7360ecdb8a8c0a4f14c4745d998 100644 (file)
@@ -6,6 +6,7 @@
   <dllmap os="!windows,osx" dll="libgdk-3-0.dll" target="libgdk-3.so.0"/>
   <dllmap os="!windows,osx" dll="libgdk_pixbuf-2.0-0.dll" target="libgdk_pixbuf-2.0.so.0"/>
   <dllmap os="!windows,osx" dll="rsvg-2" target="librsvg-2.so.2"/>
+  <dllmap os="!windows,osx" dll="libinput" target="libinput.so.10"/>
 
   
   <dllmap os="windows" dll="rsvg-2" target="librsvg-2-2.dll"/>
index 08986e6f1aacd4ede70cea75d57ea28a19e098d5..f2dad2e427453b1860bef7e0c98bcef2ecaf4359 100644 (file)
     <WarningLevel>4</WarningLevel>
     <ConsolePause>false</ConsolePause>
     <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <IntermediateOutputPath>$(SolutionDir)build\obj\$(Configuration)</IntermediateOutputPath>
+    <OutputPath>$(SolutionDir)build\$(Configuration)</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\$(Configuration)</OutputPath>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(RunConfiguration)' == 'Default' ">
+    <StartAction>Program</StartAction>
+    <StartProgram>%24{TargetName}</StartProgram>
+    <StartWorkingDirectory>%24{SolutionDir}\build\%24{ProjectConfigName}</StartWorkingDirectory>
+    <ConsolePause>false</ConsolePause>
   </PropertyGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
   <ItemGroup>
     <None Include="OpenTK.dll.config" />
-    <None Include="packages.config" />
     <None Include="ui\icons\center-align.svg" />
     <None Include="ui\icons\cogwheel.svg" />
     <None Include="ui\icons\edit.svg" />
     <None Include="ui\icons\zoom-in.svg" />
     <None Include="ui\icons\zoom-out.svg" />
     <None Include="ui\icons\basic_floppydisk.svg" />
-    <None Include="Crow.dll.config" />
+    <None Include="packages.config" />
+    <None Include="Crow.dll.config">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
   </ItemGroup>
   <ItemGroup>
     <Reference Include="System" />
@@ -61,7 +73,7 @@
       <HintPath>packages\OpenTK.2.0.0\lib\net20\OpenTK.dll</HintPath>
     </Reference>
     <Reference Include="Crow">
-      <HintPath>packages\Crow.OpenTK.0.5.6\lib\net45\Crow.dll</HintPath>
+      <HintPath>packages\Crow.OpenTK.0.6.0\lib\net45\Crow.dll</HintPath>
     </Reference>
   </ItemGroup>
   <ItemGroup>
     <Compile Include="CodeBufferEventArgs.cs" />
     <Compile Include="src\Node.cs" />
     <Compile Include="CrowWindow.cs" />
-    <Compile Include="InterfaceControler.cs" />
-    <Compile Include="OpenGL\Extensions.cs" />
-    <Compile Include="OpenGL\Shader.cs" />
-    <Compile Include="OpenGL\Texture.cs" />
-    <Compile Include="OpenGL\vaoMesh.cs" />
     <Compile Include="src\CodeLine.cs" />
+    <Compile Include="OpenGL\vaoMesh.cs" />
+    <Compile Include="OpenGL\Texture.cs" />
+    <Compile Include="OpenGL\Shader.cs" />
+    <Compile Include="OpenGL\Extensions.cs" />
+    <Compile Include="InterfaceControler.cs" />
   </ItemGroup>
   <ItemGroup>
     <Folder Include="ui\" />
index e66fa7b3ca1df9bfcad51ae222add2b4d5aa3fa3..9a0c4df0479eaf2525ba74c8a228f29fe50e824a 100644 (file)
@@ -63,7 +63,7 @@ namespace Crow
                                        ValueChanged.Raise(this, new ValueChangeEventArgs ("fpsMin", fpsMin));
                                }
                                #endif
-                               if (frameCpt % 20 == 0) {
+                               if (frameCpt % 3 == 0) {
                                        ValueChanged.Raise (this, new ValueChangeEventArgs ("fps", _fps));
                                        #if MEASURE_TIME
                                        foreach (PerformanceMeasure m in ifaceControl[0].PerfMeasures)
@@ -109,12 +109,29 @@ namespace Crow
                public List<InterfaceControler> ifaceControl = new List<InterfaceControler>();
                int focusedIdx = -1, activeIdx = -2;
 
+               // TODO:We should be able to set the current interface programmaticaly
+               /// <summary>
+               /// Gets the currently focused interface, focus could have been given by creation of new iface controler and
+               /// not only by the mouse
+               /// </summary>
+               public Interface CurrentInterface {
+                       get {
+                               if (ifaceControl.Count == 0) {//create default orthogonal interface
+                                       addInterfaceControler (new InterfaceControler (
+                                               new Rectangle (0, 0, this.ClientRectangle.Width, this.ClientRectangle.Height)));
+                                       focusedIdx = 0;
+                               }
+                               return ifaceControl [focusedIdx].CrowInterface;
+                       }
+               }
+                       
                void addInterfaceControler(InterfaceControler ifaceControler)
                {
                        ifaceControler.CrowInterface.Quit += Quit;
                        ifaceControler.CrowInterface.MouseCursorChanged += CrowInterface_MouseCursorChanged;
 
                        ifaceControl.Add (ifaceControler);
+                       focusedIdx = ifaceControl.Count - 1;
                }
                void openGLDraw(){
                        //save GL states
@@ -168,13 +185,13 @@ namespace Crow
 
                #region Events
                //those events are raised only if mouse isn't in a graphic object
-               public event EventHandler<OpenTK.Input.MouseWheelEventArgs> MouseWheelChanged;
-               public event EventHandler<OpenTK.Input.MouseButtonEventArgs> MouseButtonUp;
-               public event EventHandler<OpenTK.Input.MouseButtonEventArgs> MouseButtonDown;
-               public event EventHandler<OpenTK.Input.MouseButtonEventArgs> MouseClick;
-               public event EventHandler<OpenTK.Input.MouseMoveEventArgs> MouseMove;
-               public event EventHandler<OpenTK.Input.KeyboardKeyEventArgs> KeyboardKeyDown;
-               public event EventHandler<OpenTK.Input.KeyboardKeyEventArgs> KeyboardKeyUp;
+               public event EventHandler<OpenTK.Input.MouseWheelEventArgs> CrowMouseWheel;
+               public event EventHandler<OpenTK.Input.MouseButtonEventArgs> CrowMouseUp;
+               public event EventHandler<OpenTK.Input.MouseButtonEventArgs> CrowMouseDown;
+               public event EventHandler<OpenTK.Input.MouseButtonEventArgs> CrowMouseClick;
+               public event EventHandler<OpenTK.Input.MouseMoveEventArgs> CrowMouseMove;
+               public event EventHandler<OpenTK.Input.KeyboardKeyEventArgs> CrowKeyDown;
+               public event EventHandler<OpenTK.Input.KeyboardKeyEventArgs> CrowKeyUp;
 
                #endregion
 
@@ -190,15 +207,39 @@ namespace Crow
                        ifaceControl [interfaceIdx].CrowInterface.AddWidget (g);
                        return g;
                }
+
                public void DeleteWidget (GraphicObject g, int interfaceIdx = 0){
                        ifaceControl [interfaceIdx].CrowInterface.DeleteWidget (g);
                }
-               public GraphicObject Load (string path, int interfaceIdx = 0){
+               /// <summary>
+               /// check if a default interface exists, create one if not
+               /// </summary>
+               void checkDefaultIFace (){
                        if (ifaceControl.Count == 0)//create default orthogonal interface
                                addInterfaceControler (new InterfaceControler (
-                                                       new Rectangle (0, 0, this.ClientRectangle.Width, this.ClientRectangle.Height)));
-                       return ifaceControl [interfaceIdx].CrowInterface.LoadInterface (path);
+                                       new Rectangle (0, 0, this.ClientRectangle.Width, this.ClientRectangle.Height)));                        
                }
+               /// <summary>
+               /// Load the content of the IML file pointed by path and add it to the current interface
+               /// graphic tree.
+               /// </summary>
+               /// <param name="path">the path of the IML file to load</param>
+               /// <param name="interfaceIdx">interface index to bind to, a default one is created if none exists</param>
+               public GraphicObject Load (string path, int interfaceIdx = 0){
+                       checkDefaultIFace();
+                       return ifaceControl [interfaceIdx].CrowInterface.AddWidget (path);
+               }
+               /// <summary>
+               /// Load the content of the IML string passed as first argument and add it to the current interface
+               /// graphic tree.
+               /// </summary>
+               /// <param name="path">a valid IML string</param>
+               /// <param name="interfaceIdx">interface index to bind to, a default one is created if none exists</param>
+               public void LoadIMLFragment (string imlFragment, int interfaceIdx = 0){
+                       checkDefaultIFace();
+                       ifaceControl [interfaceIdx].CrowInterface.LoadIMLFragment (imlFragment);
+               }
+
                public GraphicObject FindByName (string nameToFind){
                        for (int i = 0; i < ifaceControl.Count; i++) {
                                GraphicObject tmp = ifaceControl [i].CrowInterface.FindByName (nameToFind);
@@ -226,12 +267,13 @@ namespace Crow
                        base.OnLoad(e);
 
                        this.KeyPress += new EventHandler<OpenTK.KeyPressEventArgs>(OpenTKGameWindow_KeyPress);
-                       Keyboard.KeyDown += new EventHandler<OpenTK.Input.KeyboardKeyEventArgs>(Keyboard_KeyDown);
-                       Keyboard.KeyUp += new EventHandler<OpenTK.Input.KeyboardKeyEventArgs>(Keyboard_KeyUp);
-                       Mouse.WheelChanged += new EventHandler<OpenTK.Input.MouseWheelEventArgs>(GL_Mouse_WheelChanged);
-                       Mouse.ButtonDown += new EventHandler<OpenTK.Input.MouseButtonEventArgs>(GL_Mouse_ButtonDown);
-                       Mouse.ButtonUp += new EventHandler<OpenTK.Input.MouseButtonEventArgs>(GL_Mouse_ButtonUp);
-                       Mouse.Move += new EventHandler<OpenTK.Input.MouseMoveEventArgs>(GL_Mouse_Move);
+                       KeyDown += new EventHandler<OpenTK.Input.KeyboardKeyEventArgs>(Keyboard_KeyDown);
+                       KeyUp += new EventHandler<OpenTK.Input.KeyboardKeyEventArgs>(Keyboard_KeyUp);
+
+                       MouseWheel += new EventHandler<OpenTK.Input.MouseWheelEventArgs>(GL_Mouse_WheelChanged);
+                       MouseDown += new EventHandler<OpenTK.Input.MouseButtonEventArgs>(GL_Mouse_ButtonDown);
+                       MouseUp += new EventHandler<OpenTK.Input.MouseButtonEventArgs>(GL_Mouse_ButtonUp);
+                       MouseMove += new EventHandler<OpenTK.Input.MouseMoveEventArgs>(GL_Mouse_Move);
 
                        #if DEBUG
                        Console.WriteLine("\n\n*************************************");
@@ -313,7 +355,7 @@ namespace Crow
                                return;
                        }
                        if (focusedIdx < 0)
-                               MouseMove.Raise (sender, otk_e);
+                               CrowMouseMove.Raise (sender, otk_e);
         }
                protected virtual void GL_Mouse_ButtonUp(object sender, OpenTK.Input.MouseButtonEventArgs otk_e)
         {
@@ -322,7 +364,7 @@ namespace Crow
                                if (ifaceControl [focusedIdx].ProcessMouseButtonUp ((int)otk_e.Button))
                                        return;
                        }
-                       MouseButtonUp.Raise (sender, otk_e);
+                       CrowMouseUp.Raise (sender, otk_e);
         }
                protected virtual void GL_Mouse_ButtonDown(object sender, OpenTK.Input.MouseButtonEventArgs otk_e)
                {
@@ -331,7 +373,7 @@ namespace Crow
                                if (ifaceControl [focusedIdx].ProcessMouseButtonDown ((int)otk_e.Button))
                                        return;
                        }
-                       MouseButtonDown.Raise (sender, otk_e);
+                       CrowMouseDown.Raise (sender, otk_e);
         }
                protected virtual void GL_Mouse_WheelChanged(object sender, OpenTK.Input.MouseWheelEventArgs otk_e)
         {
@@ -339,7 +381,7 @@ namespace Crow
                                if (ifaceControl [focusedIdx].ProcessMouseWheelChanged (otk_e.DeltaPrecise))
                                        return;
                        }
-                       MouseWheelChanged.Raise (sender, otk_e);
+                       CrowMouseWheel.Raise (sender, otk_e);
         }
 
                protected virtual void Keyboard_KeyDown(object sender, OpenTK.Input.KeyboardKeyEventArgs otk_e)
@@ -348,7 +390,7 @@ namespace Crow
                                if (ifaceControl [focusedIdx].ProcessKeyDown((int)otk_e.Key))
                                        return;
                        }
-                       KeyboardKeyDown.Raise (this, otk_e);
+                       CrowKeyDown.Raise (this, otk_e);
         }
                protected virtual void Keyboard_KeyUp(object sender, OpenTK.Input.KeyboardKeyEventArgs otk_e)
                {
@@ -356,7 +398,7 @@ namespace Crow
                                if (ifaceControl [focusedIdx].ProcessKeyUp((int)otk_e.Key))
                                        return;
                        }
-                       KeyboardKeyUp.Raise (this, otk_e);
+                       CrowKeyUp.Raise (this, otk_e);
                }
                protected virtual void OpenTKGameWindow_KeyPress (object sender, OpenTK.KeyPressEventArgs e)
                {
index 4da65d1ee2e982f40b1ec9fb7d21a7bb0f126fe5..5098e1199b8247aeab3e17550c60867c16526a03 100644 (file)
@@ -162,7 +162,7 @@ namespace Crow
 
                        while (true) {
                                CrowInterface.Update ();
-                               Thread.Sleep (1);
+                               Thread.Sleep (2);
                        }
                }
 
index 0dd1cca6b6f2940a352d6ae29cbc088a2d16b23e..7b26f76bc24e0907e7d0a79a531fd8ca6b855afb 100644 (file)
@@ -24,7 +24,7 @@ using Crow;
 
 namespace Crow
 {
-       public static class Extensions {
+       public static partial class Extensions {
                public static Vector4 ToVector4(this Color c){
                        float[] f = c.floatArray;
                        return new Vector4 (f [0], f [1], f [2], f [3]);
index 6ae99b8910b3d47d6f94d8114176df738982ef8e..f91a982c764a61ee5cdada1a7d9ae8da36fc99ba 100644 (file)
@@ -51,7 +51,7 @@ namespace Crow
                                                GeomSourcePath;
                #region Sources
                protected string _vertSource = @"
-                       #version 330
+                       #version 300 es
                        precision lowp float;
 
                        uniform mat4 mvp;
@@ -68,7 +68,7 @@ namespace Crow
                        }";
 
                protected string _fragSource = @"
-                       #version 330
+                       #version 300 es
                        precision lowp float;
 
                        uniform sampler2D tex;
diff --git a/OpenTK.dll.config b/OpenTK.dll.config
new file mode 100644 (file)
index 0000000..7098d39
--- /dev/null
@@ -0,0 +1,25 @@
+<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>
index 9e8d256736df37a2f97589ea08d312151fe36520..26caf830427036acdba448f179663a587a6eab01 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
-  <package id="Crow.OpenTK" version="0.5.6" targetFramework="net45" />
+  <package id="Crow.OpenTK" version="0.6.0" targetFramework="net45" />
   <package id="OpenTK" version="2.0.0" targetFramework="net45" />
 </packages>
\ No newline at end of file