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/GraphicObjects | |
| 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/GraphicObjects')
| -rw-r--r-- | src/GraphicObjects/Window.cs | 60 |
1 files changed, 33 insertions, 27 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; |