diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2015-09-09 10:43:24 +0200 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2015-09-09 10:43:24 +0200 |
| commit | dcf100def542956b86b1d5b46515e7d6607d6b96 (patch) | |
| tree | fae136c2527b731d4ab13ea651bf709afebd518b /src | |
| parent | c26d9c5abe0228cacb316efa10bcb433fae48e40 (diff) | |
* GOLib.csproj:
* XCursor.cs:
* OpenTKGameWindow.cs:
* GOLIBTest_Window.cs:
* Window.cs:
* testWindow.goml: Horizontal and vertical Resizing
* Interface.cs: Border threshold
Diffstat (limited to 'src')
| -rw-r--r-- | src/GraphicObjects/Window.cs | 60 | ||||
| -rw-r--r-- | src/Interface.cs | 3 | ||||
| -rwxr-xr-x | src/OpenTKGameWindow.cs | 3 | ||||
| -rw-r--r-- | src/XCursor.cs | 4 |
4 files changed, 40 insertions, 30 deletions
diff --git a/src/GraphicObjects/Window.cs b/src/GraphicObjects/Window.cs index c1a117eb..0c275f7a 100644 --- a/src/GraphicObjects/Window.cs +++ b/src/GraphicObjects/Window.cs @@ -33,12 +33,7 @@ namespace go public Window () : base() { } - - void Window_MouseMove (object sender, OpenTK.Input.MouseMoveEventArgs e) - { - - - } + enum Direction { None, @@ -49,7 +44,7 @@ namespace go NW, NE, SW, - SE + SE, } Direction currentDirection = Direction.None; @@ -59,41 +54,46 @@ namespace go OpenTKGameWindow otkgw = TopContainer as OpenTKGameWindow; - int borderLim = 5; - - - - if (TopContainer.activeWidget == null) { + if (otkgw.activeWidget == null) { Direction lastDir = currentDirection; - if ((e.Position - this.Slot.TopLeft).Length < borderLim) - currentDirection = Direction.NW; - else if ((e.Position - this.Slot.TopRight).Length < borderLim) - currentDirection = Direction.NE; - else if ((e.Position - this.Slot.BottomLeft).Length < borderLim) - currentDirection = Direction.SW; - else if ((e.Position - this.Slot.BottomRight).Length < borderLim) - currentDirection = Direction.SE; + if (Math.Abs (e.Position.Y - this.Slot.Y) < Interface.BorderThreshold) { + if (Math.Abs (e.Position.X - this.Slot.X) < Interface.BorderThreshold) + currentDirection = Direction.NW; + else if (Math.Abs (e.Position.X - this.Slot.Right) < Interface.BorderThreshold) + currentDirection = Direction.NE; + else + currentDirection = Direction.N; + } else if (Math.Abs (e.Position.Y - this.Slot.Bottom) < Interface.BorderThreshold) { + if (Math.Abs (e.Position.X - this.Slot.X) < Interface.BorderThreshold) + currentDirection = Direction.SW; + else if (Math.Abs (e.Position.X - this.Slot.Right) < Interface.BorderThreshold) + currentDirection = Direction.SE; + else + currentDirection = Direction.S; + } else if (Math.Abs (e.Position.X - this.Slot.X) < Interface.BorderThreshold) + currentDirection = Direction.W; + else if (Math.Abs (e.Position.X - this.Slot.Right) < Interface.BorderThreshold) + currentDirection = Direction.E; else currentDirection = Direction.None; - if (currentDirection != lastDir) { switch (currentDirection) { case Direction.None: otkgw.Cursor = XCursor.Default; break; case Direction.N: - otkgw.Cursor = XCursor.Cross; + otkgw.Cursor = XCursor.V; break; case Direction.S: - otkgw.Cursor = XCursor.Cross; + otkgw.Cursor = XCursor.V; break; case Direction.E: - otkgw.Cursor = XCursor.Cross; + otkgw.Cursor = XCursor.H; break; case Direction.W: - otkgw.Cursor = XCursor.Cross; + otkgw.Cursor = XCursor.H; break; case Direction.NW: otkgw.Cursor = XCursor.NW; @@ -123,12 +123,18 @@ namespace go this.Top += e.YDelta; break; case Direction.N: + this.Top += e.YDelta; + this.Height -= e.YDelta; break; case Direction.S: - break; - case Direction.E: + this.Height += e.YDelta; break; case Direction.W: + this.Left += e.XDelta; + this.Width -= e.XDelta; + break; + case Direction.E: + this.Width += e.XDelta; break; case Direction.NW: this.Left += e.XDelta; diff --git a/src/Interface.cs b/src/Interface.cs index 3e0f8771..d7a35f81 100644 --- a/src/Interface.cs +++ b/src/Interface.cs @@ -34,7 +34,10 @@ namespace go public static int TabSize = 4; public static string LineBreak = "\r\n"; public static bool ReplaceTabsWithSpace = false; + /// <summary> Allow rendering of interface in development environment </summary> public static bool DesignerMode = false; + /// <summary> Threshold to catch borders for sizing </summary> + public static int BorderThreshold = 5; /// <summary> /// Graphic objects References use in dynamic delegates for binding diff --git a/src/OpenTKGameWindow.cs b/src/OpenTKGameWindow.cs index 23e72576..d34d6bfa 100755 --- a/src/OpenTKGameWindow.cs +++ b/src/OpenTKGameWindow.cs @@ -40,7 +40,8 @@ namespace go XCursor.NE = XCursorFile.Load("#go.Images.Icons.Cursors.top_right_corner").Cursors[0];
XCursor.SW = XCursorFile.Load("#go.Images.Icons.Cursors.bottom_left_corner").Cursors[0];
XCursor.SE = XCursorFile.Load("#go.Images.Icons.Cursors.bottom_right_corner").Cursors[0];
-
+ XCursor.H = XCursorFile.Load("#go.Images.Icons.Cursors.sb_h_double_arrow").Cursors[0];
+ XCursor.V = XCursorFile.Load("#go.Images.Icons.Cursors.sb_v_double_arrow").Cursors[0];
}
#endregion
diff --git a/src/XCursor.cs b/src/XCursor.cs index a186fcfe..8120530e 100644 --- a/src/XCursor.cs +++ b/src/XCursor.cs @@ -151,8 +151,8 @@ namespace go public static XCursor NE; public static XCursor N; public static XCursor S; - - + public static XCursor V; + public static XCursor H; public uint Width; public uint Height; |