From 1464a357112dfc7f96a53ecab7624bed3bb40119 Mon Sep 17 00:00:00 2001
From: trass3r <trass3r@4e206d99-4929-0410-ac5d-dfc041789085>
Date: Tue, 20 Apr 2010 17:35:30 +0000
Subject: [PATCH] * using property style in Input * sync with changes to Glyph
 class * renamed network files (sync)

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1513 4e206d99-4929-0410-ac5d-dfc041789085
---
 DSFML/import/dsfml/graphics/font.d            |   6 +-
 DSFML/import/dsfml/graphics/sprite.d          |   5 +
 .../network/{selector.d => socketselector.d}  |   0
 .../network/{sockettcp.d => tcpsocket.d}      |   0
 .../network/{socketudp.d => udpsocket.d}      |   0
 DSFML/import/dsfml/system/common.d            |   2 +-
 DSFML/import/dsfml/window/input.d             | 239 +++++++++---------
 7 files changed, 125 insertions(+), 127 deletions(-)
 rename DSFML/import/dsfml/network/{selector.d => socketselector.d} (100%)
 rename DSFML/import/dsfml/network/{sockettcp.d => tcpsocket.d} (100%)
 rename DSFML/import/dsfml/network/{socketudp.d => udpsocket.d} (100%)

diff --git a/DSFML/import/dsfml/graphics/font.d b/DSFML/import/dsfml/graphics/font.d
index 825bcecb5..bd8146ca1 100644
--- a/DSFML/import/dsfml/graphics/font.d
+++ b/DSFML/import/dsfml/graphics/font.d
@@ -37,9 +37,9 @@ import	dsfml.graphics.rect,
 /// Glyph describes a glyph (a visual character)
 struct Glyph
 {
-	int			Advance;	/// Offset to move horizontically to the next character
-	IntRect		Rectangle;	/// Bounding rectangle of the glyph, in relative coordinates
-	FloatRect	TexCoords;	/// Texture coordinates of the glyph inside the bitmap font
+	int		Advance;	/// Offset to move horizontically to the next character
+	IntRect	Bounds;		/// Bounding rectangle of the glyph, in coordinates relative to the baseline
+	IntRect	SubRect;	/// Texture coordinates of the glyph inside the font's image
 }
 
 /**
diff --git a/DSFML/import/dsfml/graphics/sprite.d b/DSFML/import/dsfml/graphics/sprite.d
index d985d0f6e..75fde382a 100644
--- a/DSFML/import/dsfml/graphics/sprite.d
+++ b/DSFML/import/dsfml/graphics/sprite.d
@@ -95,6 +95,11 @@ public:
 		m_image = img;
 	}
 
+	@property void image(Image img)
+	{
+		setImage(img, false);
+	}
+	
 	/**
 	*	Resize the sprite (by changing its scale factors).
 	*	The default size is defined by the subrect
diff --git a/DSFML/import/dsfml/network/selector.d b/DSFML/import/dsfml/network/socketselector.d
similarity index 100%
rename from DSFML/import/dsfml/network/selector.d
rename to DSFML/import/dsfml/network/socketselector.d
diff --git a/DSFML/import/dsfml/network/sockettcp.d b/DSFML/import/dsfml/network/tcpsocket.d
similarity index 100%
rename from DSFML/import/dsfml/network/sockettcp.d
rename to DSFML/import/dsfml/network/tcpsocket.d
diff --git a/DSFML/import/dsfml/network/socketudp.d b/DSFML/import/dsfml/network/udpsocket.d
similarity index 100%
rename from DSFML/import/dsfml/network/socketudp.d
rename to DSFML/import/dsfml/network/udpsocket.d
diff --git a/DSFML/import/dsfml/system/common.d b/DSFML/import/dsfml/system/common.d
index b5c9ffce6..5dff21f88 100644
--- a/DSFML/import/dsfml/system/common.d
+++ b/DSFML/import/dsfml/system/common.d
@@ -41,7 +41,7 @@ package
 	
 //	alias immutable(void)	ivoid;
 	alias const(void)		cvoid;
-	alias void*	SFMLClass;
+	typedef immutable(void)*	SFMLClass;
 }
 
 // used to mixin code function
diff --git a/DSFML/import/dsfml/window/input.d b/DSFML/import/dsfml/window/input.d
index b18cf3a05..00abf9667 100644
--- a/DSFML/import/dsfml/window/input.d
+++ b/DSFML/import/dsfml/window/input.d
@@ -1,28 +1,28 @@
 /*
-*	DSFML - SFML Library wrapper for the D programming language.
-*	Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com)
-*	Copyright (C) 2010 Andreas Hollandt
-*
-*	This software is provided 'as-is', without any express or
-*	implied warranty. In no event will the authors be held
-*	liable for any damages arising from the use of this software.
-*
-*	Permission is granted to anyone to use this software for any purpose,
-*	including commercial applications, and to alter it and redistribute
-*	it freely, subject to the following restrictions:
-*
-*	1.  The origin of this software must not be misrepresented;
-*		you must not claim that you wrote the original software.
-*		If you use this software in a product, an acknowledgment
-*		in the product documentation would be appreciated but
-*		is not required.
-*
-*	2.  Altered source versions must be plainly marked as such,
-*		and must not be misrepresented as being the original software.
-*
-*	3.  This notice may not be removed or altered from any
-*		source distribution.
-*/
+ *	DSFML - SFML Library wrapper for the D programming language.
+ *	Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com)
+ *	Copyright (C) 2010 Andreas Hollandt
+ *
+ *	This software is provided 'as-is', without any express or
+ *	implied warranty. In no event will the authors be held
+ *	liable for any damages arising from the use of this software.
+ *
+ *	Permission is granted to anyone to use this software for any purpose,
+ *	including commercial applications, and to alter it and redistribute
+ *	it freely, subject to the following restrictions:
+ *
+ *	1.  The origin of this software must not be misrepresented;
+ *		you must not claim that you wrote the original software.
+ *		If you use this software in a product, an acknowledgment
+ *		in the product documentation would be appreciated but
+ *		is not required.
+ *
+ *	2.  Altered source versions must be plainly marked as such,
+ *		and must not be misrepresented as being the original software.
+ *
+ *	3.  This notice may not be removed or altered from any
+ *		source distribution.
+ */
 
 module dsfml.window.input;
 
