* 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
This commit is contained in:
trass3r 2010-04-20 17:35:30 +00:00
parent 49983415cd
commit 1464a35711
7 changed files with 125 additions and 127 deletions

View File

@ -38,8 +38,8 @@ import dsfml.graphics.rect,
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
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
}
/**

View File

@ -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

View File

@ -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

View File

@ -37,6 +37,18 @@ import dsfml.window.event;
*/
class Input : DSFMLObject
{
public: // TODO: try to fix this, doesn't work with package
this(SFMLClass input)
{
super(input, true);
}
override void dispose()
{
// nothing to do
}
public:
/**
* Get the state of a key
*
@ -80,29 +92,6 @@ class Input : DSFMLObject
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
*
@ -118,14 +107,30 @@ class Input : DSFMLObject
return sfInput_GetJoystickAxis(m_ptr, joyId, axis);
}
this(SFMLClass input)
@property
{
super(input, true);
/**
* Get the mouse X position
*
* Returns:
* Current mouse left position, relative to owner window
*/
int mouseX()
{
return sfInput_GetMouseX(m_ptr);
}
override void dispose()
/**
* Get the mouse Y position
*
* Returns:
* Current mouse top position, relative to owner window
*
*/
int mouseY()
{
// nothing to do
return sfInput_GetMouseY(m_ptr);
}
}
private:
@ -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"));
}