* 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:
parent
49983415cd
commit
1464a35711
@ -38,8 +38,8 @@ import dsfml.graphics.rect,
|
|||||||
struct Glyph
|
struct Glyph
|
||||||
{
|
{
|
||||||
int Advance; /// Offset to move horizontically to the next character
|
int Advance; /// Offset to move horizontically to the next character
|
||||||
IntRect Rectangle; /// Bounding rectangle of the glyph, in relative coordinates
|
IntRect Bounds; /// Bounding rectangle of the glyph, in coordinates relative to the baseline
|
||||||
FloatRect TexCoords; /// Texture coordinates of the glyph inside the bitmap font
|
IntRect SubRect; /// Texture coordinates of the glyph inside the font's image
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -95,6 +95,11 @@ public:
|
|||||||
m_image = img;
|
m_image = img;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@property void image(Image img)
|
||||||
|
{
|
||||||
|
setImage(img, false);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resize the sprite (by changing its scale factors).
|
* Resize the sprite (by changing its scale factors).
|
||||||
* The default size is defined by the subrect
|
* The default size is defined by the subrect
|
||||||
|
@ -41,7 +41,7 @@ package
|
|||||||
|
|
||||||
// alias immutable(void) ivoid;
|
// alias immutable(void) ivoid;
|
||||||
alias const(void) cvoid;
|
alias const(void) cvoid;
|
||||||
alias void* SFMLClass;
|
typedef immutable(void)* SFMLClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
// used to mixin code function
|
// used to mixin code function
|
||||||
|
@ -1,28 +1,28 @@
|
|||||||
/*
|
/*
|
||||||
* DSFML - SFML Library wrapper for the D programming language.
|
* DSFML - SFML Library wrapper for the D programming language.
|
||||||
* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com)
|
* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com)
|
||||||
* Copyright (C) 2010 Andreas Hollandt
|
* Copyright (C) 2010 Andreas Hollandt
|
||||||
*
|
*
|
||||||
* This software is provided 'as-is', without any express or
|
* This software is provided 'as-is', without any express or
|
||||||
* implied warranty. In no event will the authors be held
|
* implied warranty. In no event will the authors be held
|
||||||
* liable for any damages arising from the use of this software.
|
* liable for any damages arising from the use of this software.
|
||||||
*
|
*
|
||||||
* Permission is granted to anyone to use this software for any purpose,
|
* Permission is granted to anyone to use this software for any purpose,
|
||||||
* including commercial applications, and to alter it and redistribute
|
* including commercial applications, and to alter it and redistribute
|
||||||
* it freely, subject to the following restrictions:
|
* it freely, subject to the following restrictions:
|
||||||
*
|
*
|
||||||
* 1. The origin of this software must not be misrepresented;
|
* 1. The origin of this software must not be misrepresented;
|
||||||
* you must not claim that you wrote the original software.
|
* you must not claim that you wrote the original software.
|
||||||
* If you use this software in a product, an acknowledgment
|
* If you use this software in a product, an acknowledgment
|
||||||
* in the product documentation would be appreciated but
|
* in the product documentation would be appreciated but
|
||||||
* is not required.
|
* is not required.
|
||||||
*
|
*
|
||||||
* 2. Altered source versions must be plainly marked as such,
|
* 2. Altered source versions must be plainly marked as such,
|
||||||
* and must not be misrepresented as being the original software.
|
* and must not be misrepresented as being the original software.
|
||||||
*
|
*
|
||||||
* 3. This notice may not be removed or altered from any
|
* 3. This notice may not be removed or altered from any
|
||||||
* source distribution.
|
* source distribution.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
module dsfml.window.input;
|
module dsfml.window.input;
|
||||||
|
|
||||||
@ -31,12 +31,24 @@ import dsfml.system.common;
|
|||||||
import dsfml.window.event;
|
import dsfml.window.event;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Input handles real-time input from keyboard and mouse.
|
* Input handles real-time input from keyboard and mouse.
|
||||||
* Use it instead of events to handle continuous moves and more
|
* Use it instead of events to handle continuous moves and more
|
||||||
* game-friendly inputs
|
* game-friendly inputs
|
||||||
*/
|
*/
|
||||||
class Input : DSFMLObject
|
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
|
* Get the state of a key
|
||||||
*
|
*
|
||||||
@ -80,29 +92,6 @@ class Input : DSFMLObject
|
|||||||
return cast(bool)sfInput_IsJoystickButtonDown(m_ptr, joyId, 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
|
* Get a joystick axis position
|
||||||
*
|
*
|
||||||
@ -118,15 +107,31 @@ class Input : DSFMLObject
|
|||||||
return sfInput_GetJoystickAxis(m_ptr, joyId, axis);
|
return sfInput_GetJoystickAxis(m_ptr, joyId, axis);
|
||||||
}
|
}
|
||||||
|
|
||||||
this(SFMLClass input)
|
@property
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the mouse X position
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* Current mouse left position, relative to owner window
|
||||||
|
*/
|
||||||
|
int mouseX()
|
||||||
{
|
{
|
||||||
super(input, true);
|
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:
|
private:
|
||||||
|
|
||||||
@ -142,18 +147,6 @@ private:
|
|||||||
float function(SFMLClass, uint, JoyAxis) sfInput_GetJoystickAxis;
|
float function(SFMLClass, uint, JoyAxis) sfInput_GetJoystickAxis;
|
||||||
}
|
}
|
||||||
|
|
||||||
static this()
|
mixin(loadFromSharedLib2("csfml-window", "sfInput",
|
||||||
{
|
"IsKeyDown", "IsMouseButtonDown", "IsJoystickButtonDown", "GetMouseX", "GetMouseY", "GetJoystickAxis"));
|
||||||
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"));
|
|
||||||
}
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user