-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathIWindowWrapper.cs
More file actions
158 lines (138 loc) · 5.18 KB
/
IWindowWrapper.cs
File metadata and controls
158 lines (138 loc) · 5.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
using System;
using System.Collections.Generic;
using System.ComponentModel;
using engenious.Input;
using OpenTK.Windowing.Common;
using OpenTK.Windowing.Common.Input;
using OpenTK.Windowing.GraphicsLibraryFramework;
using KeyboardState = engenious.Input.KeyboardState;
using MouseState = engenious.Input.MouseState;
namespace engenious
{
/// <summary>
/// A wrapper for wrapping opentk windows.
/// </summary>
public interface IWindowWrapper : IDisposable
{
/// <summary>
/// Gets the underlying <see cref="IGraphicsContext"/>.
/// </summary>
IGraphicsContext Context { get; }
/// <summary>
/// Gets the current mouse state on the wrapped window.
/// </summary>
MouseState MouseState { get; }
/// <summary>
/// Gets the current keyboard state on the wrapped window.
/// </summary>
KeyboardState KeyboardState { get; }
/// <summary>
/// Gets the current joystick states on the wrapped window.
/// </summary>
IReadOnlyList<JoystickState?> JoystickStates { get; }
/// <summary>
/// Gets the title on the wrapped window.
/// </summary>
string Title { get; set; }
/// <summary>
/// Gets the current icon of the wrapped window.
/// </summary>
WindowIcon? Icon { get; set; }
/// <summary>
/// Gets the current mouse position on the wrapped window.
/// </summary>
Vector2 MousePosition { get; set; }
/// <summary>
/// Gets whether the current wrapped window is visible.
/// </summary>
bool IsVisible { get; set; }
/// <summary>
/// Gets whether the current wrapped window is focused.
/// </summary>
bool IsFocused { get; }
/// <summary>
/// Gets whether the mouse cursor on the current wrapped window is visible.
/// </summary>
bool CursorVisible { get; set; }
/// <summary>
/// Gets whether the mouse cursor on the current wrapped window is grabbed.
/// </summary>
bool CursorGrabbed { get; set; }
/// <summary>
/// Gets the current position of the wrapped window.
/// </summary>
Point Location { get; set; }
/// <summary>
/// Gets the current client size of the wrapped window.
/// </summary>
Point ClientSize { get; }
/// <summary>
/// Gets the current size of the wrapped window.
/// </summary>
Point Size { get; set; }
/// <summary>
/// Gets the current client rectangle of the wrapped window.
/// </summary>
Rectangle ClientRectangle { get; set; }
/// <summary>
/// Gets the current window border of the wrapped window.
/// </summary>
WindowBorder WindowBorder { get; set; }
/// <summary>
/// Gets the current window state of the wrapped window.
/// </summary>
WindowState WindowState { get; set; }
/// <summary>
/// Runs the wrapped windows messaging loop.
/// </summary>
void Run();
/// <summary>
/// Closes the window.
/// </summary>
void Close();
/// <summary>
/// Converts a point in client coordinates to screen coordinates.
/// </summary>
/// <param name="pt">The point in client coordinates.</param>
/// <returns>Given input in screen coordinates.</returns>
Point PointToScreen(Point pt);
/// <summary>
/// Converts a point in screen coordinates to client coordinates.
/// </summary>
/// <param name="pt">The point in screen coordinates.</param>
/// <returns>Given input in client coordinates.</returns>
Point PointToClient(Point pt);
/// <summary>
/// Occurs when the wrapped window is loaded.
/// </summary>
event Action? Load;
/// <summary>
/// Occurs when a frame is to be rendered on the wrapped window.
/// </summary>
event Action<FrameEventArgs>? RenderFrame;
/// <summary>
/// Occurs when a frame is to be updated on the wrapped window.
/// </summary>
event Action<FrameEventArgs>? UpdateFrame;
/// <summary>
/// Occurs when the wrapped window is closing.
/// </summary>
event Action<CancelEventArgs>? Closing;
/// <summary>
/// Occurs when the wrapped windows focus changed.
/// </summary>
event Action<FocusedChangedEventArgs>? FocusedChanged;
/// <summary>
/// Occurs when the wrapped window resized.
/// </summary>
event Action<ResizeEventArgs>? Resize;
/// <summary>
/// Occurs when text was typed on the wrapped window.
/// </summary>
event Action<TextInputEventArgs>? KeyPress;
/// <summary>
/// Occurs when mouse wheel was scrolled on the wrapped window.
/// </summary>
event Action<MouseWheelEventArgs>? MouseWheel;
}
}