@@ -31,93 +31,13 @@ import dsfml.system.common;
 import dsfml.window.event;
 
 /**
-*	Input handles real-time input from keyboard and mouse.
-*	Use it instead of events to handle continuous moves and more
-*	game-friendly inputs
-*/
+ *	Input handles real-time input from keyboard and mouse.
+ *	Use it instead of events to handle continuous moves and more
+ *	game-friendly inputs
+ */
 class Input : DSFMLObject
 {
-	/**
-	*	Get the state of a key
-	*
-	*	Params:
-	*		key = Key to check
-	*
-	*	Returns:
-	*		True if key is down, false if key is up
-	*/
-	bool isKeyDown(KeyCode key)
-	{
-		return cast(bool)sfInput_IsKeyDown(m_ptr, key);
-	}
-
-	/**
-	*	Get the state of a mouse button
-	*
-	*	Params: 
-	*		button = Button to check
-	*
-	*	Returns: 
-	*		True if button is down, false if button is up
-	*/
-	bool isMouseButtonDown(MouseButtons button)
-	{
-		return cast(bool)sfInput_IsMouseButtonDown(m_ptr, button);
-	}
-
-	/**
-	*	Get the state of a joystick button
-	*
-	*	Params: 
-	*		joyId = Identifier of the joystick to check (0 or 1)
-	*		button = Button to check
-	*
-	*	Returns: 
-	*		True if button is down, false if button is up
-	*/
-	bool isJoystickButtonDown(uint joyId, uint button)
-	{
-		return cast(bool)sfInput_IsJoystickButtonDown(m_ptr, joyId, button);
-	}
-
-	/*
-	*	Get the mouse X position
-	*
-	*	Returns:
-	*		Current mouse left position, relative to owner window
-	*/
-	int getMouseX()
-	{
-		return sfInput_GetMouseX(m_ptr);
-	}
-
-	/**
-	*	Get the mouse Y position
-	*
-	*	Returns:
-	*		Current mouse top position, relative to owner window
-	*
-	*/
-	int getMouseY()
-	{
-		return sfInput_GetMouseY(m_ptr);
-	}
-
-	/**
-	* Get a joystick axis position
-	*
-	*	Params:	
-	*		joyId = Identifier of the joystick to check (0 or 1)
-	*		axis =  Axis to get
-	*
-	*	Returns:
-	*		Current axis position, in the range [-100, 100] (except for POV, which is [0, 360])
-	*/
-	float getJoystickAxis(uint joyId, JoyAxis axis)
-	{
-		return sfInput_GetJoystickAxis(m_ptr, joyId, axis);
-	}
-
+public: // TODO: try to fix this, doesn't work with package
 	this(SFMLClass input)
 	{
 		super(input, true);
@@ -128,6 +48,91 @@ class Input : DSFMLObject
 		// nothing to do
 	}
 
+public:
+	/**
+	 *	Get the state of a key
+	 *
+	 *	Params:
+	 *		key = Key to check
+	 *
+	 *	Returns:
+	 *		True if key is down, false if key is up
+	 */
+	bool isKeyDown(KeyCode key)
+	{
+		return cast(bool)sfInput_IsKeyDown(m_ptr, key);
+	}
+
+	/**
+	 *	Get the state of a mouse button
+	 *
+	 *	Params: 
+	 *		button = Button to check
+	 *
+	 *	Returns: 
+	 *		True if button is down, false if button is up
+	 */
+	bool isMouseButtonDown(MouseButtons button)
+	{
+		return cast(bool)sfInput_IsMouseButtonDown(m_ptr, button);
+	}
+
+	/**
+	 *	Get the state of a joystick button
+	 *
+	 *	Params: 
+	 *		joyId = Identifier of the joystick to check (0 or 1)
+	 *		button = Button to check
+	 *
+	 *	Returns: 
+	 *		True if button is down, false if button is up
+	 */
+	bool isJoystickButtonDown(uint joyId, uint button)
+	{
+		return cast(bool)sfInput_IsJoystickButtonDown(m_ptr, joyId, button);
+	}
+
+	/**
+	 * Get a joystick axis position
+	 *
+	 *	Params:	
+	 *		joyId = Identifier of the joystick to check (0 or 1)
+	 *		axis =  Axis to get
+	 *
+	 *	Returns:
+	 *		Current axis position, in the range [-100, 100] (except for POV, which is [0, 360])
+	 */
+	float getJoystickAxis(uint joyId, JoyAxis axis)
+	{
+		return sfInput_GetJoystickAxis(m_ptr, joyId, axis);
+	}
+
+@property
+{
+	/**
+	 *	Get the mouse X position
+	 *
+	 *	Returns:
+	 *		Current mouse left position, relative to owner window
+	 */
+	int mouseX()
+	{
+		return sfInput_GetMouseX(m_ptr);
+	}
+
+	/**
+	 *	Get the mouse Y position
+	 *
+	 *	Returns:
+	 *		Current mouse top position, relative to owner window
+	 *
+	 */
+	int mouseY()
+	{
+		return sfInput_GetMouseY(m_ptr);
+	}
+}
+
 private:
 
 // External ====================================================================
@@ -142,18 +147,6 @@ private:
 		float	function(SFMLClass, uint, JoyAxis)	sfInput_GetJoystickAxis;
 	}
 
-	static this()
-	{
-		debug
-			DllLoader dll = DllLoader.load("csfml-window-d");
-		else
-			DllLoader dll = DllLoader.load("csfml-window");
-		
-		mixin(loadFromSharedLib("sfInput_IsKeyDown"));
-		mixin(loadFromSharedLib("sfInput_IsMouseButtonDown"));
-		mixin(loadFromSharedLib("sfInput_IsJoystickButtonDown"));
-		mixin(loadFromSharedLib("sfInput_GetMouseX"));
-		mixin(loadFromSharedLib("sfInput_GetMouseY"));
-		mixin(loadFromSharedLib("sfInput_GetJoystickAxis"));
-	}
+	mixin(loadFromSharedLib2("csfml-window", "sfInput",
+	"IsKeyDown", "IsMouseButtonDown", "IsJoystickButtonDown", "GetMouseX", "GetMouseY", "GetJoystickAxis"));
 }
\ No newline at end of file