From a2151156e8e5aa7deb5cc5e7eb5d6f416599217e Mon Sep 17 00:00:00 2001 From: jp Date: Fri, 1 Apr 2016 09:33:01 +0200 Subject: [PATCH] several changes to merge later --- OTKCrow/OpenTKGameWindow.cs | 11 ++++++++++- Templates/Button.crow | 4 ++-- src/GraphicObjects/Label.cs | 2 +- src/GraphicObjects/Window.cs | 22 +++++++++------------- src/Interface.cs | 2 +- 5 files changed, 23 insertions(+), 18 deletions(-) diff --git a/OTKCrow/OpenTKGameWindow.cs b/OTKCrow/OpenTKGameWindow.cs index b11c2ce0..a073d695 100644 --- a/OTKCrow/OpenTKGameWindow.cs +++ b/OTKCrow/OpenTKGameWindow.cs @@ -198,8 +198,12 @@ namespace Crow void OpenGLDraw() { GL.GetInteger (GetPName.Viewport, viewport); - GL.Viewport (0, 0, ClientRectangle.Width, ClientRectangle.Height); + bool blend = GL.GetBoolean (GetPName.Blend); + GL.Enable (EnableCap.Blend); + GL.Viewport (0, 0, ClientRectangle.Width, ClientRectangle.Height); + GL.DepthMask (false); + GL.Disable (EnableCap.DepthTest); shader.Enable (); lock (CrowInterface.RenderMutex) { if (CrowInterface.IsDirty) { @@ -215,7 +219,12 @@ namespace Crow GL.BindTexture(TextureTarget.Texture2D, 0); shader.Disable (); + if (!blend) + GL.Disable (EnableCap.Blend); GL.Viewport (viewport [0], viewport [1], viewport [2], viewport [3]); + + GL.DepthMask (true); + GL.Enable (EnableCap.DepthTest); } #endregion diff --git a/Templates/Button.crow b/Templates/Button.crow index 76d5dd8e..7d128f75 100755 --- a/Templates/Button.crow +++ b/Templates/Button.crow @@ -2,10 +2,10 @@ - \ No newline at end of file diff --git a/src/GraphicObjects/Label.cs b/src/GraphicObjects/Label.cs index ebc18f76..64c37ff8 100644 --- a/src/GraphicObjects/Label.cs +++ b/src/GraphicObjects/Label.cs @@ -119,7 +119,7 @@ namespace Crow } set { - if (_text == value) + if (string.Equals (value, _text, StringComparison.Ordinal)) return; _text = value; diff --git a/src/GraphicObjects/Window.cs b/src/GraphicObjects/Window.cs index 429d4269..94fe40d3 100644 --- a/src/GraphicObjects/Window.cs +++ b/src/GraphicObjects/Window.cs @@ -28,21 +28,14 @@ namespace Crow Container _contentContainer; Direction currentDirection = Direction.None; + public event EventHandler Closing; + #region CTOR public Window () : base() { } #endregion - #region GraphicObject overrides - [XmlAttributeAttribute()][DefaultValue(true)]//overiden to get default to true - public override bool Focusable - { - get { return base.Focusable; } - set { base.Focusable = value; } - } - #endregion - public override GraphicObject Content { get { return _contentContainer == null ? null : _contentContainer.Child; @@ -221,10 +214,13 @@ namespace Crow protected void butQuitPress (object sender, MouseButtonEventArgs e) { - ILayoutable parent = (sender as GraphicObject).Parent; - while(!(parent is Window)) - parent = parent.Parent; - Interface.CurrentInterface.DeleteWidget (parent as GraphicObject); + close (); + } + + void close(){ + Closing.Raise (this, null); + + Interface.CurrentInterface.DeleteWidget (this); } public override void ResolveBindings () diff --git a/src/Interface.cs b/src/Interface.cs index 4cb94e76..05548587 100644 --- a/src/Interface.cs +++ b/src/Interface.cs @@ -224,6 +224,7 @@ namespace Crow lock (UpdateMutex) { GraphicObject tmp = Interface.Load (path, this); AddWidget (tmp); + return tmp; } } @@ -457,7 +458,6 @@ namespace Crow { g.Parent = this; GraphicObjects.Insert (0, g); - g.RegisterForLayouting (LayoutingType.Sizing); } public void DeleteWidget(GraphicObject g) -- 2.47.3