get rid of some unused code

This commit is contained in:
UnknownShadow200 2018-06-05 22:45:26 +10:00
parent 918b204cbc
commit 0ece5b49f8
11 changed files with 8 additions and 134 deletions

View File

@ -253,7 +253,6 @@
<Compile Include="Math\Picking.cs" /> <Compile Include="Math\Picking.cs" />
<Compile Include="Platform\DesktopWindow.cs" /> <Compile Include="Platform\DesktopWindow.cs" />
<Compile Include="Platform\Font.cs" /> <Compile Include="Platform\Font.cs" />
<Compile Include="Platform\IPlatformWindow.cs" />
<Compile Include="Platform\Platform.cs" /> <Compile Include="Platform\Platform.cs" />
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />

View File

@ -207,7 +207,7 @@ namespace ClassicalSharp {
} }
} }
internal IPlatformWindow window; internal DesktopWindow window;
public MouseDevice Mouse; public MouseDevice Mouse;
public KeyboardDevice Keyboard; public KeyboardDevice Keyboard;

View File

@ -9,7 +9,7 @@ using Clipboard = System.Windows.Forms.Clipboard;
namespace ClassicalSharp { namespace ClassicalSharp {
/// <summary> Implementation of a native window and native input handling mechanism on Windows, OSX, and Linux. </summary> /// <summary> Implementation of a native window and native input handling mechanism on Windows, OSX, and Linux. </summary>
public sealed class DesktopWindow : GameWindow, IPlatformWindow { public sealed class DesktopWindow : GameWindow {
public int Width { get { return ClientSize.Width; } } public int Width { get { return ClientSize.Width; } }
public int Height { get { return ClientSize.Height; } } public int Height { get { return ClientSize.Height; } }

View File

@ -1,51 +0,0 @@
// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
using System;
using System.Drawing;
using OpenTK;
using OpenTK.Input;
using OpenTK.Platform;
namespace ClassicalSharp {
/// <summary> Abstracts away a platform specific window, and input handler mechanism. </summary>
public interface IPlatformWindow {
Size ClientSize { get; set; }
int Width { get; }
int Height { get; }
bool VSync { get; set; }
bool Exists { get; }
bool Focused { get; }
bool CursorVisible { get; set; }
Point DesktopCursorPos { get; set; }
MouseDevice Mouse { get; }
KeyboardDevice Keyboard { get; }
Point PointToScreen(Point coords);
WindowState WindowState { get; set; }
IWindowInfo WindowInfo { get; }
string ClipboardText { get; set; }
void LoadIcon();
void Run();
void SwapBuffers();
void Exit();
event EventHandler<KeyPressEventArgs> KeyPress;
}
}

View File

@ -2,7 +2,6 @@
using System; using System;
using System.IO; using System.IO;
using System.Net; using System.Net;
using System.Windows.Forms;
using OpenTK; using OpenTK;
namespace ClassicalSharp { namespace ClassicalSharp {

View File

@ -1,7 +1,5 @@
// ClassicalSharp copyright 2014-2016 UnknownShadow200 | Licensed under MIT // ClassicalSharp copyright 2014-2016 UnknownShadow200 | Licensed under MIT
using System; using System;
using System.IO;
using System.Windows.Forms;
using ClassicalSharp; using ClassicalSharp;
namespace Launcher { namespace Launcher {

View File

@ -131,11 +131,5 @@ namespace OpenTK {
/// <summary> Occurs whenever a character is typed. </summary> /// <summary> Occurs whenever a character is typed. </summary>
event EventHandler<KeyPressEventArgs> KeyPress; event EventHandler<KeyPressEventArgs> KeyPress;
/// <summary> Occurs whenever the mouse cursor leaves the window <see cref="Bounds"/>. </summary>
event EventHandler MouseLeave;
/// <summary> Occurs whenever the mouse cursor enters the window <see cref="Bounds"/>. </summary>
event EventHandler MouseEnter;
} }
} }

View File

@ -229,12 +229,6 @@ namespace OpenTK {
/// <summary> Occurs whenever the window is moved. </summary> /// <summary> Occurs whenever the window is moved. </summary>
public event EventHandler Move; public event EventHandler Move;
/// <summary> Occurs whenever the mouse cursor enters the window <see cref="Bounds"/>. </summary>
public event EventHandler MouseEnter;
/// <summary> Occurs whenever the mouse cursor leaves the window <see cref="Bounds"/>. </summary>
public event EventHandler MouseLeave;
/// <summary> Occurs whenever the window is resized. </summary> /// <summary> Occurs whenever the window is resized. </summary>
public event EventHandler Resize; public event EventHandler Resize;
@ -299,16 +293,6 @@ namespace OpenTK {
if (Move != null) Move(this, e); if (Move != null) Move(this, e);
} }
/// <summary> Called whenever the mouse cursor reenters the window <see cref="Bounds"/>. </summary>
protected virtual void OnMouseEnter(object sender, EventArgs e) {
if (MouseEnter != null) MouseEnter(this, e);
}
/// <summary> Called whenever the mouse cursor leaves the window <see cref="Bounds"/>. </summary>
protected virtual void OnMouseLeave(object sender, EventArgs e) {
if (MouseLeave != null) MouseLeave(this, e);
}
/// <summary> Called when the NativeWindow is resized. </summary> /// <summary> Called when the NativeWindow is resized. </summary>
/// <param name="e">Not used.</param> /// <param name="e">Not used.</param>
protected virtual void OnResize(object sender, EventArgs e) { protected virtual void OnResize(object sender, EventArgs e) {
@ -349,8 +333,6 @@ namespace OpenTK {
implementation.Disposed += OnDisposed; implementation.Disposed += OnDisposed;
implementation.FocusedChanged += OnFocusedChanged; implementation.FocusedChanged += OnFocusedChanged;
implementation.KeyPress += OnKeyPress; implementation.KeyPress += OnKeyPress;
implementation.MouseEnter += OnMouseEnter;
implementation.MouseLeave += OnMouseLeave;
implementation.Move += OnMove; implementation.Move += OnMove;
implementation.Resize += OnResize; implementation.Resize += OnResize;
implementation.VisibleChanged += OnVisibleChanged; implementation.VisibleChanged += OnVisibleChanged;
@ -362,8 +344,6 @@ namespace OpenTK {
implementation.Disposed -= OnDisposed; implementation.Disposed -= OnDisposed;
implementation.FocusedChanged -= OnFocusedChanged; implementation.FocusedChanged -= OnFocusedChanged;
implementation.KeyPress -= OnKeyPress; implementation.KeyPress -= OnKeyPress;
implementation.MouseEnter -= OnMouseEnter;
implementation.MouseLeave -= OnMouseLeave;
implementation.Move -= OnMove; implementation.Move -= OnMove;
implementation.Resize -= OnResize; implementation.Resize -= OnResize;
implementation.VisibleChanged -= OnVisibleChanged; implementation.VisibleChanged -= OnVisibleChanged;

View File

@ -55,7 +55,6 @@ namespace OpenTK.Platform.MacOS
WindowState windowState = WindowState.Normal; WindowState windowState = WindowState.Normal;
internal static Dictionary<IntPtr, WeakReference> WindowRefs = new Dictionary<IntPtr, WeakReference>(); internal static Dictionary<IntPtr, WeakReference> WindowRefs = new Dictionary<IntPtr, WeakReference>();
KeyPressEventArgs mKeyPressArgs = new KeyPressEventArgs(); KeyPressEventArgs mKeyPressArgs = new KeyPressEventArgs();
bool mMouseIn = false;
bool mIsActive = false; bool mIsActive = false;
Icon mIcon; Icon mIcon;
@ -368,11 +367,6 @@ namespace OpenTK.Platform.MacOS
mousePosInClient.Y -= mTitlebarHeight; mousePosInClient.Y -= mTitlebarHeight;
} }
// check for enter/leave events
IntPtr thisEventWindow;
API.GetEventWindowRef(inEvent, out thisEventWindow);
CheckEnterLeaveEvents(thisEventWindow, mousePosInClient);
switch ((MouseEventKind)evt.EventKind) switch ((MouseEventKind)evt.EventKind)
{ {
case MouseEventKind.MouseDown: case MouseEventKind.MouseDown:
@ -444,27 +438,6 @@ namespace OpenTK.Platform.MacOS
} }
} }
private void CheckEnterLeaveEvents(IntPtr eventWindowRef, Point pt)
{
if (window == null)
return;
bool thisIn = eventWindowRef == window.WindowRef;
if (pt.Y < 0)
thisIn = false;
if (thisIn != mMouseIn)
{
mMouseIn = thisIn;
if (mMouseIn)
OnMouseEnter();
else
OnMouseLeave();
}
}
private static void GetCharCodes(IntPtr inEvent, out MacOSKeyCode code, out char charCode) private static void GetCharCodes(IntPtr inEvent, out MacOSKeyCode code, out char charCode)
{ {
code = API.GetEventKeyboardKeyCode(inEvent); code = API.GetEventKeyboardKeyCode(inEvent);
@ -877,18 +850,6 @@ namespace OpenTK.Platform.MacOS
} }
private void OnMouseLeave()
{
if (MouseLeave != null)
MouseLeave(this, EventArgs.Empty);
}
private void OnMouseEnter()
{
if (MouseEnter != null)
MouseEnter(this, EventArgs.Empty);
}
private void OnActivate() private void OnActivate()
{ {
mIsActive = true; mIsActive = true;
@ -916,8 +877,6 @@ namespace OpenTK.Platform.MacOS
public event EventHandler FocusedChanged; public event EventHandler FocusedChanged;
public event EventHandler WindowStateChanged; public event EventHandler WindowStateChanged;
public event EventHandler<KeyPressEventArgs> KeyPress; public event EventHandler<KeyPressEventArgs> KeyPress;
public event EventHandler MouseEnter;
public event EventHandler MouseLeave;
#endregion #endregion

View File

@ -676,8 +676,6 @@ namespace OpenTK.Platform.Windows
public event EventHandler FocusedChanged; public event EventHandler FocusedChanged;
public event EventHandler WindowStateChanged; public event EventHandler WindowStateChanged;
public event EventHandler<KeyPressEventArgs> KeyPress; public event EventHandler<KeyPressEventArgs> KeyPress;
public event EventHandler MouseEnter;
public event EventHandler MouseLeave;
MSG msg; MSG msg;
public void ProcessEvents() { public void ProcessEvents() {

View File

@ -631,8 +631,6 @@ namespace OpenTK.Platform.X11 {
public event EventHandler FocusedChanged; public event EventHandler FocusedChanged;
public event EventHandler WindowStateChanged; public event EventHandler WindowStateChanged;
public event EventHandler<KeyPressEventArgs> KeyPress; public event EventHandler<KeyPressEventArgs> KeyPress;
public event EventHandler MouseEnter;
public event EventHandler MouseLeave;
public KeyboardDevice Keyboard { public KeyboardDevice Keyboard {
get { return keyboard; } get { return keyboard; }