From 328c6d4eab1127cd9799540f253deda66060b68a Mon Sep 17 00:00:00 2001 From: jpbruyere Date: Fri, 19 Feb 2016 11:06:44 +0100 Subject: [PATCH] free Crow base from OpenTK --- Crow.csproj | 9 --- Crow.sln | 6 ++ CrowGdk/CrowGdk.csproj | 45 ++++++++++++ OTKCrow/OTKCrow.csproj | 57 +++++++++++++++ {src => OTKCrow}/OpenGL/QuadVAO.cs | 3 +- {src => OTKCrow}/OpenGL/Shader.cs | 35 +++++---- {src => OTKCrow}/OpenGL/TexturedShader.cs | 1 - {src => OTKCrow}/OpenGL/VertexArrayObject.cs | 5 +- {src => OTKCrow}/OpenTKGameWindow.cs | 76 +++++++++++--------- Tests/Tests.csproj | 4 ++ src/Colors.cs | 16 ++--- src/GraphicObjects/FileDialog.cs | 6 +- src/GraphicObjects/Window.cs | 23 +++--- src/Input/KeyboardState.cs | 2 +- src/Input/MouseEventArgs.cs | 2 +- src/Input/MouseState.cs | 4 +- src/XCursor.cs | 8 +-- 17 files changed, 203 insertions(+), 99 deletions(-) create mode 100644 CrowGdk/CrowGdk.csproj create mode 100644 OTKCrow/OTKCrow.csproj rename {src => OTKCrow}/OpenGL/QuadVAO.cs (93%) rename {src => OTKCrow}/OpenGL/Shader.cs (92%) rename {src => OTKCrow}/OpenGL/TexturedShader.cs (99%) rename {src => OTKCrow}/OpenGL/VertexArrayObject.cs (97%) rename {src => OTKCrow}/OpenTKGameWindow.cs (97%) diff --git a/Crow.csproj b/Crow.csproj index 2c519d58..2a048cee 100644 --- a/Crow.csproj +++ b/Crow.csproj @@ -65,7 +65,6 @@ - @@ -90,10 +89,6 @@ - - - - @@ -156,9 +151,6 @@ glib-sharp-3.0 - - ..\opentk\Binaries\OpenTK\Release\OpenTK.dll - @@ -179,7 +171,6 @@ - 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 @@ + + + + Debug + Linux_x86 + 8.0.30703 + 2.0 + {90D93DD6-ADBD-4BB6-AE62-20DBF83F7185} + Exe + CrowGdk + CrowGdk + v4.5 + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + false + + + full + true + bin\Release + prompt + 4 + false + + + + + {C2980F9B-4798-4C05-99E2-E174810F7C7B} + Crow + + + + + + + + + \ 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 @@ + + + + Debug + Linux_x86 + 8.0.30703 + 2.0 + {350D4F49-9901-4998-9903-BCA7D48DA58C} + Library + OTKCrow + OTKCrow + 0.4 + v4.5 + + + true + full + false + bin\Debug + DEBUG;MEASURE_TIME + prompt + 4 + false + + + full + true + bin\Release + prompt + 4 + false + + + + + ..\..\opentk\Binaries\OpenTK\Release\OpenTK.dll + + + + + + + + + + + + + + + + + {C2980F9B-4798-4C05-99E2-E174810F7C7B} + Crow + + + \ No newline at end of file diff --git a/src/OpenGL/QuadVAO.cs b/OTKCrow/OpenGL/QuadVAO.cs similarity index 93% rename from src/OpenGL/QuadVAO.cs rename to 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 similarity index 92% rename from src/OpenGL/Shader.cs rename to 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 similarity index 99% rename from src/OpenGL/TexturedShader.cs rename to 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 similarity index 97% rename from src/OpenGL/VertexArrayObject.cs rename to 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 similarity index 97% rename from src/OpenTKGameWindow.cs rename to 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 GraphicObjects = new List(); @@ -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 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(Keyboard_KeyDown); Mouse.WheelChanged += new EventHandler(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 @@ {C2980F9B-4798-4C05-99E2-E174810F7C7B} Crow + + {350D4F49-9901-4998-9903-BCA7D48DA58C} + OTKCrow + 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); +// } } } -- 2.47.3