Updated CSFML and SFML.Net to the new input classes

This commit is contained in:
Laurent Gomila 2011-07-05 23:04:03 +02:00 committed by Marco Antognini
parent 3cd3e88e0e
commit 7d2fa550c0
54 changed files with 1503 additions and 955 deletions

View file

@ -27,7 +27,7 @@ namespace opengl
// Create a text to display
Text text = new Text("SFML / OpenGL demo");
text.Position = new Vector2(250.0F, 450.0F);
text.Position = new Vector2f(250.0F, 450.0F);
text.Color = new Color(255, 255, 255, 170);
// Load an OpenGL texture.
@ -83,8 +83,8 @@ namespace opengl
Gl.glClear(Gl.GL_DEPTH_BUFFER_BIT);
// We get the position of the mouse cursor, so that we can move the box accordingly
float x = window.Input.GetMouseX() * 200.0F / window.Width - 100.0F;
float y = -window.Input.GetMouseY() * 200.0F / window.Height + 100.0F;
float x = window.GetCursorPosition().X * 200.0F / window.Width - 100.0F;
float y = -window.GetCursorPosition().Y * 200.0F / window.Height + 100.0F;
// Apply some transformations
time += window.GetFrameTime() / 1000.0F;
@ -159,7 +159,7 @@ namespace opengl
static void OnKeyPressed(object sender, KeyEventArgs e)
{
RenderWindow window = (RenderWindow)sender;
if (e.Code == KeyCode.Escape)
if (e.Code == Keyboard.Key.Escape)
window.Close();
}

View file

