aboutsummaryrefslogtreecommitdiffstatsci
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2016-02-19 11:06:44 +0100
committerjpbruyere <jp.bruyere@hotmail.com>2016-03-01 05:06:16 +0100
commit328c6d4eab1127cd9799540f253deda66060b68a (patch)
treeeeb1c888ed94c444d673f9f827b4df447e249ea4
parent2cb0e7507022aa0449c1af264230784039b24e15 (diff)
free Crow base from OpenTK
-rw-r--r--Crow.csproj9
-rw-r--r--Crow.sln6
-rw-r--r--CrowGdk/CrowGdk.csproj45
-rw-r--r--OTKCrow/OTKCrow.csproj57
-rw-r--r--OTKCrow/OpenGL/QuadVAO.cs (renamed from src/OpenGL/QuadVAO.cs)3
-rw-r--r--OTKCrow/OpenGL/Shader.cs (renamed from src/OpenGL/Shader.cs)35
-rw-r--r--OTKCrow/OpenGL/TexturedShader.cs (renamed from src/OpenGL/TexturedShader.cs)1
-rw-r--r--OTKCrow/OpenGL/VertexArrayObject.cs (renamed from src/OpenGL/VertexArrayObject.cs)5
-rw-r--r--OTKCrow/OpenTKGameWindow.cs (renamed from src/OpenTKGameWindow.cs)76
-rw-r--r--Tests/Tests.csproj4
-rw-r--r--src/Colors.cs16
-rw-r--r--src/GraphicObjects/FileDialog.cs6
-rw-r--r--src/GraphicObjects/Window.cs23
-rw-r--r--src/Input/KeyboardState.cs2
-rw-r--r--src/Input/MouseEventArgs.cs2
-rw-r--r--src/Input/MouseState.cs4
-rw-r--r--src/XCursor.cs8
17 files changed, 203 insertions, 99 deletions
diff --git a/Crow.csproj b/Crow.csproj
index 2c519d58..2a048cee 100644
--- a/Crow.csproj
+++ b/Crow.csproj
@@ -65,7 +65,6 @@
<Compile Include="src\Rectangle.cs" />
<Compile Include="src\Rectangles.cs" />
<Compile Include="src\Size.cs" />
- <Compile Include="src\OpenTKGameWindow.cs" />
<Compile Include="src\GraphicObjects\GraphicObject.cs" />
<Compile Include="src\GraphicObjects\Container.cs" />
<Compile Include="src\GraphicObjects\Group.cs" />
@@ -90,10 +89,6 @@
<Compile Include="src\GraphicObjects\AnalogMeter.cs" />
<Compile Include="src\GraphicObjects\Border.cs" />
<Compile Include="src\Font.cs" />
- <Compile Include="src\OpenGL\QuadVAO.cs" />
- <Compile Include="src\OpenGL\Shader.cs" />
- <Compile Include="src\OpenGL\TexturedShader.cs" />
- <Compile Include="src\OpenGL\VertexArrayObject.cs" />
<Compile Include="src\GraphicObjects\Window.cs" />
<Compile Include="src\GraphicObjects\IGOLibHost.cs" />
<Compile Include="src\GraphicObjects\ListBox.cs" />
@@ -156,9 +151,6 @@
<Package>glib-sharp-3.0</Package>
</Reference>
<Reference Include="Microsoft.CSharp" />
- <Reference Include="OpenTK">
- <HintPath>..\opentk\Binaries\OpenTK\Release\OpenTK.dll</HintPath>
- </Reference>
<Reference Include="Mono.Cairo" />
<Reference Include="rsvg2-sharp, Version=2.18.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
<Reference Include="System.Drawing" />
@@ -179,7 +171,6 @@
<Folder Include="Images\" />
<Folder Include="Images\Icons\" />
<Folder Include="src\CompilerServices\" />
- <Folder Include="src\OpenGL\" />
<Folder Include="src\Fill\" />
<Folder Include="Styles\" />
<Folder Include="src\Input\" />
diff --git a/Crow.sln b/Crow.sln
index 27ea466c..1498135b 100644
--- a/Crow.sln
+++ b/Crow.sln
@@ -11,6 +11,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoDevelop.Diagram", "..\M
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
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Linux_x86 = Debug|Linux_x86
@@ -19,6 +21,10 @@ Global
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{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}.Debug|Linux_x86.ActiveCfg = Debug|Linux_x86
+ {350D4F49-9901-4998-9903-BCA7D48DA58C}.Debug|Linux_x86.Build.0 = Debug|Linux_x86
+ {350D4F49-9901-4998-9903-BCA7D48DA58C}.Release|Linux_x86.ActiveCfg = Release|Linux_x86
+ {350D4F49-9901-4998-9903-BCA7D48DA58C}.Release|Linux_x86.Build.0 = Release|Linux_x86
{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|Linux_x86.ActiveCfg = Release|Any CPU
diff --git a/CrowGdk/CrowGdk.csproj b/CrowGdk/CrowGdk.csproj
new file mode 100644
index 00000000..57a3f0cf
--- /dev/null
+++ b/CrowGdk/CrowGdk.csproj
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<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>
+ <ProductVersion>8.0.30703</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{90D93DD6-ADBD-4BB6-AE62-20DBF83F7185}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <RootNamespace>CrowGdk</RootNamespace>
+ <AssemblyName>CrowGdk</AssemblyName>
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|Linux_x86' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug</OutputPath>
+ <DefineConstants>DEBUG;</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <ConsolePause>false</ConsolePause>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|Linux_x86' ">
+ <DebugType>full</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release</OutputPath>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <ConsolePause>false</ConsolePause>
+ </PropertyGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <ItemGroup>
+ <ProjectReference Include="..\Crow.csproj">
+ <Project>{C2980F9B-4798-4C05-99E2-E174810F7C7B}</Project>
+ <Name>Crow</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Drawing" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/OTKCrow/OTKCrow.csproj b/OTKCrow/OTKCrow.csproj
new file mode 100644
index 00000000..6fc4f854
--- /dev/null
+++ b/OTKCrow/OTKCrow.csproj
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="utf-8"?>
+<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>
+ <ProductVersion>8.0.30703</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{350D4F49-9901-4998-9903-BCA7D48DA58C}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <RootNamespace>OTKCrow</RootNamespace>
+ <AssemblyName>OTKCrow</AssemblyName>
+ <ReleaseVersion>0.4</ReleaseVersion>
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|Linux_x86' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug</OutputPath>
+ <DefineConstants>DEBUG;MEASURE_TIME</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <ConsolePause>false</ConsolePause>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|Linux_x86' ">
+ <DebugType>full</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release</OutputPath>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <ConsolePause>false</ConsolePause>
+ </PropertyGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <ItemGroup>
+ <Reference Include="OpenTK">
+ <HintPath>..\..\opentk\Binaries\OpenTK\Release\OpenTK.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ <Reference Include="Mono.Cairo" />
+ <Reference Include="System.Drawing" />
+ </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" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\Crow.csproj">
+ <Project>{C2980F9B-4798-4C05-99E2-E174810F7C7B}</Project>
+ <Name>Crow</Name>
+ </ProjectReference>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/src/OpenGL/QuadVAO.cs b/OTKCrow/OpenGL/QuadVAO.cs
index 08ef680e..36231cc1 100644
--- a/src/OpenGL/QuadVAO.cs
+++ b/OTKCrow/OpenGL/QuadVAO.cs
@@ -22,7 +22,7 @@ namespace Crow
{
}
- public QuadVAO (float x, float y, float width, float height,
+ 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),
@@ -42,4 +42,3 @@ namespace Crow
}
}
}
-
diff --git a/src/OpenGL/Shader.cs b/OTKCrow/OpenGL/Shader.cs
index f13000d7..b4603ad8 100644
--- a/src/OpenGL/Shader.cs
+++ b/OTKCrow/OpenGL/Shader.cs
@@ -19,14 +19,14 @@ namespace Crow
Stream s = tryGetStreamForResource (vertResId);
if (s != null) {
- using (StreamReader sr = new StreamReader (s)) {
+ using (StreamReader sr = new StreamReader (s)) {
vertSource = sr.ReadToEnd ();
}
}
s = tryGetStreamForResource (fragResId);
if (s != null) {
- using (StreamReader sr = new StreamReader (s)) {
+ using (StreamReader sr = new StreamReader (s)) {
fragSource = sr.ReadToEnd ();
}
}
@@ -36,7 +36,7 @@ namespace Crow
Stream tryGetStreamForResource(string resId){
if (string.IsNullOrEmpty (resId))
return null;
-
+
Stream s = Assembly.GetEntryAssembly ().
GetManifestResourceStream (resId);
return s == null ?
@@ -61,7 +61,7 @@ namespace Crow
in vec2 in_tex;
out vec2 texCoord;
-
+
void main(void)
{
@@ -84,7 +84,7 @@ namespace Crow
out_frag_color = texture( tex, texCoord);
}";
string _geomSource = @"";
-// #version 330
+// #version 330
// layout(triangles) in;
// layout(triangle_strip, max_vertices=3) out;
// void main()
@@ -99,14 +99,14 @@ namespace Crow
#endregion
#region Private and protected fields
- protected int vsId, fsId, gsId, pgmId,
+ protected int vsId, fsId, gsId, pgmId,
modelViewLocation,
modelLocation,
projectionLocation,
- normalLocation,
+ normalLocation,
colorLocation;
- Matrix4 projectionMat = Matrix4.Identity,
+ Matrix4 projectionMat = Matrix4.Identity,
modelMat = Matrix4.Identity,
modelViewMat = Matrix4.Identity;
Vector4 color = new Vector4(1,1,1,1);
@@ -120,14 +120,14 @@ namespace Crow
get { return _vertSource;}
set { _vertSource = value; }
}
- public virtual string fragSource
+ public virtual string fragSource
{
get { return _fragSource;}
set { _fragSource = value; }
}
public virtual string geomSource
- {
- get { return _geomSource; }
+ {
+ get { return _geomSource; }
set { _geomSource = value; }
}
@@ -183,7 +183,7 @@ namespace Crow
if (!string.IsNullOrEmpty(geomSource))
{
gsId = GL.CreateShader(ShaderType.GeometryShader);
- compileShader(gsId,geomSource);
+ compileShader(gsId,geomSource);
}
if (vsId != 0)
@@ -212,7 +212,7 @@ namespace Crow
Debug.WriteLine ("Validation:");
Debug.WriteLine (info);
}
-
+
GL.UseProgram (pgmId);
GetUniformLocations ();
@@ -223,7 +223,7 @@ namespace Crow
protected virtual void BindVertexAttributes()
{
- GL.BindAttribLocation(pgmId, 0, "in_position");
+ GL.BindAttribLocation(pgmId, 0, "in_position");
GL.BindAttribLocation(pgmId, 1, "in_tex");
}
protected virtual void GetUniformLocations()
@@ -243,7 +243,7 @@ namespace Crow
GL.UseProgram (pgmId);
GL.UniformMatrix4(projectionLocation, false, ref projectionMat);
- GL.UniformMatrix4 (modelLocation, false, ref modelMat);
+ GL.UniformMatrix4 (modelLocation, false, ref modelMat);
GL.UniformMatrix4 (modelViewLocation, false, ref modelViewMat);
updateNormalMatrix ();
GL.Uniform4 (colorLocation, color);
@@ -287,8 +287,8 @@ namespace Crow
Debug.WriteLine("Compile Error!");
Debug.WriteLine(source);
}
- }
-
+ }
+
#region IDisposable implementation
public virtual void Dispose ()
{
@@ -305,4 +305,3 @@ namespace Crow
#endregion
}
}
-
diff --git a/src/OpenGL/TexturedShader.cs b/OTKCrow/OpenGL/TexturedShader.cs
index c8f44c26..9e29b690 100644
--- a/src/OpenGL/TexturedShader.cs
+++ b/OTKCrow/OpenGL/TexturedShader.cs
@@ -39,4 +39,3 @@ namespace Crow
}
}
}
-
diff --git a/src/OpenGL/VertexArrayObject.cs b/OTKCrow/OpenGL/VertexArrayObject.cs
index c4fde5b4..c7b685d9 100644
--- a/src/OpenGL/VertexArrayObject.cs
+++ b/OTKCrow/OpenGL/VertexArrayObject.cs
@@ -74,11 +74,11 @@ namespace Crow
GL.BindVertexArray(0);
}
-
+
public void Render(PrimitiveType _primitiveType){
GL.BindVertexArray(vaoHandle);
GL.DrawElements(_primitiveType, indicesVboData.Length,
- DrawElementsType.UnsignedInt, IntPtr.Zero);
+ DrawElementsType.UnsignedInt, IntPtr.Zero);
GL.BindVertexArray (0);
}
@@ -91,4 +91,3 @@ namespace Crow
#endregion
}
}
-
diff --git a/src/OpenTKGameWindow.cs b/OTKCrow/OpenTKGameWindow.cs
index fc17eae6..111163b4 100644
--- a/src/OpenTKGameWindow.cs
+++ b/OTKCrow/OpenTKGameWindow.cs
@@ -40,7 +40,7 @@ namespace Crow
// 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),
+ : base(_width, _height, new OpenTK.Graphics.GraphicsMode(32, 24, 0, 1),
_title,GameWindowFlags.Default,DisplayDevice.GetDisplay(DisplayIndex.Second),
3,3,OpenTK.Graphics.GraphicsContextFlags.Debug)
// public OpenTKGameWindow(int _width, int _height, string _title="golib")
@@ -57,7 +57,7 @@ namespace Crow
XCursor.SE = XCursorFile.Load("#Crow.Images.Icons.Cursors.bottom_right_corner").Cursors[0];
XCursor.H = XCursorFile.Load("#Crow.Images.Icons.Cursors.sb_h_double_arrow").Cursors[0];
XCursor.V = XCursorFile.Load("#Crow.Images.Icons.Cursors.sb_v_double_arrow").Cursors[0];
- }
+ }
#endregion
public List<GraphicObject> GraphicObjects = new List<GraphicObject>();
@@ -74,7 +74,13 @@ namespace Crow
set { _redrawClip = value; }
}
public XCursor MouseCursor {
- set { Cursor = value; }
+ set {
+ if (value == null) {
+ Cursor = null;
+ return;
+ }
+ Cursor = new MouseCursor
+ ((int)value.Xhot, (int)value.Yhot, (int)value.Width, (int)value.Height,value.data);; }
}
public List<GraphicObject> gobjsToRedraw {
get { return _gobjsToRedraw; }
@@ -108,17 +114,17 @@ namespace Crow
}
#region focus
- GraphicObject _activeWidget; //button is pressed on widget
+ GraphicObject _activeWidget; //button is pressed on widget
GraphicObject _hoverWidget; //mouse is over
- GraphicObject _focusedWidget; //has keyboard (or other perif) focus
+ GraphicObject _focusedWidget; //has keyboard (or other perif) focus
public GraphicObject activeWidget
{
get { return _activeWidget; }
- set
- {
+ set
+ {
if (_activeWidget == value)
- return;
+ return;
if (_activeWidget != null)
_activeWidget.IsActive = false;
@@ -197,7 +203,7 @@ namespace Crow
int[] viewport = new int[4];
void createContext()
- {
+ {
createOpenGLSurface ();
if (uiQuad != null)
@@ -205,8 +211,8 @@ namespace Crow
uiQuad = new QuadVAO (0, 0, ClientRectangle.Width, ClientRectangle.Height, 0, 1, 1, -1);
uiQuad2 = new QuadVAO (0, 0, ClientRectangle.Width, ClientRectangle.Height, 0, 0, 1, 1);
- shader.ProjectionMatrix = Matrix4.CreateOrthographicOffCenter
- (0, ClientRectangle.Width, ClientRectangle.Height, 0, 0, 1);
+ shader.ProjectionMatrix = Matrix4.CreateOrthographicOffCenter
+ (0, ClientRectangle.Width, ClientRectangle.Height, 0, 0, 1);
clipping.AddRectangle (ClientRectangle);
}
@@ -225,7 +231,7 @@ namespace Crow
GL.ActiveTexture (TextureUnit.Texture0);
GL.BindTexture(TextureTarget.Texture2D, texID);
- GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba,
+ GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba,
ClientRectangle.Width, ClientRectangle.Height, 0,
OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, bmp);
@@ -288,7 +294,7 @@ namespace Crow
layoutTime.Reset ();
guTime.Reset ();
drawingTime.Reset ();
- updateTime.Restart ();
+ updateTime.Restart ();
#endif
GraphicObject[] invGOList = new GraphicObject[GraphicObjects.Count];
@@ -342,7 +348,7 @@ namespace Crow
ctx.Save ();
p.Paint (ref ctx);
-
+
ctx.Restore ();
}
@@ -387,9 +393,9 @@ namespace Crow
// Debug.WriteLine("UPDATE: {0} ticks \t, {1} ms",
// updateTime.ElapsedTicks,
// updateTime.ElapsedMilliseconds);
- }
+ }
#endregion
-
+
#region loading
public GraphicObject LoadInterface (string path)
{
@@ -409,7 +415,7 @@ namespace Crow
#region Game win overrides
protected override void OnUpdateFrame(FrameEventArgs e)
- {
+ {
base.OnUpdateFrame(e);
update ();
}
@@ -427,8 +433,8 @@ namespace Crow
SwapBuffers ();
}
protected override void OnLoad(EventArgs e)
- {
- base.OnLoad(e);
+ {
+ base.OnLoad(e);
Keyboard.KeyDown += new EventHandler<OpenTK.Input.KeyboardKeyEventArgs>(Keyboard_KeyDown);
Mouse.WheelChanged += new EventHandler<OpenTK.Input.MouseWheelEventArgs>(Mouse_WheelChanged);
@@ -456,7 +462,7 @@ namespace Crow
}
#endregion
- #region Mouse Handling
+ #region Mouse Handling
void update_mouseButtonStates(ref MouseState e, OpenTK.Input.MouseState otk_e){
for (int i = 0; i < MouseState.MaxButtons; i++) {
if (otk_e.IsButtonDown ((OpenTK.Input.MouseButton)i))
@@ -464,7 +470,7 @@ namespace Crow
}
}
void Mouse_Move(object sender, OpenTK.Input.MouseMoveEventArgs otk_e)
- {
+ {
MouseMoveEventArgs e = new MouseMoveEventArgs (otk_e.X, otk_e.Y, otk_e.XDelta, otk_e.YDelta);
MouseState ms = e.Mouse;
update_mouseButtonStates (ref ms, otk_e.Mouse);
@@ -475,7 +481,7 @@ namespace Crow
if (_activeWidget.HostContainer == null) {
activeWidget = null;
} else {
-
+
//send move evt even if mouse move outside bounds
_activeWidget.onMouseMove (this, e);
return;
@@ -506,8 +512,8 @@ namespace Crow
i++;
}
}
-
-
+
+
if (hoverWidget.MouseIsIn (e.Position)) {
hoverWidget.checkHoverWidget (e);
return;
@@ -537,9 +543,9 @@ namespace Crow
}
hoverWidget = null;
MouseMove.Raise (this, otk_e);
- }
+ }
void Mouse_ButtonUp(object sender, OpenTK.Input.MouseButtonEventArgs otk_e)
- {
+ {
MouseButtonEventArgs e = new MouseButtonEventArgs (otk_e.X, otk_e.Y, (Crow.MouseButton)otk_e.Button, otk_e.IsPressed);
MouseState ms = e.Mouse;
update_mouseButtonStates (ref ms, otk_e.Mouse);
@@ -549,7 +555,7 @@ namespace Crow
MouseButtonUp.Raise (this, otk_e);
return;
}
-
+
if (mouseRepeatThread != null) {
mouseRepeatOn = false;
mouseRepeatThread.Abort();
@@ -558,7 +564,7 @@ namespace Crow
_activeWidget.onMouseUp (this, e);
activeWidget = null;
- }
+ }
void Mouse_ButtonDown(object sender, OpenTK.Input.MouseButtonEventArgs otk_e)
{
MouseButtonEventArgs e = new MouseButtonEventArgs (otk_e.X, otk_e.Y, (Crow.MouseButton)otk_e.Button, otk_e.IsPressed);
@@ -579,9 +585,9 @@ namespace Crow
return;
mouseRepeatThread = new Thread (mouseRepeatThreadFunc);
mouseRepeatThread.Start ();
- }
+ }
void Mouse_WheelChanged(object sender, OpenTK.Input.MouseWheelEventArgs otk_e)
- {
+ {
MouseWheelEventArgs e = new MouseWheelEventArgs (otk_e.X, otk_e.Y, otk_e.Value, otk_e.Delta);
MouseState ms = e.Mouse;
update_mouseButtonStates (ref ms, otk_e.Mouse);
@@ -592,7 +598,7 @@ namespace Crow
return;
}
hoverWidget.onMouseWheel (this, e);
- }
+ }
volatile bool mouseRepeatOn;
volatile int mouseRepeatCount;
@@ -609,7 +615,7 @@ namespace Crow
}
#endregion
- #region keyboard Handling
+ #region keyboard Handling
KeyboardState Keyboad = new KeyboardState ();
void Keyboard_KeyDown(object sender, OpenTK.Input.KeyboardKeyEventArgs otk_e)
{
@@ -620,8 +626,8 @@ namespace Crow
Keyboad.SetKeyState ((Crow.Key)otk_e.Key, true);
KeyboardKeyEventArgs e = new KeyboardKeyEventArgs((Crow.Key)otk_e.Key, otk_e.IsRepeat,Keyboad);
_focusedWidget.onKeyDown (sender, e);
- }
- #endregion
+ }
+ #endregion
#region ILayoutable implementation
public void RegisterClip(Rectangle r){
@@ -634,7 +640,7 @@ namespace Crow
}
public LayoutingType RegisteredLayoutings {
get { return LayoutingType.None; }
- set { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
}
public void RegisterForLayouting (LayoutingType layoutType) { throw new NotImplementedException (); }
public bool UpdateLayout (LayoutingType layoutType) { throw new NotImplementedException (); }
diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj
index b7c32c01..d913c6ee 100644
--- a/Tests/Tests.csproj
+++ b/Tests/Tests.csproj
@@ -269,5 +269,9 @@
<Project>{C2980F9B-4798-4C05-99E2-E174810F7C7B}</Project>
<Name>Crow</Name>
</ProjectReference>
+ <ProjectReference Include="..\OTKCrow\OTKCrow.csproj">
+ <Project>{350D4F49-9901-4998-9903-BCA7D48DA58C}</Project>
+ <Name>OTKCrow</Name>
+ </ProjectReference>
</ItemGroup>
</Project>
diff --git a/src/Colors.cs b/src/Colors.cs
index d46b71a1..4cb8cd5c 100644
--- a/src/Colors.cs
+++ b/src/Colors.cs
@@ -70,14 +70,14 @@ namespace Crow
double.Parse(c[3]));
}
- public static implicit operator OpenTK.Vector4(Color c)
- {
- return new OpenTK.Vector4 ((float)c.R, (float)c.G, (float)c.B, (float)c.A);
- }
- public static implicit operator Color(OpenTK.Vector4 v)
- {
- return new Color (v.X, v.Y, v.Z, v.W);
- }
+// public static implicit operator OpenTK.Vector4(Color c)
+// {
+// return new OpenTK.Vector4 ((float)c.R, (float)c.G, (float)c.B, (float)c.A);
+// }
+// public static implicit operator Color(OpenTK.Vector4 v)
+// {
+// return new Color (v.X, v.Y, v.Z, v.W);
+// }
public static implicit operator Fill(Color c){
return new SolidColor (c) as Fill;
}
diff --git a/src/GraphicObjects/FileDialog.cs b/src/GraphicObjects/FileDialog.cs
index b1c93119..da85580a 100644
--- a/src/GraphicObjects/FileDialog.cs
+++ b/src/GraphicObjects/FileDialog.cs
@@ -89,7 +89,7 @@ namespace Crow
}
public void Show(){
- OpenTKGameWindow.currentWindow.AddWidget(window);
+ //.AddWidget(window);
}
void OnSelectedItemChanged (object sender, SelectionChangeEventArgs e)
@@ -104,8 +104,8 @@ namespace Crow
{
selectedFile = e.NewValue as FileInfo;
}
- void onFileSelect(object sender, OpenTK.Input.MouseButtonEventArgs e){
- OpenTKGameWindow.currentWindow.DeleteWidget(window);
+ void onFileSelect(object sender, MouseButtonEventArgs e){
+ //OpenTKGameWindow.currentWindow.DeleteWidget(window);
}
}
public class DirContainer: IValueChange
diff --git a/src/GraphicObjects/Window.cs b/src/GraphicObjects/Window.cs
index 757ee080..617670fc 100644
--- a/src/GraphicObjects/Window.cs
+++ b/src/GraphicObjects/Window.cs
@@ -83,7 +83,7 @@ namespace Crow
{
base.onMouseMove (sender, e);
- OpenTKGameWindow otkgw = HostContainer as OpenTKGameWindow;
+ IGOLibHost otkgw = HostContainer;
if (e.Mouse.IsButtonDown (MouseButton.Left)) {
if (!HasFocus)
@@ -176,31 +176,31 @@ namespace Crow
if (currentDirection != lastDir) {
switch (currentDirection) {
case Direction.None:
- otkgw.Cursor = XCursor.Default;
+ otkgw.MouseCursor = XCursor.Default;
break;
case Direction.N:
- otkgw.Cursor = XCursor.V;
+ otkgw.MouseCursor = XCursor.V;
break;
case Direction.S:
- otkgw.Cursor = XCursor.V;
+ otkgw.MouseCursor = XCursor.V;
break;
case Direction.E:
- otkgw.Cursor = XCursor.H;
+ otkgw.MouseCursor = XCursor.H;
break;
case Direction.W:
- otkgw.Cursor = XCursor.H;
+ otkgw.MouseCursor = XCursor.H;
break;
case Direction.NW:
- otkgw.Cursor = XCursor.NW;
+ otkgw.MouseCursor = XCursor.NW;
break;
case Direction.NE:
- otkgw.Cursor = XCursor.NE;
+ otkgw.MouseCursor = XCursor.NE;
break;
case Direction.SW:
- otkgw.Cursor = XCursor.SW;
+ otkgw.MouseCursor = XCursor.SW;
break;
case Direction.SE:
- otkgw.Cursor = XCursor.SE;
+ otkgw.MouseCursor = XCursor.SE;
break;
}
}
@@ -210,8 +210,7 @@ namespace Crow
{
base.onMouseLeave (sender, e);
currentDirection = Direction.None;
- OpenTKGameWindow otkgw = HostContainer as OpenTKGameWindow;
- otkgw.Cursor = XCursor.Default;
+ HostContainer.MouseCursor = XCursor.Default;
}
protected override void loadTemplate(GraphicObject template = null)
diff --git a/src/Input/KeyboardState.cs b/src/Input/KeyboardState.cs
index ba392cac..283b4a69 100644
--- a/src/Input/KeyboardState.cs
+++ b/src/Input/KeyboardState.cs
@@ -210,7 +210,7 @@ namespace Crow
#region Internal Members
- internal void SetKeyState(Key key, bool down)
+ public void SetKeyState(Key key, bool down)
{
if (down)
{
diff --git a/src/Input/MouseEventArgs.cs b/src/Input/MouseEventArgs.cs
index 758a5a69..e1f7ae2a 100644
--- a/src/Input/MouseEventArgs.cs
+++ b/src/Input/MouseEventArgs.cs
@@ -147,7 +147,7 @@ namespace Crow
public MouseState Mouse
{
get { return state; }
- internal set { state = value; }
+ set { state = value; }
}
#endregion
diff --git a/src/Input/MouseState.cs b/src/Input/MouseState.cs
index c645062a..e0438fc7 100644
--- a/src/Input/MouseState.cs
+++ b/src/Input/MouseState.cs
@@ -38,7 +38,7 @@ namespace Crow
{
#region Fields
- internal const int MaxButtons = 16; // we are storing in an ushort
+ public const int MaxButtons = 16; // we are storing in an ushort
Point position;
MouseScroll scroll;
ushort buttons;
@@ -285,7 +285,7 @@ namespace Crow
return (buttons & (1 << offset)) != 0;
}
- internal void EnableBit(int offset)
+ public void EnableBit(int offset)
{
ValidateOffset(offset);
buttons |= unchecked((ushort)(1 << offset));
diff --git a/src/XCursor.cs b/src/XCursor.cs
index d24b1687..8897753d 100644
--- a/src/XCursor.cs
+++ b/src/XCursor.cs
@@ -136,10 +136,10 @@ namespace Crow
public XCursor ()
{
}
- public static implicit operator MouseCursor(XCursor xc)
- {
- return new MouseCursor((int)xc.Xhot, (int)xc.Yhot, (int)xc.Width, (int)xc.Height,xc.data);
- }
+// public static implicit operator MouseCursor(XCursor xc)
+// {
+// return new MouseCursor((int)xc.Xhot, (int)xc.Yhot, (int)xc.Width, (int)xc.Height,xc.data);
+// }
}
}