Moved all bindings to the "bindings" sub-directory
Renamed the CSFML directory to c Renamed the DSFML directory to d --> bindings must now be updated to match the new organization! git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1630 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
parent
0cc5563cac
commit
0e2297af28
417 changed files with 0 additions and 0 deletions
92
bindings/dotnet/src/Window/ContextSettings.cs
Normal file
92
bindings/dotnet/src/Window/ContextSettings.cs
Normal file
|
@ -0,0 +1,92 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace SFML
|
||||
{
|
||||
namespace Window
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Structure defining the creation settings of OpenGL contexts
|
||||
/// </summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct ContextSettings
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Construct the settings from depth / stencil bits
|
||||
/// </summary>
|
||||
/// <param name="depthBits">Depth buffer bits</param>
|
||||
/// <param name="stencilBits">Stencil buffer bits</param>
|
||||
////////////////////////////////////////////////////////////
|
||||
public ContextSettings(uint depthBits, uint stencilBits) :
|
||||
this(depthBits, stencilBits, 0)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Construct the settings from depth / stencil bits and antialiasing level
|
||||
/// </summary>
|
||||
/// <param name="depthBits">Depth buffer bits</param>
|
||||
/// <param name="stencilBits">Stencil buffer bits</param>
|
||||
/// <param name="antialiasingLevel">Antialiasing level</param>
|
||||
////////////////////////////////////////////////////////////
|
||||
public ContextSettings(uint depthBits, uint stencilBits, uint antialiasingLevel) :
|
||||
this(depthBits, stencilBits, antialiasingLevel, 2, 0)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Construct the settings from depth / stencil bits and antialiasing level
|
||||
/// </summary>
|
||||
/// <param name="depthBits">Depth buffer bits</param>
|
||||
/// <param name="stencilBits">Stencil buffer bits</param>
|
||||
/// <param name="antialiasingLevel">Antialiasing level</param>
|
||||
/// <param name="majorVersion">Major number of the context version</param>
|
||||
/// <param name="minorVersion">Minor number of the context version</param>
|
||||
////////////////////////////////////////////////////////////
|
||||
public ContextSettings(uint depthBits, uint stencilBits, uint antialiasingLevel, uint majorVersion, uint minorVersion)
|
||||
{
|
||||
DepthBits = depthBits;
|
||||
StencilBits = stencilBits;
|
||||
AntialiasingLevel = antialiasingLevel;
|
||||
MajorVersion = majorVersion;
|
||||
MinorVersion = minorVersion;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Provide a string describing the object
|
||||
/// </summary>
|
||||
/// <returns>String description of the object</returns>
|
||||
////////////////////////////////////////////////////////////
|
||||
public override string ToString()
|
||||
{
|
||||
return "[ContextSettings]" +
|
||||
" DepthBits(" + DepthBits + ")" +
|
||||
" StencilBits(" + StencilBits + ")" +
|
||||
" AntialiasingLevel(" + AntialiasingLevel + ")" +
|
||||
" MajorVersion(" + MajorVersion + ")" +
|
||||
" MinorVersion(" + MinorVersion + ")";
|
||||
}
|
||||
|
||||
/// <summary>Depth buffer bits (0 is disabled)</summary>
|
||||
public uint DepthBits;
|
||||
|
||||
/// <summary>Stencil buffer bits (0 is disabled)</summary>
|
||||
public uint StencilBits;
|
||||
|
||||
/// <summary>Antialiasing level (0 is disabled)</summary>
|
||||
public uint AntialiasingLevel;
|
||||
|
||||
/// <summary>Major number of the context version</summary>
|
||||
public uint MajorVersion;
|
||||
|
||||
/// <summary>Minor number of the context version</summary>
|
||||
public uint MinorVersion;
|
||||
}
|
||||
}
|
||||
}
|
403
bindings/dotnet/src/Window/Event.cs
Normal file
403
bindings/dotnet/src/Window/Event.cs
Normal file
|
@ -0,0 +1,403 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace SFML
|
||||
{
|
||||
namespace Window
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Definition of key codes for keyboard events
|
||||
/// </summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
public enum KeyCode
|
||||
{
|
||||
A = 'a',
|
||||
B = 'b',
|
||||
C = 'c',
|
||||
D = 'd',
|
||||
E = 'e',
|
||||
F = 'f',
|
||||
G = 'g',
|
||||
H = 'h',
|
||||
I = 'i',
|
||||
J = 'j',
|
||||
K = 'k',
|
||||
L = 'l',
|
||||
M = 'm',
|
||||
N = 'n',
|
||||
O = 'o',
|
||||
P = 'p',
|
||||
Q = 'q',
|
||||
R = 'r',
|
||||
S = 's',
|
||||
T = 't',
|
||||
U = 'u',
|
||||
V = 'v',
|
||||
W = 'w',
|
||||
X = 'x',
|
||||
Y = 'y',
|
||||
Z = 'z',
|
||||
Num0 = '0',
|
||||
Num1 = '1',
|
||||
Num2 = '2',
|
||||
Num3 = '3',
|
||||
Num4 = '4',
|
||||
Num5 = '5',
|
||||
Num6 = '6',
|
||||
Num7 = '7',
|
||||
Num8 = '8',
|
||||
Num9 = '9',
|
||||
Escape = 256,
|
||||
LControl,
|
||||
LShift,
|
||||
LAlt,
|
||||
LSystem, // OS specific key (left side) : windows (Win and Linux), apple (MacOS), ...
|
||||
RControl,
|
||||
RShift,
|
||||
RAlt,
|
||||
RSystem, // OS specific key (right side) : windows (Win and Linux), apple (MacOS), ...
|
||||
Menu,
|
||||
LBracket, // [
|
||||
RBracket, // ]
|
||||
SemiColon, // ;
|
||||
Comma, // ,
|
||||
Period, // .
|
||||
Quote, // '
|
||||
Slash, // /
|
||||
BackSlash,
|
||||
Tilde, // ~
|
||||
Equal, // =
|
||||
Dash, // -
|
||||
Space,
|
||||
Return,
|
||||
Back,
|
||||
Tab,
|
||||
PageUp,
|
||||
PageDown,
|
||||
End,
|
||||
Home,
|
||||
Insert,
|
||||
Delete,
|
||||
Add, // +
|
||||
Subtract, // -
|
||||
Multiply, // *
|
||||
Divide, // /
|
||||
Left, // Left arrow
|
||||
Right, // Right arrow
|
||||
Up, // Up arrow
|
||||
Down, // Down arrow
|
||||
Numpad0,
|
||||
Numpad1,
|
||||
Numpad2,
|
||||
Numpad3,
|
||||
Numpad4,
|
||||
Numpad5,
|
||||
Numpad6,
|
||||
Numpad7,
|
||||
Numpad8,
|
||||
Numpad9,
|
||||
F1,
|
||||
F2,
|
||||
F3,
|
||||
F4,
|
||||
F5,
|
||||
F6,
|
||||
F7,
|
||||
F8,
|
||||
F9,
|
||||
F10,
|
||||
F11,
|
||||
F12,
|
||||
F13,
|
||||
F14,
|
||||
F15,
|
||||
Pause
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Definition of button codes for mouse events
|
||||
/// </summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
public enum MouseButton
|
||||
{
|
||||
/// <summary>Left mouse button</summary>
|
||||
Left,
|
||||
|
||||
/// <summary>Right mouse button</summary>
|
||||
Right,
|
||||
|
||||
/// <summary>Center (wheel) mouse button</summary>
|
||||
Middle,
|
||||
|
||||
/// <summary>First extra button</summary>
|
||||
XButton1,
|
||||
|
||||
/// <summary>Second extra button</summary>
|
||||
XButton2
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Definition of joystick axis for joystick events
|
||||
/// </summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
public enum JoyAxis
|
||||
{
|
||||
/// <summary>X axis</summary>
|
||||
AxisX,
|
||||
|
||||
/// <summary>Y axis</summary>
|
||||
AxisY,
|
||||
|
||||
/// <summary>Z axis</summary>
|
||||
AxisZ,
|
||||
|
||||
/// <summary>R axis</summary>
|
||||
AxisR,
|
||||
|
||||
/// <summary>U axis</summary>
|
||||
AxisU,
|
||||
|
||||
/// <summary>V axis</summary>
|
||||
AxisV,
|
||||
|
||||
/// <summary>Point of view</summary>
|
||||
AxisPOV
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Enumeration of the different types of events
|
||||
/// </summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
public enum EventType
|
||||
{
|
||||
/// <summary>Event triggered when a window is manually closed</summary>
|
||||
Closed,
|
||||
|
||||
/// <summary>Event triggered when a window is resized</summary>
|
||||
Resized,
|
||||
|
||||
/// <summary>Event triggered when a window loses the focus</summary>
|
||||
LostFocus,
|
||||
|
||||
/// <summary>Event triggered when a window gains the focus</summary>
|
||||
GainedFocus,
|
||||
|
||||
/// <summary>Event triggered when a valid character is entered</summary>
|
||||
TextEntered,
|
||||
|
||||
/// <summary>Event triggered when a keyboard key is pressed</summary>
|
||||
KeyPressed,
|
||||
|
||||
/// <summary>Event triggered when a keyboard key is released</summary>
|
||||
KeyReleased,
|
||||
|
||||
/// <summary>Event triggered when the mouse wheel is scrolled</summary>
|
||||
MouseWheelMoved,
|
||||
|
||||
/// <summary>Event triggered when a mouse button is pressed</summary>
|
||||
MouseButtonPressed,
|
||||
|
||||
/// <summary>Event triggered when a mouse button is released</summary>
|
||||
MouseButtonReleased,
|
||||
|
||||
/// <summary>Event triggered when the mouse moves within the area of a window</summary>
|
||||
MouseMoved,
|
||||
|
||||
/// <summary>Event triggered when the mouse enters the area of a window</summary>
|
||||
MouseEntered,
|
||||
|
||||
/// <summary>Event triggered when the mouse leaves the area of a window</summary>
|
||||
MouseLeft,
|
||||
|
||||
/// <summary>Event triggered when a joystick button is pressed</summary>
|
||||
JoyButtonPressed,
|
||||
|
||||
/// <summary>Event triggered when a joystick button is released</summary>
|
||||
JoyButtonReleased,
|
||||
|
||||
/// <summary>Event triggered when a joystick axis moves</summary>
|
||||
JoyMoved
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Keyboard event parameters
|
||||
/// </summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct KeyEvent
|
||||
{
|
||||
/// <summary>Code of the key (see KeyCode enum)</summary>
|
||||
public KeyCode Code;
|
||||
|
||||
/// <summary>Is the Alt modifier pressed?</summary>
|
||||
public int Alt;
|
||||
|
||||
/// <summary>Is the Control modifier pressed?</summary>
|
||||
public int Control;
|
||||
|
||||
/// <summary>Is the Shift modifier pressed?</summary>
|
||||
public int Shift;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Text event parameters
|
||||
/// </summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct TextEvent
|
||||
{
|
||||
/// <summary>UTF-32 value of the character</summary>
|
||||
public uint Unicode;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Mouse move event parameters
|
||||
/// </summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct MouseMoveEvent
|
||||
{
|
||||
/// <summary>X coordinate of the mouse cursor</summary>
|
||||
public int X;
|
||||
|
||||
/// <summary>Y coordinate of the mouse cursor</summary>
|
||||
public int Y;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Mouse buttons event parameters
|
||||
/// </summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct MouseButtonEvent
|
||||
{
|
||||
/// <summary>Code of the button (see MouseButton enum)</summary>
|
||||
public MouseButton Button;
|
||||
|
||||
/// <summary>X coordinate of the mouse cursor</summary>
|
||||
public int X;
|
||||
|
||||
/// <summary>Y coordinate of the mouse cursor</summary>
|
||||
public int Y;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Mouse wheel event parameters
|
||||
/// </summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct MouseWheelEvent
|
||||
{
|
||||
/// <summary>Scroll amount</summary>
|
||||
public int Delta;
|
||||
|
||||
/// <summary>X coordinate of the mouse cursor</summary>
|
||||
public int X;
|
||||
|
||||
/// <summary>Y coordinate of the mouse cursor</summary>
|
||||
public int Y;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Joystick axis move event parameters
|
||||
/// </summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct JoyMoveEvent
|
||||
{
|
||||
/// <summary>Index of the joystick which triggered the event</summary>
|
||||
public uint JoystickId;
|
||||
|
||||
/// <summary>Joystick axis (see JoyAxis enum)</summary>
|
||||
public JoyAxis Axis;
|
||||
|
||||
/// <summary>Current position of the axis</summary>
|
||||
public float Position;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Joystick buttons event parameters
|
||||
/// </summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct JoyButtonEvent
|
||||
{
|
||||
/// <summary>Index of the joystick which triggered the event</summary>
|
||||
public uint JoystickId;
|
||||
|
||||
/// <summary>Index of the button</summary>
|
||||
public uint Button;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Size event parameters
|
||||
/// </summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct SizeEvent
|
||||
{
|
||||
/// <summary>New width of the window</summary>
|
||||
public uint Width;
|
||||
|
||||
/// <summary>New height of the window</summary>
|
||||
public uint Height;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Event defines a system event and its parameters
|
||||
/// </summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
[StructLayout(LayoutKind.Explicit, Size = 20)]
|
||||
public struct Event
|
||||
{
|
||||
/// <summary>Type of event (see EventType enum)</summary>
|
||||
[FieldOffset(0)]
|
||||
public EventType Type;
|
||||
|
||||
/// <summary>Arguments for key events (KeyPressed, KeyReleased)</summary>
|
||||
[FieldOffset(4)]
|
||||
public KeyEvent Key;
|
||||
|
||||
/// <summary>Arguments for text events (TextEntered)</summary>
|
||||
[FieldOffset(4)]
|
||||
public TextEvent Text;
|
||||
|
||||
/// <summary>Arguments for mouse move events (MouseMoved)</summary>
|
||||
[FieldOffset(4)]
|
||||
public MouseMoveEvent MouseMove;
|
||||
|
||||
/// <summary>Arguments for mouse button events (MouseButtonPressed, MouseButtonReleased)</summary>
|
||||
[FieldOffset(4)]
|
||||
public MouseButtonEvent MouseButton;
|
||||
|
||||
/// <summary>Arguments for mouse wheel events (MouseWheelMoved)</summary>
|
||||
[FieldOffset(4)]
|
||||
public MouseWheelEvent MouseWheel;
|
||||
|
||||
/// <summary>Arguments for joystick axis events (JoyMoved)</summary>
|
||||
[FieldOffset(4)]
|
||||
public JoyMoveEvent JoyMove;
|
||||
|
||||
/// <summary>Arguments for joystick button events (JoyButtonPressed, JoyButtonReleased)</summary>
|
||||
[FieldOffset(4)]
|
||||
public JoyButtonEvent JoyButton;
|
||||
|
||||
/// <summary>Arguments for size events (Resized)</summary>
|
||||
[FieldOffset(4)]
|
||||
public SizeEvent Size;
|
||||
}
|
||||
}
|
||||
}
|
339
bindings/dotnet/src/Window/EventArgs.cs
Normal file
339
bindings/dotnet/src/Window/EventArgs.cs
Normal file
|
@ -0,0 +1,339 @@
|
|||
using System;
|
||||
|
||||
namespace SFML
|
||||
{
|
||||
namespace Window
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Keyboard event parameters
|
||||
/// </summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
public class KeyEventArgs : EventArgs
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Construct the key arguments from a key event
|
||||
/// </summary>
|
||||
/// <param name="e">Key event</param>
|
||||
////////////////////////////////////////////////////////////
|
||||
public KeyEventArgs(KeyEvent e)
|
||||
{
|
||||
Code = e.Code;
|
||||
Alt = e.Alt != 0;
|
||||
Control = e.Control != 0;
|
||||
Shift = e.Shift != 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Provide a string describing the object
|
||||
/// </summary>
|
||||
/// <returns>String description of the object</returns>
|
||||
////////////////////////////////////////////////////////////
|
||||
public override string ToString()
|
||||
{
|
||||
return "[KeyEventArgs]" +
|
||||
" Code(" + Code + ")" +
|
||||
" Alt(" + Alt + ")" +
|
||||
" Control(" + Control + ")" +
|
||||
" Shift(" + Shift + ")";
|
||||
}
|
||||
|
||||
/// <summary>Code of the key (see KeyCode enum)</summary>
|
||||
public KeyCode Code;
|
||||
|
||||
/// <summary>Is the Alt modifier pressed?</summary>
|
||||
public bool Alt;
|
||||
|
||||
/// <summary>Is the Control modifier pressed?</summary>
|
||||
public bool Control;
|
||||
|
||||
/// <summary>Is the Shift modifier pressed?</summary>
|
||||
public bool Shift;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Text event parameters
|
||||
/// </summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
public class TextEventArgs : EventArgs
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Construct the text arguments from a text event
|
||||
/// </summary>
|
||||
/// <param name="e">Text event</param>
|
||||
////////////////////////////////////////////////////////////
|
||||
public TextEventArgs(TextEvent e)
|
||||
{
|
||||
Unicode = Char.ConvertFromUtf32((int)e.Unicode);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Provide a string describing the object
|
||||
/// </summary>
|
||||
/// <returns>String description of the object</returns>
|
||||
////////////////////////////////////////////////////////////
|
||||
public override string ToString()
|
||||
{
|
||||
return "[TextEventArgs]" +
|
||||
" Unicode(" + Unicode + ")";
|
||||
}
|
||||
|
||||
/// <summary>UTF-16 value of the character</summary>
|
||||
public string Unicode;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Mouse move event parameters
|
||||
/// </summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
public class MouseMoveEventArgs : EventArgs
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Construct the mouse move arguments from a mouse move event
|
||||
/// </summary>
|
||||
/// <param name="e">Mouse move event</param>
|
||||
////////////////////////////////////////////////////////////
|
||||
public MouseMoveEventArgs(MouseMoveEvent e)
|
||||
{
|
||||
X = e.X;
|
||||
Y = e.Y;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Provide a string describing the object
|
||||
/// </summary>
|
||||
/// <returns>String description of the object</returns>
|
||||
////////////////////////////////////////////////////////////
|
||||
public override string ToString()
|
||||
{
|
||||
return "[MouseMoveEventArgs]" +
|
||||
" X(" + X + ")" +
|
||||
" Y(" + Y + ")";
|
||||
}
|
||||
|
||||
/// <summary>X coordinate of the mouse cursor</summary>
|
||||
public int X;
|
||||
|
||||
/// <summary>Y coordinate of the mouse cursor</summary>
|
||||
public int Y;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Mouse buttons event parameters
|
||||
/// </summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
public class MouseButtonEventArgs : EventArgs
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Construct the mouse button arguments from a mouse button event
|
||||
/// </summary>
|
||||
/// <param name="e">Mouse button event</param>
|
||||
////////////////////////////////////////////////////////////
|
||||
public MouseButtonEventArgs(MouseButtonEvent e)
|
||||
{
|
||||
Button = e.Button;
|
||||
X = e.X;
|
||||
Y = e.Y;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Provide a string describing the object
|
||||
/// </summary>
|
||||
/// <returns>String description of the object</returns>
|
||||
////////////////////////////////////////////////////////////
|
||||
public override string ToString()
|
||||
{
|
||||
return "[MouseButtonEventArgs]" +
|
||||
" Button(" + Button + ")" +
|
||||
" X(" + X + ")" +
|
||||
" Y(" + Y + ")";
|
||||
}
|
||||
|
||||
/// <summary>Code of the button (see MouseButton enum)</summary>
|
||||
public MouseButton Button;
|
||||
|
||||
/// <summary>X coordinate of the mouse cursor</summary>
|
||||
public int X;
|
||||
|
||||
/// <summary>Y coordinate of the mouse cursor</summary>
|
||||
public int Y;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Mouse wheel event parameters
|
||||
/// </summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
public class MouseWheelEventArgs : EventArgs
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Construct the mouse wheel arguments from a mouse wheel event
|
||||
/// </summary>
|
||||
/// <param name="e">Mouse wheel event</param>
|
||||
////////////////////////////////////////////////////////////
|
||||
public MouseWheelEventArgs(MouseWheelEvent e)
|
||||
{
|
||||
Delta = e.Delta;
|
||||
X = e.X;
|
||||
Y = e.Y;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Provide a string describing the object
|
||||
/// </summary>
|
||||
/// <returns>String description of the object</returns>
|
||||
////////////////////////////////////////////////////////////
|
||||
public override string ToString()
|
||||
{
|
||||
return "[MouseWheelEventArgs]" +
|
||||
" Delta(" + Delta + ")" +
|
||||
" X(" + X + ")" +
|
||||
" Y(" + Y + ")";
|
||||
}
|
||||
|
||||
/// <summary>Scroll amount</summary>
|
||||
public int Delta;
|
||||
|
||||
/// <summary>X coordinate of the mouse cursor</summary>
|
||||
public int X;
|
||||
|
||||
/// <summary>Y coordinate of the mouse cursor</summary>
|
||||
public int Y;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Joystick axis move event parameters
|
||||
/// </summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
public class JoyMoveEventArgs : EventArgs
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Construct the joystick move arguments from a joystick move event
|
||||
/// </summary>
|
||||
/// <param name="e">Joystick move event</param>
|
||||
////////////////////////////////////////////////////////////
|
||||
public JoyMoveEventArgs(JoyMoveEvent e)
|
||||
{
|
||||
JoystickId = e.JoystickId;
|
||||
Axis = e.Axis;
|
||||
Position = e.Position;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Provide a string describing the object
|
||||
/// </summary>
|
||||
/// <returns>String description of the object</returns>
|
||||
////////////////////////////////////////////////////////////
|
||||
public override string ToString()
|
||||
{
|
||||
return "[JoyMoveEventArgs]" +
|
||||
" JoystickId(" + JoystickId + ")" +
|
||||
" Axis(" + Axis + ")" +
|
||||
" Position(" + Position + ")";
|
||||
}
|
||||
|
||||
/// <summary>Index of the joystick which triggered the event</summary>
|
||||
public uint JoystickId;
|
||||
|
||||
/// <summary>Joystick axis (see JoyAxis enum)</summary>
|
||||
public JoyAxis Axis;
|
||||
|
||||
/// <summary>Current position of the axis</summary>
|
||||
public float Position;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Joystick buttons event parameters
|
||||
/// </summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
public class JoyButtonEventArgs : EventArgs
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Construct the joystick button arguments from a joystick button event
|
||||
/// </summary>
|
||||
/// <param name="e">Joystick button event</param>
|
||||
////////////////////////////////////////////////////////////
|
||||
public JoyButtonEventArgs(JoyButtonEvent e)
|
||||
{
|
||||
JoystickId = e.JoystickId;
|
||||
Button = e.Button;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Provide a string describing the object
|
||||
/// </summary>
|
||||
/// <returns>String description of the object</returns>
|
||||
////////////////////////////////////////////////////////////
|
||||
public override string ToString()
|
||||
{
|
||||
return "[JoyButtonEventArgs]" +
|
||||
" JoystickId(" + JoystickId + ")" +
|
||||
" Button(" + Button + ")";
|
||||
}
|
||||
|
||||
/// <summary>Index of the joystick which triggered the event</summary>
|
||||
public uint JoystickId;
|
||||
|
||||
/// <summary>Index of the button</summary>
|
||||
public uint Button;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Size event parameters
|
||||
/// </summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
public class SizeEventArgs : EventArgs
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Construct the size arguments from a size event
|
||||
/// </summary>
|
||||
/// <param name="e">Size event</param>
|
||||
////////////////////////////////////////////////////////////
|
||||
public SizeEventArgs(SizeEvent e)
|
||||
{
|
||||
Width = e.Width;
|
||||
Height = e.Height;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Provide a string describing the object
|
||||
/// </summary>
|
||||
/// <returns>String description of the object</returns>
|
||||
////////////////////////////////////////////////////////////
|
||||
public override string ToString()
|
||||
{
|
||||
return "[SizeEventArgs]" +
|
||||
" Width(" + Width + ")" +
|
||||
" Height(" + Height + ")";
|
||||
}
|
||||
|
||||
/// <summary>New width of the window</summary>
|
||||
public uint Width;
|
||||
|
||||
/// <summary>New height of the window</summary>
|
||||
public uint Height;
|
||||
}
|
||||
}
|
||||
}
|
144
bindings/dotnet/src/Window/Input.cs
Normal file
144
bindings/dotnet/src/Window/Input.cs
Normal file
|
@ -0,0 +1,144 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
|
||||
namespace SFML
|
||||
{
|
||||
namespace Window
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Input handles real-time input from keyboard and mouse.
|
||||
/// Use it instead of events to handle continuous moves and more
|
||||
/// game-friendly inputs
|
||||
/// </summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
public class Input : ObjectBase
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Get the state of a key
|
||||
/// </summary>
|
||||
/// <param name="key">Key to check</param>
|
||||
/// <returns>True if key is down, false if key is up</returns>
|
||||
////////////////////////////////////////////////////////////
|
||||
public bool IsKeyDown(KeyCode key)
|
||||
{
|
||||
return sfInput_IsKeyDown(This, key);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Get the state of a mouse button
|
||||
/// </summary>
|
||||
/// <param name="button">Button to check</param>
|
||||
/// <returns>True if button is down, false if button is up</returns>
|
||||
////////////////////////////////////////////////////////////
|
||||
public bool IsMouseButtonDown(MouseButton button)
|
||||
{
|
||||
return sfInput_IsMouseButtonDown(This, button);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Get the state of a joystick button
|
||||
/// </summary>
|
||||
/// <param name="joystickId">Identifier of the joystick to check (0 or 1)</param>
|
||||
/// <param name="button">Button to check</param>
|
||||
/// <returns>True if button is down, false if button is up</returns>
|
||||
////////////////////////////////////////////////////////////
|
||||
public bool IsJoystickButtonDown(uint joystickId, uint button)
|
||||
{
|
||||
return sfInput_IsJoystickButtonDown(This, joystickId, button);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Get the mouse X position
|
||||
/// </summary>
|
||||
/// <returns>Current mouse left position, relative to owner window</returns>
|
||||
////////////////////////////////////////////////////////////
|
||||
public int GetMouseX()
|
||||
{
|
||||
return sfInput_GetMouseX(This);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Get the mouse Y position
|
||||
/// </summary>
|
||||
/// <returns>Current mouse top position, relative to owner window</returns>
|
||||
////////////////////////////////////////////////////////////
|
||||
public int GetMouseY()
|
||||
{
|
||||
return sfInput_GetMouseY(This);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Get a joystick axis position
|
||||
/// </summary>
|
||||
/// <param name="joystickId">Identifier of the joystick to check (0 or 1)</param>
|
||||
/// <param name="axis">Axis to get</param>
|
||||
/// <returns>Current axis position, in the range [-100, 100] (except for POV, which is [0, 360])</returns>
|
||||
////////////////////////////////////////////////////////////
|
||||
public float GetJoystickAxis(uint joystickId, JoyAxis axis)
|
||||
{
|
||||
return sfInput_GetJoystickAxis(This, joystickId, axis);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// For internal use only, construct the instance from a direct pointer to the internal object
|
||||
/// </summary>
|
||||
/// <param name="thisPtr">Internal pointer to the input object</param>
|
||||
////////////////////////////////////////////////////////////
|
||||
public Input(IntPtr thisPtr) :
|
||||
base(thisPtr)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Provide a string describing the object
|
||||
/// </summary>
|
||||
/// <returns>String description of the object</returns>
|
||||
////////////////////////////////////////////////////////////
|
||||
public override string ToString()
|
||||
{
|
||||
return "[Input]";
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Handle the destruction of the object
|
||||
/// </summary>
|
||||
/// <param name="disposing">Is the GC disposing the object, or is it an explicit call ?</param>
|
||||
////////////////////////////////////////////////////////////
|
||||
protected override void Destroy(bool disposing)
|
||||
{
|
||||
// Nothing to do here, Input instances are owned by the C library
|
||||
}
|
||||
|
||||
#region Imports
|
||||
[DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
||||
static extern bool sfInput_IsKeyDown(IntPtr This, KeyCode Key);
|
||||
|
||||
[DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
||||
static extern bool sfInput_IsMouseButtonDown(IntPtr This, MouseButton Button);
|
||||
|
||||
[DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
||||
static extern bool sfInput_IsJoystickButtonDown(IntPtr This, uint JoyId, uint Button);
|
||||
|
||||
[DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
||||
static extern int sfInput_GetMouseX(IntPtr This);
|
||||
|
||||
[DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
||||
static extern int sfInput_GetMouseY(IntPtr This);
|
||||
|
||||
[DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
||||
static extern float sfInput_GetJoystickAxis(IntPtr This, uint JoyId, JoyAxis Axis);
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
84
bindings/dotnet/src/Window/LoadingFailedException.cs
Normal file
84
bindings/dotnet/src/Window/LoadingFailedException.cs
Normal file
|
@ -0,0 +1,84 @@
|
|||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace SFML
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Exception thrown by SFML whenever loading a resource fails
|
||||
/// </summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
[Serializable]
|
||||
public class LoadingFailedException : Exception
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Default constructor (unknown error)
|
||||
/// </summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
public LoadingFailedException() :
|
||||
base("Failed to load a resource")
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Failure to load a resource from memory
|
||||
/// </summary>
|
||||
/// <param name="resourceName">Name of the resource</param>
|
||||
////////////////////////////////////////////////////////////
|
||||
public LoadingFailedException(string resourceName) :
|
||||
base("Failed to load " + resourceName + " from memory")
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Failure to load a resource from memory
|
||||
/// </summary>
|
||||
/// <param name="resourceName">Name of the resource</param>
|
||||
/// <param name="innerException">Exception which is the cause ofthe current exception</param>
|
||||
////////////////////////////////////////////////////////////
|
||||
public LoadingFailedException(string resourceName, Exception innerException) :
|
||||
base("Failed to load " + resourceName + " from memory", innerException)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Failure to load a resource from a file
|
||||
/// </summary>
|
||||
/// <param name="resourceName">Name of the resource</param>
|
||||
/// <param name="filename">Path of the file</param>
|
||||
////////////////////////////////////////////////////////////
|
||||
public LoadingFailedException(string resourceName, string filename) :
|
||||
base("Failed to load " + resourceName + " from file " + filename)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Failure to load a resource from a file
|
||||
/// </summary>
|
||||
/// <param name="resourceName">Name of the resource</param>
|
||||
/// <param name="filename">Path of the file</param>
|
||||
/// <param name="innerException">Exception which is the cause ofthe current exception</param>
|
||||
////////////////////////////////////////////////////////////
|
||||
public LoadingFailedException(string resourceName, string filename, Exception innerException) :
|
||||
base("Failed to load " + resourceName + " from file " + filename, innerException)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Initialize an instance of the exception with serialized data
|
||||
/// </summary>
|
||||
/// <param name="info">Serialized data</param>
|
||||
/// <param name="context">Contextual informations</param>
|
||||
////////////////////////////////////////////////////////////
|
||||
public LoadingFailedException(SerializationInfo info, StreamingContext context) :
|
||||
base(info, context)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
93
bindings/dotnet/src/Window/ObjectBase.cs
Normal file
93
bindings/dotnet/src/Window/ObjectBase.cs
Normal file
|
@ -0,0 +1,93 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace SFML
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// The ObjectBase class is an abstract base for every
|
||||
/// SFML object. It's meant for internal use only
|
||||
/// </summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
public abstract class ObjectBase : IDisposable
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Construct the object from a pointer to the C library object
|
||||
/// </summary>
|
||||
/// <param name="thisPtr">Internal pointer to the object in the C libraries</param>
|
||||
////////////////////////////////////////////////////////////
|
||||
public ObjectBase(IntPtr thisPtr)
|
||||
{
|
||||
myThis = thisPtr;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Dispose the object
|
||||
/// </summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
~ObjectBase()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Access to the internal pointer of the object.
|
||||
/// For internal use only
|
||||
/// </summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
public IntPtr This
|
||||
{
|
||||
get {return myThis;}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Explicitely dispose the object
|
||||
/// </summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Destroy the object
|
||||
/// </summary>
|
||||
/// <param name="disposing">Is the GC disposing the object, or is it an explicit call ?</param>
|
||||
////////////////////////////////////////////////////////////
|
||||
private void Dispose(bool disposing)
|
||||
{
|
||||
if (myThis != IntPtr.Zero)
|
||||
{
|
||||
Destroy(disposing);
|
||||
myThis = IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Destroy the object (implementation is left to each derived class)
|
||||
/// </summary>
|
||||
/// <param name="disposing">Is the GC disposing the object, or is it an explicit call ?</param>
|
||||
////////////////////////////////////////////////////////////
|
||||
protected abstract void Destroy(bool disposing);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Set the pointer to the internal object. For internal use only
|
||||
/// </summary>
|
||||
/// <param name="thisPtr">Pointer to the internal object in C library</param>
|
||||
////////////////////////////////////////////////////////////
|
||||
protected void SetThis(IntPtr thisPtr)
|
||||
{
|
||||
myThis = thisPtr;
|
||||
}
|
||||
|
||||
private IntPtr myThis = IntPtr.Zero;
|
||||
}
|
||||
}
|
124
bindings/dotnet/src/Window/VideoMode.cs
Normal file
124
bindings/dotnet/src/Window/VideoMode.cs
Normal file
|
@ -0,0 +1,124 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
|
||||
namespace SFML
|
||||
{
|
||||
namespace Window
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// VideoMode defines a video mode (width, height, bpp, frequency)
|
||||
/// and provides static functions for getting modes supported
|
||||
/// by the display device
|
||||
/// </summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct VideoMode
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Construct the video mode with its width and height
|
||||
/// </summary>
|
||||
/// <param name="width">Video mode width</param>
|
||||
/// <param name="height">Video mode height</param>
|
||||
////////////////////////////////////////////////////////////
|
||||
public VideoMode(uint width, uint height) :
|
||||
this(width, height, 32)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Construct the video mode with its width, height and depth
|
||||
/// </summary>
|
||||
/// <param name="width">Video mode width</param>
|
||||
/// <param name="height">Video mode height</param>
|
||||
/// <param name="bpp">Video mode depth (bits per pixel)</param>
|
||||
////////////////////////////////////////////////////////////
|
||||
public VideoMode(uint width, uint height, uint bpp)
|
||||
{
|
||||
Width = width;
|
||||
Height = height;
|
||||
BitsPerPixel = bpp;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Tell whether or not the video mode is supported
|
||||
/// </summary>
|
||||
/// <returns>True if the video mode is valid, false otherwise</returns>
|
||||
////////////////////////////////////////////////////////////
|
||||
public bool IsValid()
|
||||
{
|
||||
return sfVideoMode_IsValid(this);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Get the list of all the supported fullscreen video modes
|
||||
/// </summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
public static VideoMode[] FullscreenModes
|
||||
{
|
||||
get
|
||||
{
|
||||
unsafe
|
||||
{
|
||||
uint Count;
|
||||
VideoMode* ModesPtr = sfVideoMode_GetFullscreenModes(out Count);
|
||||
VideoMode[] Modes = new VideoMode[Count];
|
||||
for (uint i = 0; i < Count; ++i)
|
||||
Modes[i] = ModesPtr[i];
|
||||
|
||||
return Modes;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Get the current desktop video mode
|
||||
/// </summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
public static VideoMode DesktopMode
|
||||
{
|
||||
get {return sfVideoMode_GetDesktopMode();}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Provide a string describing the object
|
||||
/// </summary>
|
||||
/// <returns>String description of the object</returns>
|
||||
////////////////////////////////////////////////////////////
|
||||
public override string ToString()
|
||||
{
|
||||
return "[VideoMode]" +
|
||||
" Width(" + Width + ")" +
|
||||
" Height(" + Height + ")" +
|
||||
" BitsPerPixel(" + BitsPerPixel + ")";
|
||||
}
|
||||
|
||||
/// <summary>Video mode width, in pixels</summary>
|
||||
public uint Width;
|
||||
|
||||
/// <summary>Video mode height, in pixels</summary>
|
||||
public uint Height;
|
||||
|
||||
/// <summary>Video mode depth, in bits per pixel</summary>
|
||||
public uint BitsPerPixel;
|
||||
|
||||
#region Imports
|
||||
[DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
||||
static extern VideoMode sfVideoMode_GetDesktopMode();
|
||||
|
||||
[DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
||||
unsafe static extern VideoMode* sfVideoMode_GetFullscreenModes(out uint Count);
|
||||
|
||||
[DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
||||
static extern bool sfVideoMode_IsValid(VideoMode Mode);
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
661
bindings/dotnet/src/Window/Window.cs
Normal file
661
bindings/dotnet/src/Window/Window.cs
Normal file
|
@ -0,0 +1,661 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Collections.Generic;
|
||||
using System.Security;
|
||||
|
||||
namespace SFML
|
||||
{
|
||||
namespace Window
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Enumeration of window creation styles
|
||||
/// </summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
[Flags]
|
||||
public enum Styles
|
||||
{
|
||||
/// <summary>No border / title bar (this flag and all others are mutually exclusive)</summary>
|
||||
None = 0,
|
||||
|
||||
/// <summary>Title bar + fixed border</summary>
|
||||
Titlebar = 1 << 0,
|
||||
|
||||
/// <summary>Titlebar + resizable border + maximize button</summary>
|
||||
Resize = 1 << 1,
|
||||
|
||||
/// <summary>Titlebar + close button</summary>
|
||||
Close = 1 << 2,
|
||||
|
||||
/// <summary>Fullscreen mode (this flag and all others are mutually exclusive))</summary>
|
||||
Fullscreen = 1 << 3,
|
||||
|
||||
/// <summary>Default window style (titlebar + resize + close)</summary>
|
||||
Default = Titlebar | Resize | Close
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Window is a rendering window ; it can create a new window
|
||||
/// or connect to an existing one
|
||||
/// </summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
public class Window : ObjectBase
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Create the window with default style and creation settings
|
||||
/// </summary>
|
||||
/// <param name="mode">Video mode to use</param>
|
||||
/// <param name="title">Title of the window</param>
|
||||
////////////////////////////////////////////////////////////
|
||||
public Window(VideoMode mode, string title) :
|
||||
this(mode, title, Styles.Default, new ContextSettings(24, 8))
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Create the window with default creation settings
|
||||
/// </summary>
|
||||
/// <param name="mode">Video mode to use</param>
|
||||
/// <param name="title">Title of the window</param>
|
||||
/// <param name="style">Window style (Resize | Close by default)</param>
|
||||
////////////////////////////////////////////////////////////
|
||||
public Window(VideoMode mode, string title, Styles style) :
|
||||
this(mode, title, style, new ContextSettings(24, 8))
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Create the window
|
||||
/// </summary>
|
||||
/// <param name="mode">Video mode to use</param>
|
||||
/// <param name="title">Title of the window</param>
|
||||
/// <param name="style">Window style (Resize | Close by default)</param>
|
||||
/// <param name="settings">Creation parameters</param>
|
||||
////////////////////////////////////////////////////////////
|
||||
public Window(VideoMode mode, string title, Styles style, ContextSettings settings) :
|
||||
base(sfWindow_Create(mode, title, style, ref settings))
|
||||
{
|
||||
myInput = new Input(sfWindow_GetInput(This));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Create the window from an existing control with default creation settings
|
||||
/// </summary>
|
||||
/// <param name="handle">Platform-specific handle of the control</param>
|
||||
////////////////////////////////////////////////////////////
|
||||
public Window(IntPtr handle) :
|
||||
this(handle, new ContextSettings(24, 8))
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Create the window from an existing control
|
||||
/// </summary>
|
||||
/// <param name="Handle">Platform-specific handle of the control</param>
|
||||
/// <param name="settings">Creation parameters</param>
|
||||
////////////////////////////////////////////////////////////
|
||||
public Window(IntPtr Handle, ContextSettings settings) :
|
||||
base(sfWindow_CreateFromHandle(Handle, ref settings))
|
||||
{
|
||||
myInput = new Input(sfWindow_GetInput(This));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Input manager of the window
|
||||
/// </summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
public Input Input
|
||||
{
|
||||
get {return myInput;}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Tell whether or not the window is opened (ie. has been created).
|
||||
/// Note that a hidden window (Show(false))
|
||||
/// will still return true
|
||||
/// </summary>
|
||||
/// <returns>True if the window is opened</returns>
|
||||
////////////////////////////////////////////////////////////
|
||||
public virtual bool IsOpened()
|
||||
{
|
||||
return sfWindow_IsOpened(This);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Close (destroy) the window.
|
||||
/// The Window instance remains valid and you can call
|
||||
/// Create to recreate the window
|
||||
/// </summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
public virtual void Close()
|
||||
{
|
||||
sfWindow_Close(This);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Display the window on screen
|
||||
/// </summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
public virtual void Display()
|
||||
{
|
||||
sfWindow_Display(This);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Width of the rendering region of the window
|
||||
/// </summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
public virtual uint Width
|
||||
{
|
||||
get {return sfWindow_GetWidth(This);}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Height of the rendering region of the window
|
||||
/// </summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
public virtual uint Height
|
||||
{
|
||||
get {return sfWindow_GetHeight(This);}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Creation settings of the window
|
||||
/// </summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
public virtual ContextSettings Settings
|
||||
{
|
||||
get {return sfWindow_GetSettings(This);}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Enable / disable vertical synchronization
|
||||
/// </summary>
|
||||
/// <param name="enable">True to enable v-sync, false to deactivate</param>
|
||||
////////////////////////////////////////////////////////////
|
||||
public virtual void UseVerticalSync(bool enable)
|
||||
{
|
||||
sfWindow_UseVerticalSync(This, enable);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Show or hide the mouse cursor
|
||||
/// </summary>
|
||||
/// <param name="show">True to show, false to hide</param>
|
||||
////////////////////////////////////////////////////////////
|
||||
public virtual void ShowMouseCursor(bool show)
|
||||
{
|
||||
sfWindow_ShowMouseCursor(This, show);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Change the position of the mouse cursor
|
||||
/// </summary>
|
||||
/// <param name="x">Left coordinate of the cursor, relative to the window</param>
|
||||
/// <param name="y">Top coordinate of the cursor, relative to the window</param>
|
||||
////////////////////////////////////////////////////////////
|
||||
public virtual void SetCursorPosition(uint x, uint y)
|
||||
{
|
||||
sfWindow_SetCursorPosition(This, x, y);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Change the position of the window on screen.
|
||||
/// Only works for top-level windows
|
||||
/// </summary>
|
||||
/// <param name="x">Left position</param>
|
||||
/// <param name="y">Top position</param>
|
||||
////////////////////////////////////////////////////////////
|
||||
public virtual void SetPosition(int x, int y)
|
||||
{
|
||||
sfWindow_SetPosition(This, x, y);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Change the size of the rendering region of the window
|
||||
/// </summary>
|
||||
/// <param name="width">New width</param>
|
||||
/// <param name="height">New height</param>
|
||||
////////////////////////////////////////////////////////////
|
||||
public virtual void SetSize(uint width, uint height)
|
||||
{
|
||||
sfWindow_SetSize(This, width, height);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Show or hide the window
|
||||
/// </summary>
|
||||
/// <param name="show">True to show, false to hide</param>
|
||||
////////////////////////////////////////////////////////////
|
||||
public virtual void Show(bool show)
|
||||
{
|
||||
sfWindow_Show(This, show);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Enable or disable automatic key-repeat.
|
||||
/// Automatic key-repeat is enabled by default
|
||||
/// </summary>
|
||||
/// <param name="enable">True to enable, false to disable</param>
|
||||
////////////////////////////////////////////////////////////
|
||||
public virtual void EnableKeyRepeat(bool enable)
|
||||
{
|
||||
sfWindow_EnableKeyRepeat(This, enable);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Change the window's icon
|
||||
/// </summary>
|
||||
/// <param name="width">Icon's width, in pixels</param>
|
||||
/// <param name="height">Icon's height, in pixels</param>
|
||||
/// <param name="pixels">Array of pixels, format must be RGBA 32 bits</param>
|
||||
////////////////////////////////////////////////////////////
|
||||
public virtual void SetIcon(uint width, uint height, byte[] pixels)
|
||||
{
|
||||
unsafe
|
||||
{
|
||||
fixed (byte* PixelsPtr = pixels)
|
||||
{
|
||||
sfWindow_SetIcon(This, width, height, PixelsPtr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Activate the window as the current target
|
||||
/// for rendering
|
||||
/// </summary>
|
||||
/// <returns>True if operation was successful, false otherwise</returns>
|
||||
////////////////////////////////////////////////////////////
|
||||
public virtual bool SetActive()
|
||||
{
|
||||
return SetActive(true);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Activate of deactivate the window as the current target
|
||||
/// for rendering
|
||||
/// </summary>
|
||||
/// <param name="active">True to activate, false to deactivate (true by default)</param>
|
||||
/// <returns>True if operation was successful, false otherwise</returns>
|
||||
////////////////////////////////////////////////////////////
|
||||
public virtual bool SetActive(bool active)
|
||||
{
|
||||
return sfWindow_SetActive(This, active);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Limit the framerate to a maximum fixed frequency
|
||||
/// </summary>
|
||||
/// <param name="limit">Framerate limit, in frames per seconds (use 0 to disable limit)</param>
|
||||
////////////////////////////////////////////////////////////
|
||||
public virtual void SetFramerateLimit(uint limit)
|
||||
{
|
||||
sfWindow_SetFramerateLimit(This, limit);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Get time elapsed since last frame
|
||||
/// </summary>
|
||||
/// <returns>Time elapsed, in seconds</returns>
|
||||
////////////////////////////////////////////////////////////
|
||||
public virtual float GetFrameTime()
|
||||
{
|
||||
return sfWindow_GetFrameTime(This);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Change the joystick threshold, ie. the value below which
|
||||
/// no move event will be generated
|
||||
/// </summary>
|
||||
/// <param name="threshold">New threshold, in range [0, 100]</param>
|
||||
////////////////////////////////////////////////////////////
|
||||
public virtual void SetJoystickThreshold(float threshold)
|
||||
{
|
||||
sfWindow_SetJoystickThreshold(This, threshold);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// OS-specific handle of the window
|
||||
/// </summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
public virtual IntPtr SystemHandle
|
||||
{
|
||||
get {return sfWindow_GetSystemHandle(This);}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Wait for a new event and dispatch it to the corresponding
|
||||
/// event handler
|
||||
/// </summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
public void WaitAndDispatchEvents()
|
||||
{
|
||||
Event e;
|
||||
if (WaitEvent(out e))
|
||||
CallEventHandler(e);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Call the event handlers for each pending event
|
||||
/// </summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
public void DispatchEvents()
|
||||
{
|
||||
Event e;
|
||||
while (GetEvent(out e))
|
||||
CallEventHandler(e);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Provide a string describing the object
|
||||
/// </summary>
|
||||
/// <returns>String description of the object</returns>
|
||||
////////////////////////////////////////////////////////////
|
||||
public override string ToString()
|
||||
{
|
||||
return "[Window]" +
|
||||
" Width(" + Width + ")" +
|
||||
" Height(" + Height + ")" +
|
||||
" Settings(" + Settings + ")";
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Constructor for derived classes
|
||||
/// </summary>
|
||||
/// <param name="thisPtr">Pointer to the internal object</param>
|
||||
/// <param name="dummy">Internal hack :)</param>
|
||||
////////////////////////////////////////////////////////////
|
||||
protected Window(IntPtr thisPtr, int dummy) :
|
||||
base(thisPtr)
|
||||
{
|
||||
// TODO : find a cleaner way of separating this constructor from Window(IntPtr handle)
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Internal function to get the next event (non-blocking)
|
||||
/// </summary>
|
||||
/// <param name="eventToFill">Variable to fill with the raw pointer to the event structure</param>
|
||||
/// <returns>True if there was an event, false otherwise</returns>
|
||||
////////////////////////////////////////////////////////////
|
||||
protected virtual bool GetEvent(out Event eventToFill)
|
||||
{
|
||||
return sfWindow_GetEvent(This, out eventToFill);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Internal function to get the next event (blocking)
|
||||
/// </summary>
|
||||
/// <param name="eventToFill">Variable to fill with the raw pointer to the event structure</param>
|
||||
/// <returns>False if any error occured</returns>
|
||||
////////////////////////////////////////////////////////////
|
||||
protected virtual bool WaitEvent(out Event eventToFill)
|
||||
{
|
||||
return sfWindow_WaitEvent(This, out eventToFill);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Handle the destruction of the object
|
||||
/// </summary>
|
||||
/// <param name="disposing">Is the GC disposing the object, or is it an explicit call ?</param>
|
||||
////////////////////////////////////////////////////////////
|
||||
protected override void Destroy(bool disposing)
|
||||
{
|
||||
sfWindow_Destroy(This);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Call the event handler for the given event
|
||||
/// </summary>
|
||||
/// <param name="e">Event to dispatch</param>
|
||||
////////////////////////////////////////////////////////////
|
||||
private void CallEventHandler(Event e)
|
||||
{
|
||||
switch (e.Type)
|
||||
{
|
||||
case EventType.Closed :
|
||||
if (Closed != null)
|
||||
Closed(this, EventArgs.Empty);
|
||||
break;
|
||||
|
||||
case EventType.GainedFocus :
|
||||
if (GainedFocus != null)
|
||||
GainedFocus(this, EventArgs.Empty);
|
||||
break;
|
||||
|
||||
case EventType.JoyButtonPressed :
|
||||
if (JoyButtonPressed != null)
|
||||
JoyButtonPressed(this, new JoyButtonEventArgs(e.JoyButton));
|
||||
break;
|
||||
|
||||
case EventType.JoyButtonReleased :
|
||||
if (JoyButtonReleased != null)
|
||||
JoyButtonReleased(this, new JoyButtonEventArgs(e.JoyButton));
|
||||
break;
|
||||
|
||||
case EventType.JoyMoved :
|
||||
if (JoyMoved != null)
|
||||
JoyMoved(this, new JoyMoveEventArgs(e.JoyMove));
|
||||
break;
|
||||
|
||||
case EventType.KeyPressed :
|
||||
if (KeyPressed != null)
|
||||
KeyPressed(this, new KeyEventArgs(e.Key));
|
||||
break;
|
||||
|
||||
case EventType.KeyReleased :
|
||||
if (KeyReleased != null)
|
||||
KeyReleased(this, new KeyEventArgs(e.Key));
|
||||
break;
|
||||
|
||||
case EventType.LostFocus :
|
||||
if (LostFocus != null)
|
||||
LostFocus(this, EventArgs.Empty);
|
||||
break;
|
||||
|
||||
case EventType.MouseButtonPressed :
|
||||
if (MouseButtonPressed != null)
|
||||
MouseButtonPressed(this, new MouseButtonEventArgs(e.MouseButton));
|
||||
break;
|
||||
|
||||
case EventType.MouseButtonReleased :
|
||||
if (MouseButtonReleased != null)
|
||||
MouseButtonReleased(this, new MouseButtonEventArgs(e.MouseButton));
|
||||
break;
|
||||
|
||||
case EventType.MouseEntered :
|
||||
if (MouseEntered != null)
|
||||
MouseEntered(this, EventArgs.Empty);
|
||||
break;
|
||||
|
||||
case EventType.MouseLeft :
|
||||
if (MouseLeft != null)
|
||||
MouseLeft(this, EventArgs.Empty);
|
||||
break;
|
||||
|
||||
case EventType.MouseMoved :
|
||||
if (MouseMoved != null)
|
||||
MouseMoved(this, new MouseMoveEventArgs(e.MouseMove));
|
||||
break;
|
||||
|
||||
case EventType.MouseWheelMoved :
|
||||
if (MouseWheelMoved != null)
|
||||
MouseWheelMoved(this, new MouseWheelEventArgs(e.MouseWheel));
|
||||
break;
|
||||
|
||||
case EventType.Resized :
|
||||
if (Resized != null)
|
||||
Resized(this, new SizeEventArgs(e.Size));
|
||||
break;
|
||||
|
||||
case EventType.TextEntered :
|
||||
if (TextEntered != null)
|
||||
TextEntered(this, new TextEventArgs(e.Text));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Event handler for the Closed event</summary>
|
||||
public event EventHandler Closed = null;
|
||||
|
||||
/// <summary>Event handler for the Resized event</summary>
|
||||
public event EventHandler<SizeEventArgs> Resized = null;
|
||||
|
||||
/// <summary>Event handler for the LostFocus event</summary>
|
||||
public event EventHandler LostFocus = null;
|
||||
|
||||
/// <summary>Event handler for the GainedFocus event</summary>
|
||||
public event EventHandler GainedFocus = null;
|
||||
|
||||
/// <summary>Event handler for the TextEntered event</summary>
|
||||
public event EventHandler<TextEventArgs> TextEntered = null;
|
||||
|
||||
/// <summary>Event handler for the KeyPressed event</summary>
|
||||
public event EventHandler<KeyEventArgs> KeyPressed = null;
|
||||
|
||||
/// <summary>Event handler for the KeyReleased event</summary>
|
||||
public event EventHandler<KeyEventArgs> KeyReleased = null;
|
||||
|
||||
/// <summary>Event handler for the MouseWheelMoved event</summary>
|
||||
public event EventHandler<MouseWheelEventArgs> MouseWheelMoved = null;
|
||||
|
||||
/// <summary>Event handler for the MouseButtonPressed event</summary>
|
||||
public event EventHandler<MouseButtonEventArgs> MouseButtonPressed = null;
|
||||
|
||||
/// <summary>Event handler for the MouseButtonReleased event</summary>
|
||||
public event EventHandler<MouseButtonEventArgs> MouseButtonReleased = null;
|
||||
|
||||
/// <summary>Event handler for the MouseMoved event</summary>
|
||||
public event EventHandler<MouseMoveEventArgs> MouseMoved = null;
|
||||
|
||||
/// <summary>Event handler for the MouseEntered event</summary>
|
||||
public event EventHandler MouseEntered = null;
|
||||
|
||||
/// <summary>Event handler for the MouseLeft event</summary>
|
||||
public event EventHandler MouseLeft = null;
|
||||
|
||||
/// <summary>Event handler for the JoyButtonPressed event</summary>
|
||||
public event EventHandler<JoyButtonEventArgs> JoyButtonPressed = null;
|
||||
|
||||
/// <summary>Event handler for the JoyButtonReleased event</summary>
|
||||
public event EventHandler<JoyButtonEventArgs> JoyButtonReleased = null;
|
||||
|
||||
/// <summary>Event handler for the JoyMoved event</summary>
|
||||
public event EventHandler<JoyMoveEventArgs> JoyMoved = null;
|
||||
|
||||
protected Input myInput = null;
|
||||
|
||||
#region Imports
|
||||
[DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr sfWindow_Create(VideoMode Mode, string Title, Styles Style, ref ContextSettings Params);
|
||||
|
||||
[DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr sfWindow_CreateFromHandle(IntPtr Handle, ref ContextSettings Params);
|
||||
|
||||
[DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
||||
static extern void sfWindow_Destroy(IntPtr This);
|
||||
|
||||
[DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr sfWindow_GetInput(IntPtr This);
|
||||
|
||||
[DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
||||
static extern bool sfWindow_IsOpened(IntPtr This);
|
||||
|
||||
[DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
||||
static extern void sfWindow_Close(IntPtr This);
|
||||
|
||||
[DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
||||
static extern bool sfWindow_GetEvent(IntPtr This, out Event Evt);
|
||||
|
||||
[DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
||||
static extern bool sfWindow_WaitEvent(IntPtr This, out Event Evt);
|
||||
|
||||
[DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
||||
static extern void sfWindow_Display(IntPtr This);
|
||||
|
||||
[DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
||||
static extern uint sfWindow_GetWidth(IntPtr This);
|
||||
|
||||
[DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
||||
static extern uint sfWindow_GetHeight(IntPtr This);
|
||||
|
||||
[DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
||||
static extern ContextSettings sfWindow_GetSettings(IntPtr This);
|
||||
|
||||
[DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
||||
static extern void sfWindow_UseVerticalSync(IntPtr This, bool Enable);
|
||||
|
||||
[DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
||||
static extern void sfWindow_ShowMouseCursor(IntPtr This, bool Show);
|
||||
|
||||
[DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
||||
static extern void sfWindow_SetCursorPosition(IntPtr This, uint X, uint Y);
|
||||
|
||||
[DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
||||
static extern void sfWindow_SetPosition(IntPtr This, int X, int Y);
|
||||
|
||||
[DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
||||
static extern void sfWindow_SetSize(IntPtr This, uint Width, uint Height);
|
||||
|
||||
[DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
||||
static extern void sfWindow_Show(IntPtr This, bool Show);
|
||||
|
||||
[DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
||||
static extern void sfWindow_EnableKeyRepeat(IntPtr This, bool Enable);
|
||||
|
||||
[DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
||||
unsafe static extern void sfWindow_SetIcon(IntPtr This, uint Width, uint Height, byte* Pixels);
|
||||
|
||||
[DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
||||
static extern bool sfWindow_SetActive(IntPtr This, bool Active);
|
||||
|
||||
[DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
||||
static extern void sfWindow_SetFramerateLimit(IntPtr This, uint Limit);
|
||||
|
||||
[DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
||||
static extern float sfWindow_GetFrameTime(IntPtr This);
|
||||
|
||||
[DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
||||
static extern void sfWindow_SetJoystickThreshold(IntPtr This, float Threshold);
|
||||
|
||||
[DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr sfWindow_GetSystemHandle(IntPtr This);
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
63
bindings/dotnet/src/Window/sfml-window.csproj
Normal file
63
bindings/dotnet/src/Window/sfml-window.csproj
Normal file
|
@ -0,0 +1,63 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.21022</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{D17DE83D-A592-461F-8AF2-53F9E22E1D0F}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>SFML.Window</RootNamespace>
|
||||
<AssemblyName>sfmlnet-window-2</AssemblyName>
|
||||
<StartupObject>
|
||||
</StartupObject>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<OldToolsVersion>2.0</OldToolsVersion>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\lib\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<DocumentationFile>..\..\doc\build\window-doc.xml</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\..\lib\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<DocumentationFile>..\..\doc\build\window-doc.xml</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
<ItemGroup>
|
||||
<Compile Include="ContextSettings.cs" />
|
||||
<Compile Include="Event.cs" />
|
||||
<Compile Include="EventArgs.cs" />
|
||||
<Compile Include="Input.cs" />
|
||||
<Compile Include="LoadingFailedException.cs" />
|
||||
<Compile Include="ObjectBase.cs" />
|
||||
<Compile Include="VideoMode.cs" />
|
||||
<Compile Include="Window.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Properties\" />
|
||||
</ItemGroup>
|
||||
</Project>
|
Loading…
Add table
Add a link
Reference in a new issue