@ -125,7 +125,7 @@ namespace shader
shaderText = new Text();
shaderText.Font = font;
shaderText.CharacterSize = 20;
shaderText.Position = new Vector2(5.0F, 0.0F);
shaderText.Position = new Vector2f(5.0F, 0.0F);
shaderText.Color = new Color(250, 100, 30);
shaderText.DisplayedString = "Background shader: \"" + backgroundShader.Name + "\"\n" +
"Flower shader: \"" + entityShader.Name + "\"\n" +
@ -135,7 +135,7 @@ namespace shader
Text infoText = new Text();
infoText.Font = font;
infoText.CharacterSize = 20;
infoText.Position = new Vector2(5.0F, 500.0F);
infoText.Position = new Vector2f(5.0F, 500.0F);
infoText.Color = new Color(250, 100, 30);
infoText.DisplayedString = "Move your mouse to change the shaders' parameters\n" +
"Press numpad 1 to change the background shader\n" +
@ -149,12 +149,9 @@ namespace shader
// Process events
window.DispatchEvents();
// TOFIX -- using window.Input together with image.Draw apparently causes a memory corruption
// Get the mouse position in the range [0, 1]
//float x = window.Input.GetMouseX() / (float)window.Width;
//float y = window.Input.GetMouseY() / (float)window.Height;
float x = (float)(Math.Cos(time * 1.3) + 1) * 0.5F;
float y = (float)(Math.Sin(time * 0.8) + 1) * 0.5F;
float x = window.GetCursorPosition().X / (float)window.Width;
float y = window.GetCursorPosition().Y / (float)window.Height;
// Update the shaders
backgroundShader.Update(x, y);
@ -162,10 +159,10 @@ namespace shader
globalShader.Update(x, y);
// Animate the sprite
time += window.GetFrameTime();
time += window.GetFrameTime() / 1000.0F;
float entityX = (float)(Math.Cos(time * 1.3) + 1.2) * 300;
float entityY = (float)(Math.Cos(time * 0.8) + 1.2) * 200;
entity.Position = new Vector2(entityX, entityY);
entity.Position = new Vector2f(entityX, entityY);
entity.Rotation = time * 100;
// Draw the background and the moving entity to the render image
@ -193,7 +190,7 @@ namespace shader
{
// Define a string for displaying the error message
Text error = new Text("Sorry, your system doesn't support shaders");
error.Position = new Vector2(100.0F, 250.0F);
error.Position = new Vector2f(100.0F, 250.0F);
error.Color = new Color(200, 100, 150);
// Start the game loop
@ -230,15 +227,15 @@ namespace shader
RenderWindow window = (RenderWindow)sender;
// Escape key : exit
if (e.Code == KeyCode.Escape)
if (e.Code == Keyboard.Key.Escape)
window.Close();
// Numpad : switch effect
switch (e.Code)
{
case KeyCode.Numpad1 : backgroundShader.GotoNext(); break;
case KeyCode.Numpad2 : entityShader.GotoNext(); break;
case KeyCode.Numpad3 : globalShader.GotoNext(); break;
case Keyboard.Key.Numpad1: backgroundShader.GotoNext(); break;
case Keyboard.Key.Numpad2: entityShader.GotoNext(); break;
case Keyboard.Key.Numpad3: globalShader.GotoNext(); break;
}
// Update the text

View file

@ -119,7 +119,7 @@ namespace window
static void OnKeyPressed(object sender, KeyEventArgs e)
{
Window window = (Window)sender;
if (e.Code == KeyCode.Escape)
if (e.Code == Keyboard.Key.Escape)
window.Close();
}

View file

@ -31,9 +31,9 @@ namespace SFML
/// 3D position of the listener (default is (0, 0, 0))
/// </summary>
////////////////////////////////////////////////////////////
public static Vector3 Position
public static Vector3f Position
{
get {Vector3 v; sfListener_GetPosition(out v.X, out v.Y, out v.Z); return v;}
get {Vector3f v; sfListener_GetPosition(out v.X, out v.Y, out v.Z); return v;}
set {sfListener_SetPosition(value.X, value.Y, value.Z);}
}
@ -42,9 +42,9 @@ namespace SFML
/// 3D direction of the listener (default is (0, 0, -1))
/// </summary>
////////////////////////////////////////////////////////////
public static Vector3 Direction
public static Vector3f Direction
{
get {Vector3 v; sfListener_GetDirection(out v.X, out v.Y, out v.Z); return v;}
get {Vector3f v; sfListener_GetDirection(out v.X, out v.Y, out v.Z); return v;}
set {sfListener_SetDirection(value.X, value.Y, value.Z);}
}

View file

@ -159,9 +159,9 @@ namespace SFML
/// 3D position of the music. Default value is (0, 0, 0)
/// </summary>
////////////////////////////////////////////////////////////
public Vector3 Position
public Vector3f Position
{
get {Vector3 v; sfMusic_GetPosition(This, out v.X, out v.Y, out v.Z); return v;}
get {Vector3f v; sfMusic_GetPosition(This, out v.X, out v.Y, out v.Z); return v;}
set {sfMusic_SetPosition(This, value.X, value.Y, value.Z);}
}

View file

@ -165,9 +165,9 @@ namespace SFML
/// 3D position of the sound. Default value is (0, 0, 0)
/// </summary>
////////////////////////////////////////////////////////////
public Vector3 Position
public Vector3f Position
{
get {Vector3 v; sfSound_GetPosition(This, out v.X, out v.Y, out v.Z); return v;}
get {Vector3f v; sfSound_GetPosition(This, out v.X, out v.Y, out v.Z); return v;}
set {sfSound_SetPosition(This, value.X, value.Y, value.Z);}
}

View file

@ -124,9 +124,9 @@ namespace SFML
/// 3D position of the sound stream. Default value is (0, 0, 0)
/// </summary>
////////////////////////////////////////////////////////////
public Vector3 Position
public Vector3f Position
{
get {Vector3 v; sfSoundStream_GetPosition(This, out v.X, out v.Y, out v.Z); return v;}
get {Vector3f v; sfSoundStream_GetPosition(This, out v.X, out v.Y, out v.Z); return v;}
set {sfSoundStream_SetPosition(This, value.X, value.Y, value.Z);}
}

View file

@ -7,12 +7,12 @@ namespace SFML
{
////////////////////////////////////////////////////////////
/// <summary>
/// Vector3 is an utility class for manipulating 3 dimensional
/// Vector3f is an utility class for manipulating 3 dimensional
/// vectors with float components
/// </summary>
////////////////////////////////////////////////////////////
[StructLayout(LayoutKind.Sequential)]
public struct Vector3
public struct Vector3f
{
////////////////////////////////////////////////////////////
/// <summary>
@ -22,7 +22,7 @@ namespace SFML
/// <param name="y">Y coordinate</param>
/// <param name="z">Z coordinate</param>
////////////////////////////////////////////////////////////
public Vector3(float x, float y, float z)
public Vector3f(float x, float y, float z)
{
X = x;
Y = y;
@ -36,9 +36,9 @@ namespace SFML
/// <param name="v">Vector to negate</param>
/// <returns>-v</returns>
////////////////////////////////////////////////////////////
public static Vector3 operator -(Vector3 v)
public static Vector3f operator -(Vector3f v)
{
return new Vector3(-v.X, -v.Y, -v.Z);
return new Vector3f(-v.X, -v.Y, -v.Z);
}
////////////////////////////////////////////////////////////
@ -49,9 +49,9 @@ namespace SFML
/// <param name="v2">Second vector</param>
/// <returns>v1 - v2</returns>
////////////////////////////////////////////////////////////
public static Vector3 operator -(Vector3 v1, Vector3 v2)
public static Vector3f operator -(Vector3f v1, Vector3f v2)
{
return new Vector3(v1.X - v2.X, v1.Y - v2.X, v1.Z - v2.Z);
return new Vector3f(v1.X - v2.X, v1.Y - v2.X, v1.Z - v2.Z);
}
////////////////////////////////////////////////////////////
@ -62,9 +62,9 @@ namespace SFML
/// <param name="v2">Second vector</param>
/// <returns>v1 + v2</returns>
////////////////////////////////////////////////////////////
public static Vector3 operator +(Vector3 v1, Vector3 v2)
public static Vector3f operator +(Vector3f v1, Vector3f v2)
{
return new Vector3(v1.X + v2.X, v1.Y + v2.X, v1.Z + v2.Z);
return new Vector3f(v1.X + v2.X, v1.Y + v2.X, v1.Z + v2.Z);
}
////////////////////////////////////////////////////////////
@ -75,9 +75,9 @@ namespace SFML
/// <param name="x">Scalar value</param>
/// <returns>v * x</returns>
////////////////////////////////////////////////////////////
public static Vector3 operator *(Vector3 v, float x)
public static Vector3f operator *(Vector3f v, float x)
{
return new Vector3(v.X * x, v.Y * x, v.Z * x);
return new Vector3f(v.X * x, v.Y * x, v.Z * x);
}
////////////////////////////////////////////////////////////
@ -88,9 +88,9 @@ namespace SFML
/// <param name="v">Vector</param>
/// <returns>x * v</returns>
////////////////////////////////////////////////////////////
public static Vector3 operator *(float x, Vector3 v)
public static Vector3f operator *(float x, Vector3f v)
{
return new Vector3(v.X * x, v.Y * x, v.Z * x);
return new Vector3f(v.X * x, v.Y * x, v.Z * x);
}
////////////////////////////////////////////////////////////
@ -101,9 +101,9 @@ namespace SFML
/// <param name="x">Scalar value</param>
/// <returns>v / x</returns>
////////////////////////////////////////////////////////////
public static Vector3 operator /(Vector3 v, float x)
public static Vector3f operator /(Vector3f v, float x)
{
return new Vector3(v.X / x, v.Y / x, v.Z / x);
return new Vector3f(v.X / x, v.Y / x, v.Z / x);
}
////////////////////////////////////////////////////////////
@ -114,7 +114,7 @@ namespace SFML
////////////////////////////////////////////////////////////
public override string ToString()
{
return "[Vector3]" +
return "[Vector3f]" +
" X(" + X + ")" +
" Y(" + Y + ")" +
" Z(" + Z + ")";

View file

@ -1,5 +1,6 @@
using System;
using System.Runtime.InteropServices;
using SFML.Window;
namespace SFML
{
@ -38,7 +39,7 @@ namespace SFML
/// Position of the object on screen
/// </summary>
////////////////////////////////////////////////////////////
public abstract Vector2 Position {get; set;}
public abstract Vector2f Position { get; set; }
////////////////////////////////////////////////////////////
/// <summary>
@ -52,7 +53,7 @@ namespace SFML
/// Vertical and horizontal scale of the object
/// </summary>
////////////////////////////////////////////////////////////
public abstract Vector2 Scale {get; set;}
public abstract Vector2f Scale { get; set; }
////////////////////////////////////////////////////////////
/// <summary>
@ -60,7 +61,7 @@ namespace SFML
/// (center of translation, rotation and scale)
/// </summary>
////////////////////////////////////////////////////////////
public abstract Vector2 Origin {get; set;}
public abstract Vector2f Origin { get; set; }
////////////////////////////////////////////////////////////
/// <summary>
@ -84,7 +85,7 @@ namespace SFML
/// <param name="point">Point to transform</param>
/// <returns>Transformed point</returns>
////////////////////////////////////////////////////////////
public abstract Vector2 TransformToLocal(Vector2 point);
public abstract Vector2f TransformToLocal(Vector2f point);
////////////////////////////////////////////////////////////
/// <summary>
@ -94,7 +95,7 @@ namespace SFML
/// <param name="point">Point to transform</param>
/// <returns>Transformed point</returns>
////////////////////////////////////////////////////////////
public abstract Vector2 TransformToGlobal(Vector2 point);
public abstract Vector2f TransformToGlobal(Vector2f point);
////////////////////////////////////////////////////////////
/// <summary>

View file

@ -134,7 +134,7 @@ namespace SFML
/// <returns>Converted point</returns>
///
////////////////////////////////////////////////////////////
public Vector2 ConvertCoords(uint x, uint y)
public Vector2f ConvertCoords(uint x, uint y)
{
return ConvertCoords(x, y, GetView());
}
@ -150,9 +150,9 @@ namespace SFML
/// <returns>Converted point</returns>
///
////////////////////////////////////////////////////////////
public Vector2 ConvertCoords(uint x, uint y, View view)
public Vector2f ConvertCoords(uint x, uint y, View view)
{
Vector2 point;
Vector2f point;
sfRenderImage_ConvertCoords(This, x, y, out point.X, out point.Y, view.This);
return point;

View file

@ -69,7 +69,7 @@ namespace SFML
/// <param name="y">Y coordinate of the point to convert, relative to the target</param>
/// <returns>Converted point</returns>
////////////////////////////////////////////////////////////
Vector2 ConvertCoords(uint x, uint y);
Vector2f ConvertCoords(uint x, uint y);
////////////////////////////////////////////////////////////
/// <summary>
@ -81,7 +81,7 @@ namespace SFML
/// <param name="view">Target view to convert the point to</param>
/// <returns>Converted point</returns>
////////////////////////////////////////////////////////////
Vector2 ConvertCoords(uint x, uint y, View view);
Vector2f ConvertCoords(uint x, uint y, View view);
////////////////////////////////////////////////////////////
/// <summary>

View file

@ -369,7 +369,7 @@ namespace SFML
/// <returns>Converted point</returns>
///
////////////////////////////////////////////////////////////
public Vector2 ConvertCoords(uint x, uint y)
public Vector2f ConvertCoords(uint x, uint y)
{
return ConvertCoords(x, y, GetView());
}
@ -385,9 +385,9 @@ namespace SFML
/// <returns>Converted point</returns>
///
////////////////////////////////////////////////////////////
public Vector2 ConvertCoords(uint x, uint y, View view)
public Vector2f ConvertCoords(uint x, uint y, View view)
{
Vector2 point;
Vector2f point;
sfRenderWindow_ConvertCoords(This, x, y, out point.X, out point.Y, view.This);
return point;
@ -518,7 +518,6 @@ namespace SFML
////////////////////////////////////////////////////////////
private void Initialize()
{
myInput = new Input(sfRenderWindow_GetInput(This));
myDefaultView = new View(sfRenderWindow_GetDefaultView(This));
GC.SuppressFinalize(myDefaultView);
}
@ -535,9 +534,6 @@ namespace SFML
[DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
static extern void sfRenderWindow_Destroy(IntPtr This);
[DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
static extern IntPtr sfRenderWindow_GetInput(IntPtr This);
[DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
static extern bool sfRenderWindow_IsOpened(IntPtr This);

View file

@ -2,6 +2,7 @@ using System;
using System.Runtime.InteropServices;
using System.Security;
using System.Collections.Generic;
using SFML.Window;
namespace SFML
{
@ -64,7 +65,7 @@ namespace SFML
/// <param name="name">Name of the parameter in the shader</param>
/// <param name="v">Value of the parameter</param>
////////////////////////////////////////////////////////////
public void SetParameter(string name, Vector2 v)
public void SetParameter(string name, Vector2f v)
{
SetParameter(name, v.X, v.Y);
}

View file

@ -1,6 +1,7 @@
using System;
using System.Runtime.InteropServices;
using System.Security;
using SFML.Window;
namespace SFML
{
@ -41,9 +42,9 @@ namespace SFML
/// Position of the object on screen
/// </summary>
////////////////////////////////////////////////////////////
public override Vector2 Position
public override Vector2f Position
{
get { return new Vector2(sfShape_GetX(This), sfShape_GetY(This)); }
get { return new Vector2f(sfShape_GetX(This), sfShape_GetY(This)); }
set { sfShape_SetPosition(This, value.X, value.Y); }
}
@ -63,9 +64,9 @@ namespace SFML
/// Vertical and horizontal scale of the object
/// </summary>
////////////////////////////////////////////////////////////
public override Vector2 Scale
public override Vector2f Scale
{
get { return new Vector2(sfShape_GetScaleX(This), sfShape_GetScaleY(This)); }
get { return new Vector2f(sfShape_GetScaleX(This), sfShape_GetScaleY(This)); }
set { sfShape_SetScale(This, value.X, value.Y); }
}
@ -75,9 +76,9 @@ namespace SFML
/// (center of translation, rotation and scale)
/// </summary>
////////////////////////////////////////////////////////////
public override Vector2 Origin
public override Vector2f Origin
{
get { return new Vector2(sfShape_GetOriginX(This), sfShape_GetOriginY(This)); }
get { return new Vector2f(sfShape_GetOriginX(This), sfShape_GetOriginY(This)); }
set { sfShape_SetOrigin(This, value.X, value.Y); }
}
@ -111,9 +112,9 @@ namespace SFML
/// <param name="point">Point to transform</param>
/// <returns>Transformed point</returns>
////////////////////////////////////////////////////////////
public override Vector2 TransformToLocal(Vector2 point)
public override Vector2f TransformToLocal(Vector2f point)
{
Vector2 Transformed;
Vector2f Transformed;
sfShape_TransformToLocal(This, point.X, point.Y, out Transformed.X, out Transformed.Y);
return Transformed;
@ -127,9 +128,9 @@ namespace SFML
/// <param name="point">Point to transform</param>
/// <returns>Transformed point</returns>
////////////////////////////////////////////////////////////
public override Vector2 TransformToGlobal(Vector2 point)
public override Vector2f TransformToGlobal(Vector2f point)
{
Vector2 Transformed;
Vector2f Transformed;
sfShape_TransformToGlobal(This, point.X, point.Y, out Transformed.X, out Transformed.Y);
return Transformed;
@ -142,7 +143,7 @@ namespace SFML
/// <param name="position">Position of the point</param>
/// <param name="color">Color of the point</param>
////////////////////////////////////////////////////////////
public void AddPoint(Vector2 position, Color color)
public void AddPoint(Vector2f position, Color color)
{
AddPoint(position, color, Color.Black);
}
@ -155,7 +156,7 @@ namespace SFML
/// <param name="color">Color of the point</param>
/// <param name="outlineColor">Outline color of the point</param>
////////////////////////////////////////////////////////////
public void AddPoint(Vector2 position, Color color, Color outlineColor)
public void AddPoint(Vector2f position, Color color, Color outlineColor)
{
sfShape_AddPoint(This, position.X, position.Y, color, outlineColor);
}
@ -212,7 +213,7 @@ namespace SFML
/// <param name="index">Index of the point, in range [0, NbPoints - 1]</param>
/// <param name="position">New position of the index-th point</param>
////////////////////////////////////////////////////////////
public void SetPointPosition(uint index, Vector2 position)
public void SetPointPosition(uint index, Vector2f position)
{
sfShape_SetPointPosition(This, index, position.X, position.Y);
}
@ -224,9 +225,9 @@ namespace SFML
/// <param name="index">Index of the point, in range [0, NbPoints - 1]</param>
/// <returns>Position of the index-th point</returns>
////////////////////////////////////////////////////////////
public Vector2 GetPointPosition(uint index)
public Vector2f GetPointPosition(uint index)
{
Vector2 Pos;
Vector2f Pos;
sfShape_GetPointPosition(This, index, out Pos.X, out Pos.Y);
return Pos;
@ -290,7 +291,7 @@ namespace SFML
/// <param name="color">Color used to draw the line</param>
/// <returns>New line shape built with the given parameters</returns>
////////////////////////////////////////////////////////////
public static Shape Line(Vector2 p1, Vector2 p2, float thickness, Color color)
public static Shape Line(Vector2f p1, Vector2f p2, float thickness, Color color)
{
return Line(p1, p2, thickness, color, 0, Color.White);
}
@ -307,7 +308,7 @@ namespace SFML
/// <param name="outlineColor">Color used to draw the outline</param>
/// <returns>New line shape built with the given parameters</returns>
////////////////////////////////////////////////////////////
public static Shape Line(Vector2 p1, Vector2 p2, float thickness, Color color, float outline, Color outlineColor)
public static Shape Line(Vector2f p1, Vector2f p2, float thickness, Color color, float outline, Color outlineColor)
{
return new Shape(sfShape_CreateLine(p1.X, p1.Y, p2.X, p2.Y, thickness, color, outline, outlineColor));
}
@ -349,7 +350,7 @@ namespace SFML
/// <param name="color">Color used to fill the circle</param>
/// <returns>New circle shape built with the given parameters</returns>
////////////////////////////////////////////////////////////
public static Shape Circle(Vector2 center, float radius, Color color)
public static Shape Circle(Vector2f center, float radius, Color color)
{
return Circle(center, radius, color, 0, Color.White);
}
@ -365,7 +366,7 @@ namespace SFML
/// <param name="outlineColor">Color used to draw the outline</param>
/// <returns>New circle shape built with the given parameters</returns>
////////////////////////////////////////////////////////////
public static Shape Circle(Vector2 center, float radius, Color color, float outline, Color outlineColor)
public static Shape Circle(Vector2f center, float radius, Color color, float outline, Color outlineColor)
{
return new Shape(sfShape_CreateCircle(center.X, center.Y, radius, color, outline, outlineColor));
}
@ -497,10 +498,10 @@ namespace SFML
static extern BlendMode sfShape_GetBlendMode(IntPtr This);
[DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
static extern Vector2 sfShape_TransformToLocal(IntPtr This, float PointX, float PointY, out float X, out float Y);
static extern void sfShape_TransformToLocal(IntPtr This, float PointX, float PointY, out float X, out float Y);
[DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
static extern Vector2 sfShape_TransformToGlobal(IntPtr This, float PointX, float PointY, out float X, out float Y);
static extern void sfShape_TransformToGlobal(IntPtr This, float PointX, float PointY, out float X, out float Y);
[DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
static extern void sfRenderWindow_DrawShape(IntPtr This, IntPtr Shape);

View file

@ -1,6 +1,7 @@
using System;
using System.Security;
using System.Runtime.InteropServices;
using SFML.Window;
namespace SFML
{
@ -53,9 +54,9 @@ namespace SFML
/// Position of the object on screen
/// </summary>
////////////////////////////////////////////////////////////
public override Vector2 Position
public override Vector2f Position
{
get { return new Vector2(sfSprite_GetX(This), sfSprite_GetY(This)); }
get { return new Vector2f(sfSprite_GetX(This), sfSprite_GetY(This)); }
set { sfSprite_SetPosition(This, value.X, value.Y); }
}
@ -75,9 +76,9 @@ namespace SFML
/// Vertical and horizontal scale of the object
/// </summary>
////////////////////////////////////////////////////////////
public override Vector2 Scale
public override Vector2f Scale
{
get { return new Vector2(sfSprite_GetScaleX(This), sfSprite_GetScaleY(This)); }
get { return new Vector2f(sfSprite_GetScaleX(This), sfSprite_GetScaleY(This)); }
set { sfSprite_SetScale(This, value.X, value.Y); }
}
@ -87,9 +88,9 @@ namespace SFML
/// (center of translation, rotation and scale)
/// </summary>
////////////////////////////////////////////////////////////
public override Vector2 Origin
public override Vector2f Origin
{
get { return new Vector2(sfSprite_GetOriginX(This), sfSprite_GetOriginY(This)); }
get { return new Vector2f(sfSprite_GetOriginX(This), sfSprite_GetOriginY(This)); }
set { sfSprite_SetOrigin(This, value.X, value.Y); }
}
@ -123,9 +124,9 @@ namespace SFML
/// <param name="point">Point to transform</param>
/// <returns>Transformed point</returns>
////////////////////////////////////////////////////////////
public override Vector2 TransformToLocal(Vector2 point)
public override Vector2f TransformToLocal(Vector2f point)
{
Vector2 Transformed;
Vector2f Transformed;
sfSprite_TransformToLocal(This, point.X, point.Y, out Transformed.X, out Transformed.Y);
return Transformed;
@ -139,9 +140,9 @@ namespace SFML
/// <param name="point">Point to transform</param>
/// <returns>Transformed point</returns>
////////////////////////////////////////////////////////////
public override Vector2 TransformToGlobal(Vector2 point)
public override Vector2f TransformToGlobal(Vector2f point)
{
Vector2 Transformed;
Vector2f Transformed;
sfSprite_TransformToGlobal(This, point.X, point.Y, out Transformed.X, out Transformed.Y);
return Transformed;
@ -347,10 +348,10 @@ namespace SFML
static extern BlendMode sfSprite_GetBlendMode(IntPtr This);
[DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
static extern Vector2 sfSprite_TransformToLocal(IntPtr This, float PointX, float PointY, out float X, out float Y);
static extern Vector2f sfSprite_TransformToLocal(IntPtr This, float PointX, float PointY, out float X, out float Y);
[DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
static extern Vector2 sfSprite_TransformToGlobal(IntPtr This, float PointX, float PointY, out float X, out float Y);
static extern Vector2f sfSprite_TransformToGlobal(IntPtr This, float PointX, float PointY, out float X, out float Y);
[DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
static extern void sfRenderWindow_DrawSprite(IntPtr This, IntPtr Sprite);

View file

@ -1,6 +1,7 @@
using System;
using System.Security;
using System.Runtime.InteropServices;
using SFML.Window;
namespace SFML
{
@ -100,9 +101,9 @@ namespace SFML
/// Position of the object on screen
/// </summary>
////////////////////////////////////////////////////////////
public override Vector2 Position
public override Vector2f Position
{
get { return new Vector2(sfText_GetX(This), sfText_GetY(This)); }
get { return new Vector2f(sfText_GetX(This), sfText_GetY(This)); }
set { sfText_SetPosition(This, value.X, value.Y); }
}
@ -122,9 +123,9 @@ namespace SFML
/// Vertical and horizontal scale of the object
/// </summary>
////////////////////////////////////////////////////////////
public override Vector2 Scale
public override Vector2f Scale
{
get { return new Vector2(sfText_GetScaleX(This), sfText_GetScaleY(This)); }
get { return new Vector2f(sfText_GetScaleX(This), sfText_GetScaleY(This)); }
set { sfText_SetScale(This, value.X, value.Y); }
}
@ -134,9 +135,9 @@ namespace SFML
/// (center of translation, rotation and scale)
/// </summary>
////////////////////////////////////////////////////////////
public override Vector2 Origin
public override Vector2f Origin
{
get { return new Vector2(sfText_GetOriginX(This), sfText_GetOriginY(This)); }
get { return new Vector2f(sfText_GetOriginX(This), sfText_GetOriginY(This)); }
set { sfText_SetOrigin(This, value.X, value.Y); }
}
@ -170,9 +171,9 @@ namespace SFML
/// <param name="point">Point to transform</param>
/// <returns>Transformed point</returns>
////////////////////////////////////////////////////////////
public override Vector2 TransformToLocal(Vector2 point)
public override Vector2f TransformToLocal(Vector2f point)
{
Vector2 Transformed;
Vector2f Transformed;
sfText_TransformToLocal(This, point.X, point.Y, out Transformed.X, out Transformed.Y);
return Transformed;
@ -186,9 +187,9 @@ namespace SFML
/// <param name="point">Point to transform</param>
/// <returns>Transformed point</returns>
////////////////////////////////////////////////////////////
public override Vector2 TransformToGlobal(Vector2 point)
public override Vector2f TransformToGlobal(Vector2f point)
{
Vector2 Transformed;
Vector2f Transformed;
sfText_TransformToGlobal(This, point.X, point.Y, out Transformed.X, out Transformed.Y);
return Transformed;
@ -282,9 +283,9 @@ namespace SFML
/// <param name="index">Index of the character</param>
/// <returns>Position of the Index-th character (end of text if Index is out of range)</returns>
////////////////////////////////////////////////////////////
public Vector2 GetCharacterPos(uint index)
public Vector2f GetCharacterPos(uint index)
{
Vector2 Pos;
Vector2f Pos;
sfText_GetCharacterPos(This, index, out Pos.X, out Pos.Y);
return Pos;
@ -411,10 +412,10 @@ namespace SFML
static extern BlendMode sfText_GetBlendMode(IntPtr This);
[DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
static extern Vector2 sfText_TransformToLocal(IntPtr This, float PointX, float PointY, out float X, out float Y);
static extern Vector2f sfText_TransformToLocal(IntPtr This, float PointX, float PointY, out float X, out float Y);
[DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
static extern Vector2 sfText_TransformToGlobal(IntPtr This, float PointX, float PointY, out float X, out float Y);
static extern Vector2f sfText_TransformToGlobal(IntPtr This, float PointX, float PointY, out float X, out float Y);
[DllImport("csfml-graphics-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
static extern void sfRenderWindow_DrawText(IntPtr This, IntPtr String);

View file

@ -1,127 +0,0 @@
using System;
using System.Runtime.InteropServices;
namespace SFML
{
namespace Graphics
{
////////////////////////////////////////////////////////////
/// <summary>
/// Vector2 is an utility class for manipulating 2 dimensional
/// vectors with float components
/// </summary>
////////////////////////////////////////////////////////////
[StructLayout(LayoutKind.Sequential)]
public struct Vector2
{
////////////////////////////////////////////////////////////
/// <summary>
/// Construct the vector from its coordinates
/// </summary>
/// <param name="x">X coordinate</param>
/// <param name="y">Y coordinate</param>
////////////////////////////////////////////////////////////
public Vector2(float x, float y)
{
X = x;
Y = y;
}
////////////////////////////////////////////////////////////
/// <summary>
/// Operator - overload ; returns the opposite of a vector
/// </summary>
/// <param name="v">Vector to negate</param>
/// <returns>-v</returns>
////////////////////////////////////////////////////////////
public static Vector2 operator -(Vector2 v)
{
return new Vector2(-v.X, -v.Y);
}
////////////////////////////////////////////////////////////
/// <summary>
/// Operator - overload ; subtracts two vectors
/// </summary>
/// <param name="v1">First vector</param>
/// <param name="v2">Second vector</param>
/// <returns>v1 - v2</returns>
////////////////////////////////////////////////////////////
public static Vector2 operator -(Vector2 v1, Vector2 v2)
{
return new Vector2(v1.X - v2.X, v1.Y - v2.Y);
}
////////////////////////////////////////////////////////////
/// <summary>
/// Operator + overload ; add two vectors
/// </summary>
/// <param name="v1">First vector</param>
/// <param name="v2">Second vector</param>
/// <returns>v1 + v2</returns>
////////////////////////////////////////////////////////////
public static Vector2 operator +(Vector2 v1, Vector2 v2)
{
return new Vector2(v1.X + v2.X, v1.Y + v2.Y);
}
////////////////////////////////////////////////////////////
/// <summary>
/// Operator * overload ; multiply a vector by a scalar value
/// </summary>
/// <param name="v">Vector</param>
/// <param name="x">Scalar value</param>
/// <returns>v * x</returns>
////////////////////////////////////////////////////////////
public static Vector2 operator *(Vector2 v, float x)
{
return new Vector2(v.X * x, v.Y * x);
}
////////////////////////////////////////////////////////////
/// <summary>
/// Operator * overload ; multiply a scalar value by a vector
/// </summary>
/// <param name="x">Scalar value</param>
/// <param name="v">Vector</param>
/// <returns>x * v</returns>
////////////////////////////////////////////////////////////
public static Vector2 operator *(float x, Vector2 v)
{
return new Vector2(v.X * x, v.Y * x);
}
////////////////////////////////////////////////////////////
/// <summary>
/// Operator / overload ; divide a vector by a scalar value
/// </summary>
/// <param name="v">Vector</param>
/// <param name="x">Scalar value</param>
/// <returns>v / x</returns>
////////////////////////////////////////////////////////////
public static Vector2 operator /(Vector2 v, float x)
{
return new Vector2(v.X / x, v.Y / x);
}
////////////////////////////////////////////////////////////
/// <summary>
/// Provide a string describing the object
/// </summary>
/// <returns>String description of the object</returns>
////////////////////////////////////////////////////////////
public override string ToString()
{
return "[Vector2]" +
" X(" + X + ")" +
" Y(" + Y + ")";
}
/// <summary>X (horizontal) component of the vector</summary>
public float X;
/// <summary>Y (vertical) component of the vector</summary>
public float Y;
}
}
}

View file

@ -1,6 +1,7 @@
using System;
using System.Runtime.InteropServices;
using System.Security;
using SFML.Window;
namespace SFML
{
@ -42,7 +43,7 @@ namespace SFML
/// <param name="center">Center of the view</param>
/// <param name="size">Size of the view</param>
////////////////////////////////////////////////////////////
public View(Vector2 center, Vector2 size) :
public View(Vector2f center, Vector2f size) :
base(sfView_Create())
{
this.Center = center;
@ -65,9 +66,9 @@ namespace SFML
/// Center of the view
/// </summary>
////////////////////////////////////////////////////////////
public Vector2 Center
public Vector2f Center
{
get {return new Vector2(sfView_GetCenterX(This), sfView_GetCenterY(This));}
get {return new Vector2f(sfView_GetCenterX(This), sfView_GetCenterY(This));}
set {sfView_SetCenter(This, value.X, value.Y);}
}
@ -76,9 +77,9 @@ namespace SFML
/// Half-size of the view
/// </summary>
////////////////////////////////////////////////////////////
public Vector2 Size
public Vector2f Size
{
get {return new Vector2(sfView_GetWidth(This), sfView_GetHeight(This));}
get {return new Vector2f(sfView_GetWidth(This), sfView_GetHeight(This));}
set {sfView_SetSize(This, value.X, value.Y);}
}
@ -122,7 +123,7 @@ namespace SFML
/// </summary>
/// <param name="offset">Offset to move the view</param>
////////////////////////////////////////////////////////////
public void Move(Vector2 offset)
public void Move(Vector2f offset)
{
sfView_Move(This, offset.X, offset.Y);
}

View file

@ -80,7 +80,6 @@
<Compile Include="Shape.cs" />
<Compile Include="Sprite.cs" />
<Compile Include="Text.cs" />
<Compile Include="Vector2.cs" />
<Compile Include="View.cs" />
</ItemGroup>
<ItemGroup>

View file

@ -5,168 +5,6 @@ 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
@ -214,13 +52,19 @@ namespace SFML
MouseLeft,
/// <summary>Event triggered when a joystick button is pressed</summary>
JoyButtonPressed,
JoystickButtonPressed,
/// <summary>Event triggered when a joystick button is released</summary>
JoyButtonReleased,
JoystickButtonReleased,
/// <summary>Event triggered when a joystick axis moves</summary>
JoyMoved
JoystickMoved,
/// <summary>Event triggered when a joystick is connected</summary>
JoystickConnected,
/// <summary>Event triggered when a joystick is disconnected</summary>
JoystickDisconnected
}
////////////////////////////////////////////////////////////
@ -232,7 +76,7 @@ namespace SFML
public struct KeyEvent
{
/// <summary>Code of the key (see KeyCode enum)</summary>
public KeyCode Code;
public Keyboard.Key Code;
/// <summary>Is the Alt modifier pressed?</summary>
public int Alt;
@ -283,7 +127,7 @@ namespace SFML
public struct MouseButtonEvent
{
/// <summary>Code of the button (see MouseButton enum)</summary>
public MouseButton Button;
public Mouse.Button Button;
/// <summary>X coordinate of the mouse cursor</summary>
public int X;
@ -316,13 +160,13 @@ namespace SFML
/// </summary>
////////////////////////////////////////////////////////////
[StructLayout(LayoutKind.Sequential)]
public struct JoyMoveEvent
public struct JoystickMoveEvent
{
/// <summary>Index of the joystick which triggered the event</summary>
public uint JoystickId;
/// <summary>Joystick axis (see JoyAxis enum)</summary>
public JoyAxis Axis;
public Joystick.Axis Axis;
/// <summary>Current position of the axis</summary>
public float Position;
@ -334,7 +178,7 @@ namespace SFML
/// </summary>
////////////////////////////////////////////////////////////
[StructLayout(LayoutKind.Sequential)]
public struct JoyButtonEvent
public struct JoystickButtonEvent
{
/// <summary>Index of the joystick which triggered the event</summary>
public uint JoystickId;
@ -343,6 +187,18 @@ namespace SFML
public uint Button;
}
////////////////////////////////////////////////////////////
/// <summary>
/// Joystick connect event parameters
/// </summary>
////////////////////////////////////////////////////////////
[StructLayout(LayoutKind.Sequential)]
public struct JoystickConnectEvent
{
/// <summary>Index of the joystick which triggered the event</summary>
public uint JoystickId;
}
////////////////////////////////////////////////////////////
/// <summary>
/// Size event parameters
@ -370,6 +226,10 @@ namespace SFML
[FieldOffset(0)]
public EventType Type;
/// <summary>Arguments for size events (Resized)</summary>
[FieldOffset(4)]
public SizeEvent Size;
/// <summary>Arguments for key events (KeyPressed, KeyReleased)</summary>
[FieldOffset(4)]
public KeyEvent Key;
@ -390,17 +250,17 @@ namespace SFML
[FieldOffset(4)]
public MouseWheelEvent MouseWheel;
/// <summary>Arguments for joystick axis events (JoyMoved)</summary>
/// <summary>Arguments for joystick axis events (JoystickMoved)</summary>
[FieldOffset(4)]
public JoyMoveEvent JoyMove;
public JoystickMoveEvent JoystickMove;
/// <summary>Arguments for joystick button events (JoyButtonPressed, JoyButtonReleased)</summary>
/// <summary>Arguments for joystick button events (JoystickButtonPressed, JoystickButtonReleased)</summary>
[FieldOffset(4)]
public JoyButtonEvent JoyButton;
public JoystickButtonEvent JoystickButton;
/// <summary>Arguments for size events (Resized)</summary>
/// <summary>Arguments for joystick connect events (JoystickConnected, JoystickDisconnected)</summary>
[FieldOffset(4)]
public SizeEvent Size;
public JoystickConnectEvent JoystickConnect;
}
}
}

View file

@ -43,7 +43,7 @@ namespace SFML
}
/// <summary>Code of the key (see KeyCode enum)</summary>
public KeyCode Code;
public Keyboard.Key Code;
/// <summary>Is the Alt modifier pressed?</summary>
public bool Alt;
@ -166,7 +166,7 @@ namespace SFML
}
/// <summary>Code of the button (see MouseButton enum)</summary>
public MouseButton Button;
public Mouse.Button Button;
/// <summary>X coordinate of the mouse cursor</summary>
public int X;
@ -224,7 +224,7 @@ namespace SFML
/// Joystick axis move event parameters
/// </summary>
////////////////////////////////////////////////////////////
public class JoyMoveEventArgs : EventArgs
public class JoystickMoveEventArgs : EventArgs
{
////////////////////////////////////////////////////////////
/// <summary>
@ -232,7 +232,7 @@ namespace SFML
/// </summary>
/// <param name="e">Joystick move event</param>
////////////////////////////////////////////////////////////
public JoyMoveEventArgs(JoyMoveEvent e)
public JoystickMoveEventArgs(JoystickMoveEvent e)
{
JoystickId = e.JoystickId;
Axis = e.Axis;
@ -247,7 +247,7 @@ namespace SFML
////////////////////////////////////////////////////////////
public override string ToString()
{
return "[JoyMoveEventArgs]" +
return "[JoystickMoveEventArgs]" +
" JoystickId(" + JoystickId + ")" +
" Axis(" + Axis + ")" +
" Position(" + Position + ")";
@ -257,7 +257,7 @@ namespace SFML
public uint JoystickId;
/// <summary>Joystick axis (see JoyAxis enum)</summary>
public JoyAxis Axis;
public Joystick.Axis Axis;
/// <summary>Current position of the axis</summary>
public float Position;
@ -268,7 +268,7 @@ namespace SFML
/// Joystick buttons event parameters
/// </summary>
////////////////////////////////////////////////////////////
public class JoyButtonEventArgs : EventArgs
public class JoystickButtonEventArgs : EventArgs
{
////////////////////////////////////////////////////////////
/// <summary>
@ -276,7 +276,7 @@ namespace SFML
/// </summary>
/// <param name="e">Joystick button event</param>
////////////////////////////////////////////////////////////
public JoyButtonEventArgs(JoyButtonEvent e)
public JoystickButtonEventArgs(JoystickButtonEvent e)
{
JoystickId = e.JoystickId;
Button = e.Button;
@ -290,7 +290,7 @@ namespace SFML
////////////////////////////////////////////////////////////
public override string ToString()
{
return "[JoyButtonEventArgs]" +
return "[JoystickButtonEventArgs]" +
" JoystickId(" + JoystickId + ")" +
" Button(" + Button + ")";
}
@ -302,6 +302,40 @@ namespace SFML
public uint Button;
}
////////////////////////////////////////////////////////////
/// <summary>
/// Joystick connection/disconnection event parameters
/// </summary>
////////////////////////////////////////////////////////////
public class JoystickConnectEventArgs : EventArgs
{
////////////////////////////////////////////////////////////
/// <summary>
/// Construct the joystick connect arguments from a joystick connect event
/// </summary>
/// <param name="e">Joystick button event</param>
////////////////////////////////////////////////////////////
public JoystickConnectEventArgs(JoystickConnectEvent e)
{
JoystickId = e.JoystickId;
}
////////////////////////////////////////////////////////////
/// <summary>
/// Provide a string describing the object
/// </summary>
/// <returns>String description of the object</returns>
////////////////////////////////////////////////////////////
public override string ToString()
{
return "[JoystickConnectEventArgs]" +
" JoystickId(" + JoystickId + ")";
}
/// <summary>Index of the joystick which triggered the event</summary>
public uint JoystickId;
}
////////////////////////////////////////////////////////////
/// <summary>
/// Size event parameters

View file

@ -1,144 +0,0 @@
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
}
}
}

View file

@ -0,0 +1,159 @@
using System;
using System.Runtime.InteropServices;
using System.Security;
namespace SFML
{
namespace Window
{
////////////////////////////////////////////////////////////
/// <summary>
/// Give access to the real-time state of the joysticks
/// </summary>
////////////////////////////////////////////////////////////
public class Joystick
{
/// <summary>Maximum number of supported joysticks</summary>
public static readonly uint Count = 8;
/// <summary>Maximum number of supported buttons</summary>
public static readonly uint ButtonCount = 32;
/// <summary>Maximum number of supported axes</summary>
public static readonly uint AxisCount = 8;
////////////////////////////////////////////////////////////
/// <summary>
/// Axes supported by SFML joysticks
/// </summary>
////////////////////////////////////////////////////////////
public enum Axis
{
/// <summary>The X axis</summary>
X,
/// <summary>The Y axis</summary>
Y,
/// <summary>The Z axis</summary>
Z,
/// <summary>The R axis</summary>
R,
/// <summary>The U axis</summary>
U,
/// <summary>The V axis</summary>
V,
/// <summary>The X axis of the point-of-view hat</summary>
PovX,
/// <summary>TheY axis of the point-of-view hat</summary>
PovY
};
////////////////////////////////////////////////////////////
/// <summary>
/// Check if a joystick is connected
/// </summary>
/// <param name="joystick">Index of the joystick to check</param>
/// <returns>True if the joystick is connected, false otherwise</returns>
////////////////////////////////////////////////////////////
public static bool IsConnected(uint joystick)
{
return sfJoystick_IsConnected(joystick);
}
////////////////////////////////////////////////////////////
/// <summary>
/// Return the number of buttons supported by a joystick
/// </summary>
/// If the joystick is not connected, this function returns 0.
/// <param name="joystick">Index of the joystick</param>
/// <returns>Number of buttons supported by the joystick</returns>
////////////////////////////////////////////////////////////
public static uint GetButtonCount(uint joystick)
{
return sfJoystick_GetButtonCount(joystick);
}
////////////////////////////////////////////////////////////
/// <summary>
/// Check if a joystick supports a given axis
/// </summary>
/// If the joystick is not connected, this function returns false.
/// <param name="joystick">Index of the joystick</param>
/// <param name="axis">Axis to check</param>
/// <returns>True if the joystick supports the axis, false otherwise</returns>
////////////////////////////////////////////////////////////
public static bool HasAxis(uint joystick, Axis axis)
{
return sfJoystick_HasAxis(joystick, axis);
}
////////////////////////////////////////////////////////////
/// <summary>
/// Check if a joystick button is pressed
/// </summary>
/// If the joystick is not connected, this function returns false.
/// <param name="joystick">Index of the joystick</param>
/// <param name="button">Button to check</param>
/// <returns>True if the button is pressed, false otherwise</returns>
////////////////////////////////////////////////////////////
public static bool IsButtonPressed(uint joystick, uint button)
{
return sfJoystick_IsButtonPressed(joystick, button);
}
////////////////////////////////////////////////////////////
/// <summary>
/// Get the current position of a joystick axis
/// </summary>
/// If the joystick is not connected, this function returns 0.
/// <param name="joystick">Index of the joystick</param>
/// <param name="axis">Axis to check</param>
/// <returns>Current position of the axis, in range [-100 .. 100]</returns>
////////////////////////////////////////////////////////////
public static float GetAxisPosition(uint joystick, Axis axis)
{
return sfJoystick_GetAxisPosition(joystick, axis);
}
////////////////////////////////////////////////////////////
/// <summary>
/// Update the states of all joysticks
/// </summary>
/// This function is used internally by SFML, so you normally
/// don't have to call it explicitely. However, you may need to
/// call it if you have no window yet (or no window at all):
/// in this case the joysticks states are not updated automatically.
////////////////////////////////////////////////////////////
public static void Update()
{
sfJoystick_Update();
}
#region Imports
[DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
static extern bool sfJoystick_IsConnected(uint joystick);
[DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
static extern uint sfJoystick_GetButtonCount(uint joystick);
[DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
static extern bool sfJoystick_HasAxis(uint joystick, Axis axis);
[DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
static extern bool sfJoystick_IsButtonPressed(uint joystick, uint button);
[DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
static extern float sfJoystick_GetAxisPosition(uint joystick, Axis axis);
[DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
static extern void sfJoystick_Update();
#endregion
}
}
}

View file

@ -0,0 +1,146 @@
using System;
using System.Runtime.InteropServices;
using System.Security;
namespace SFML
{
namespace Window
{
////////////////////////////////////////////////////////////
/// <summary>
/// Give access to the real-time state of the keyboard
/// </summary>
////////////////////////////////////////////////////////////
public class Keyboard
{
////////////////////////////////////////////////////////////
/// <summary>
/// Key codes
/// </summary>
////////////////////////////////////////////////////////////
public enum Key
{
A, // The A key
B, // The B key
C, // The C key
D, // The D key
E, // The E key
F, // The F key
G, // The G key
H, // The H key
I, // The I key
J, // The J key
K, // The K key
L, // The L key
M, // The M key
N, // The N key
O, // The O key
P, // The P key
Q, // The Q key
R, // The R key
S, // The S key
T, // The T key
U, // The U key
V, // The V key
W, // The W key
X, // The X key
Y, // The Y key
Z, // The Z key
Num0, // The 0 key
Num1, // The 1 key
Num2, // The 2 key
Num3, // The 3 key
Num4, // The 4 key
Num5, // The 5 key
Num6, // The 6 key
Num7, // The 7 key
Num8, // The 8 key
Num9, // The 9 key
Escape, // The Escape key
LControl, // The left Control key
LShift, // The left Shift key
LAlt, // The left Alt key
LSystem, // The left OS specific key: window (Windows and Linux), apple (MacOS X), ...
RControl, // The right Control key
RShift, // The right Shift key
RAlt, // The right Alt key
RSystem, // The right OS specific key: window (Windows and Linux), apple (MacOS X), ...
Menu, // The Menu key
LBracket, // The [ key
RBracket, // The ] key
SemiColon, // The ; key
Comma, // The , key
Period, // The . key
Quote, // The ' key
Slash, // The / key
BackSlash, // The \ key
Tilde, // The ~ key
Equal, // The = key
Dash, // The - key
Space, // The Space key
Return, // The Return key
Back, // The Backspace key
Tab, // The Tabulation key
PageUp, // The Page up key
PageDown, // The Page down key
End, // The End key
Home, // The Home key
Insert, // The Insert key
Delete, // The Delete key
Add, // +
Subtract, // -
Multiply, // *
Divide, // /
Left, // Left arrow
Right, // Right arrow
Up, // Up arrow
Down, // Down arrow
Numpad0, // The numpad 0 key
Numpad1, // The numpad 1 key
Numpad2, // The numpad 2 key
Numpad3, // The numpad 3 key
Numpad4, // The numpad 4 key
Numpad5, // The numpad 5 key
Numpad6, // The numpad 6 key
Numpad7, // The numpad 7 key
Numpad8, // The numpad 8 key
Numpad9, // The numpad 9 key
F1, // The F1 key
F2, // The F2 key
F3, // The F3 key
F4, // The F4 key
F5, // The F5 key
F6, // The F6 key
F7, // The F7 key
F8, // The F8 key
F9, // The F8 key
F10, // The F10 key
F11, // The F11 key
F12, // The F12 key
F13, // The F13 key
F14, // The F14 key
F15, // The F15 key
Pause, // The Pause key
KeyCount // Keep last -- the total number of keyboard keys
};
////////////////////////////////////////////////////////////
/// <summary>
/// Check if a key is pressed
/// </summary>
/// <param name="key">Key to check</param>
/// <returns>True if the key is pressed, false otherwise</returns>
////////////////////////////////////////////////////////////
public static bool IsKeyDown(Key key)
{
return sfKeyboard_IsKeyDown(key);
}
#region Imports
[DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
static extern bool sfKeyboard_IsKeyDown(Key Key);
#endregion
}
}
}

View file

@ -0,0 +1,81 @@
using System;
using System.Runtime.InteropServices;
using System.Security;
namespace SFML
{
namespace Window
{
////////////////////////////////////////////////////////////
/// <summary>
/// Give access to the real-time state of the mouse
/// </summary>
////////////////////////////////////////////////////////////
public class Mouse
{
////////////////////////////////////////////////////////////
/// <summary>
/// Mouse buttons
/// </summary>
////////////////////////////////////////////////////////////
public enum Button
{
/// <summary>The left mouse button</summary>
Left,
/// <summary>The right mouse button</summary>
Right,
/// <summary>The middle (wheel) mouse button</summary>
Middle,
/// <summary>The first extra mouse button</summary>
XButton1,
/// <summary>The second extra mouse button</summary>
XButton2,
/// <summary>Keep last -- the total number of mouse buttons</summary>
ButtonCount
};
////////////////////////////////////////////////////////////
/// <summary>
/// Check if a mouse button is pressed
/// </summary>
/// <param name="button">Button to check</param>
/// <returns>True if the button is pressed, false otherwise</returns>
////////////////////////////////////////////////////////////
public static bool IsButtonPressed(Button button)
{
return sfMouse_IsButtonPressed(button);
}
////////////////////////////////////////////////////////////
/// <summary>
/// Get the current position of the mouse
/// </summary>
/// This function returns the current position of the mouse
/// cursor.
/// If the cursor is over a SFML window, the returned position
/// is relative to this window. Otherwise, the returned position
/// is in desktop coordinates.
/// <returns>Current position of the mouse</returns>
////////////////////////////////////////////////////////////
public static Vector2i GetPosition()
{
Vector2i position;
sfMouse_GetPosition(out position.X, out position.Y);
return position;
}
#region Imports
[DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
static extern bool sfMouse_IsButtonPressed(Button button);
[DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
static extern void sfMouse_GetPosition(out int x, out int y);
#endregion
}
}
}

View file

@ -0,0 +1,246 @@
using System;
using System.Runtime.InteropServices;
namespace SFML
{
namespace Window
{
////////////////////////////////////////////////////////////
/// <summary>
/// Vector2f is an utility class for manipulating 2 dimensional
/// vectors with float components
/// </summary>
////////////////////////////////////////////////////////////
[StructLayout(LayoutKind.Sequential)]
public struct Vector2f
{
////////////////////////////////////////////////////////////
/// <summary>
/// Construct the vector from its coordinates
/// </summary>
/// <param name="x">X coordinate</param>
/// <param name="y">Y coordinate</param>
////////////////////////////////////////////////////////////
public Vector2f(float x, float y)
{
X = x;
Y = y;
}
////////////////////////////////////////////////////////////
/// <summary>
/// Operator - overload ; returns the opposite of a vector
/// </summary>
/// <param name="v">Vector to negate</param>
/// <returns>-v</returns>
////////////////////////////////////////////////////////////
public static Vector2f operator -(Vector2f v)
{
return new Vector2f(-v.X, -v.Y);
}
////////////////////////////////////////////////////////////
/// <summary>
/// Operator - overload ; subtracts two vectors
/// </summary>
/// <param name="v1">First vector</param>
/// <param name="v2">Second vector</param>
/// <returns>v1 - v2</returns>
////////////////////////////////////////////////////////////
public static Vector2f operator -(Vector2f v1, Vector2f v2)
{
return new Vector2f(v1.X - v2.X, v1.Y - v2.Y);
}
////////////////////////////////////////////////////////////
/// <summary>
/// Operator + overload ; add two vectors
/// </summary>
/// <param name="v1">First vector</param>
/// <param name="v2">Second vector</param>
/// <returns>v1 + v2</returns>
////////////////////////////////////////////////////////////
public static Vector2f operator +(Vector2f v1, Vector2f v2)
{
return new Vector2f(v1.X + v2.X, v1.Y + v2.Y);
}
////////////////////////////////////////////////////////////
/// <summary>
/// Operator * overload ; multiply a vector by a scalar value
/// </summary>
/// <param name="v">Vector</param>
/// <param name="x">Scalar value</param>
/// <returns>v * x</returns>
////////////////////////////////////////////////////////////
public static Vector2f operator *(Vector2f v, float x)
{
return new Vector2f(v.X * x, v.Y * x);
}
////////////////////////////////////////////////////////////
/// <summary>
/// Operator * overload ; multiply a scalar value by a vector
/// </summary>
/// <param name="x">Scalar value</param>
/// <param name="v">Vector</param>
/// <returns>x * v</returns>
////////////////////////////////////////////////////////////
public static Vector2f operator *(float x, Vector2f v)
{
return new Vector2f(v.X * x, v.Y * x);
}
////////////////////////////////////////////////////////////
/// <summary>
/// Operator / overload ; divide a vector by a scalar value
/// </summary>
/// <param name="v">Vector</param>
/// <param name="x">Scalar value</param>
/// <returns>v / x</returns>
////////////////////////////////////////////////////////////
public static Vector2f operator /(Vector2f v, float x)
{
return new Vector2f(v.X / x, v.Y / x);
}
////////////////////////////////////////////////////////////
/// <summary>
/// Provide a string describing the object
/// </summary>
/// <returns>String description of the object</returns>
////////////////////////////////////////////////////////////
public override string ToString()
{
return "[Vector2f]" +
" X(" + X + ")" +
" Y(" + Y + ")";
}
/// <summary>X (horizontal) component of the vector</summary>
public float X;
/// <summary>Y (vertical) component of the vector</summary>
public float Y;
}
////////////////////////////////////////////////////////////
/// <summary>
/// Vector2i is an utility class for manipulating 2 dimensional
/// vectors with integer components
/// </summary>
////////////////////////////////////////////////////////////
[StructLayout(LayoutKind.Sequential)]
public struct Vector2i
{
////////////////////////////////////////////////////////////
/// <summary>
/// Construct the vector from its coordinates
/// </summary>
/// <param name="x">X coordinate</param>
/// <param name="y">Y coordinate</param>
////////////////////////////////////////////////////////////
public Vector2i(int x, int y)
{
X = x;
Y = y;
}
////////////////////////////////////////////////////////////
/// <summary>
/// Operator - overload ; returns the opposite of a vector
/// </summary>
/// <param name="v">Vector to negate</param>
/// <returns>-v</returns>
////////////////////////////////////////////////////////////
public static Vector2i operator -(Vector2i v)
{
return new Vector2i(-v.X, -v.Y);
}
////////////////////////////////////////////////////////////
/// <summary>
/// Operator - overload ; subtracts two vectors
/// </summary>
/// <param name="v1">First vector</param>
/// <param name="v2">Second vector</param>
/// <returns>v1 - v2</returns>
////////////////////////////////////////////////////////////
public static Vector2i operator -(Vector2i v1, Vector2i v2)
{
return new Vector2i(v1.X - v2.X, v1.Y - v2.Y);
}
////////////////////////////////////////////////////////////
/// <summary>
/// Operator + overload ; add two vectors
/// </summary>
/// <param name="v1">First vector</param>
/// <param name="v2">Second vector</param>
/// <returns>v1 + v2</returns>
////////////////////////////////////////////////////////////
public static Vector2i operator +(Vector2i v1, Vector2i v2)
{
return new Vector2i(v1.X + v2.X, v1.Y + v2.Y);
}
////////////////////////////////////////////////////////////
/// <summary>
/// Operator * overload ; multiply a vector by a scalar value
/// </summary>
/// <param name="v">Vector</param>
/// <param name="x">Scalar value</param>
/// <returns>v * x</returns>
////////////////////////////////////////////////////////////
public static Vector2i operator *(Vector2i v, int x)
{
return new Vector2i(v.X * x, v.Y * x);
}
////////////////////////////////////////////////////////////
/// <summary>
/// Operator * overload ; multiply a scalar value by a vector
/// </summary>
/// <param name="x">Scalar value</param>
/// <param name="v">Vector</param>
/// <returns>x * v</returns>
////////////////////////////////////////////////////////////
public static Vector2i operator *(int x, Vector2i v)
{
return new Vector2i(v.X * x, v.Y * x);
}
////////////////////////////////////////////////////////////
/// <summary>
/// Operator / overload ; divide a vector by a scalar value
/// </summary>
/// <param name="v">Vector</param>
/// <param name="x">Scalar value</param>
/// <returns>v / x</returns>
////////////////////////////////////////////////////////////
public static Vector2i operator /(Vector2i v, int x)
{
return new Vector2i(v.X / x, v.Y / x);
}
////////////////////////////////////////////////////////////
/// <summary>
/// Provide a string describing the object
/// </summary>
/// <returns>String description of the object</returns>
////////////////////////////////////////////////////////////
public override string ToString()
{
return "[Vector2i]" +
" X(" + X + ")" +
" Y(" + Y + ")";
}
/// <summary>X (horizontal) component of the vector</summary>
public int X;
/// <summary>Y (vertical) component of the vector</summary>
public int Y;
}
}
}

View file

@ -79,7 +79,6 @@ namespace SFML
public Window(VideoMode mode, string title, Styles style, ContextSettings settings) :
base(sfWindow_Create(mode, title, style, ref settings))
{
myInput = new Input(sfWindow_GetInput(This));
}
////////////////////////////////////////////////////////////
@ -103,17 +102,6 @@ namespace SFML
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;}
}
////////////////////////////////////////////////////////////
@ -215,6 +203,19 @@ namespace SFML
sfWindow_SetCursorPosition(This, x, y);
}
////////////////////////////////////////////////////////////
/// <summary>
/// Get the position of the mouse cursor
/// </summary>
/// <returns>The current position of the mouse cursor, relative to the window</returns>
////////////////////////////////////////////////////////////
public virtual Vector2i GetCursorPosition()
{
Vector2i position;
sfWindow_GetCursorPosition(This, out position.X, out position.Y);
return position;
}
////////////////////////////////////////////////////////////
/// <summary>
/// Change the position of the window on screen.
@ -469,19 +470,29 @@ namespace SFML
GainedFocus(this, EventArgs.Empty);
break;
case EventType.JoyButtonPressed :
if (JoyButtonPressed != null)
JoyButtonPressed(this, new JoyButtonEventArgs(e.JoyButton));
case EventType.JoystickButtonPressed:
if (JoystickButtonPressed != null)
JoystickButtonPressed(this, new JoystickButtonEventArgs(e.JoystickButton));
break;
case EventType.JoyButtonReleased :
if (JoyButtonReleased != null)
JoyButtonReleased(this, new JoyButtonEventArgs(e.JoyButton));
case EventType.JoystickButtonReleased :
if (JoystickButtonReleased != null)
JoystickButtonReleased(this, new JoystickButtonEventArgs(e.JoystickButton));
break;
case EventType.JoyMoved :
if (JoyMoved != null)
JoyMoved(this, new JoyMoveEventArgs(e.JoyMove));
case EventType.JoystickMoved :
if (JoystickMoved != null)
JoystickMoved(this, new JoystickMoveEventArgs(e.JoystickMove));
break;
case EventType.JoystickConnected:
if (JoystickConnected != null)
JoystickConnected(this, new JoystickConnectEventArgs(e.JoystickConnect));
break;
case EventType.JoystickDisconnected:
if (JoystickDisconnected != null)
JoystickDisconnected(this, new JoystickConnectEventArgs(e.JoystickConnect));
break;
case EventType.KeyPressed :
@ -580,16 +591,20 @@ namespace SFML
/// <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 JoystickButtonPressed event</summary>
public event EventHandler<JoystickButtonEventArgs> JoystickButtonPressed = null;
/// <summary>Event handler for the JoyButtonReleased event</summary>
public event EventHandler<JoyButtonEventArgs> JoyButtonReleased = null;
/// <summary>Event handler for the JoystickButtonReleased event</summary>
public event EventHandler<JoystickButtonEventArgs> JoystickButtonReleased = null;
/// <summary>Event handler for the JoyMoved event</summary>
public event EventHandler<JoyMoveEventArgs> JoyMoved = null;
/// <summary>Event handler for the JoystickMoved event</summary>
public event EventHandler<JoystickMoveEventArgs> JoystickMoved = null;
protected Input myInput = null;
/// <summary>Event handler for the JoystickConnected event</summary>
public event EventHandler<JoystickConnectEventArgs> JoystickConnected = null;
/// <summary>Event handler for the JoystickDisconnected event</summary>
public event EventHandler<JoystickConnectEventArgs> JoystickDisconnected = null;
#region Imports
[DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
@ -601,9 +616,6 @@ namespace SFML
[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);
@ -637,6 +649,9 @@ namespace SFML
[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_GetCursorPosition(IntPtr This, out int X, out int Y);
[DllImport("csfml-window-2", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
static extern void sfWindow_SetPosition(IntPtr This, int X, int Y);

View file

@ -70,9 +70,12 @@
<Compile Include="ContextSettings.cs" />
<Compile Include="Event.cs" />
<Compile Include="EventArgs.cs" />
<Compile Include="Input.cs" />
<Compile Include="Joystick.cs" />
<Compile Include="Keyboard.cs" />
<Compile Include="LoadingFailedException.cs" />
<Compile Include="Mouse.cs" />
<Compile Include="ObjectBase.cs" />
<Compile Include="Vector2.cs" />
<Compile Include="VideoMode.cs" />
<Compile Include="Window.cs" />
</ItemGroup>