* D-ified property functions and used SFMLClass in:

- Window
 - RenderTargets
 - Image
 - Drawable
* fixed Image.copy -> copyImage

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1461 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
trass3r 2010-03-16 02:04:52 +00:00
parent 337448d3cb
commit dcdf39bf74
6 changed files with 844 additions and 897 deletions

View file

@ -42,7 +42,7 @@ import dsfml.graphics.idrawable,
* Package base class of all drawable.
* Provide implementation of IDrawable and functions aliases.
*/
package class DrawableImpl(alias derivedClassName) : DSFMLObject, IDrawable
package class DrawableImpl(string derivedClassName) : DSFMLObject, IDrawable
{
protected:
this()
@ -50,7 +50,7 @@ protected:
super(sfDrawable_Create());
}
this(void* ptr)
this(SFMLClass ptr)
{
super(ptr, true);
}
@ -210,107 +210,58 @@ public:
private:
extern (C)
static extern(C)
{
typedef void* function() pf_sfDrawable_Create;
typedef void function(void*) pf_sfDrawable_Destroy;
typedef void function(void*, float) pf_sfDrawable_SetX;
typedef void function(void*, float) pf_sfDrawable_SetY;
typedef void function(void*, float, float) pf_sfDrawable_SetPosition;
typedef void function(void*, float) pf_sfDrawable_SetScaleX;
typedef void function(void*, float) pf_sfDrawable_SetScaleY;
typedef void function(void*, float, float) pf_sfDrawable_SetScale;
typedef void function(void*, float) pf_sfDrawable_SetRotation;
typedef void function(void*, float, float) pf_sfDrawable_SetOrigin;
typedef void function(void*, Color) pf_sfDrawable_SetColor;
typedef void function(void*, BlendMode) pf_sfDrawable_SetBlendMode;
typedef float function(void*) pf_sfDrawable_GetX;
typedef float function(void*) pf_sfDrawable_GetY;
typedef float function(void*) pf_sfDrawable_GetScaleX;
typedef float function(void*) pf_sfDrawable_GetScaleY;
typedef float function(void*) pf_sfDrawable_GetRotation;
typedef float function(void*) pf_sfDrawable_GetOriginX;
typedef float function(void*) pf_sfDrawable_GetOriginY;
typedef Color function(void*) pf_sfDrawable_GetColor;
typedef BlendMode function(void*) pf_sfDrawable_GetBlendMode;
typedef void function(void*, float, float) pf_sfDrawable_Move;
typedef void function(void*, float, float) pf_sfDrawable_Scale;
typedef void function(void*, float) pf_sfDrawable_Rotate;
typedef void function(void*, float, float, float*, float*) pf_sfDrawable_TransformToLocal;
typedef void function(void*, float, float, float*, float*) pf_sfDrawable_TransformToGlobal;
SFMLClass function() sfDrawable_Create;
void function(SFMLClass) sfDrawable_Destroy;
void function(SFMLClass, float) sfDrawable_SetX;
void function(SFMLClass, float) sfDrawable_SetY;
void function(SFMLClass, float, float) sfDrawable_SetPosition;
void function(SFMLClass, float) sfDrawable_SetScaleX;
void function(SFMLClass, float) sfDrawable_SetScaleY;
void function(SFMLClass, float, float) sfDrawable_SetScale;
void function(SFMLClass, float) sfDrawable_SetRotation;
void function(SFMLClass, float, float) sfDrawable_SetOrigin;
void function(SFMLClass, Color) sfDrawable_SetColor;
void function(SFMLClass, BlendMode) sfDrawable_SetBlendMode;
float function(SFMLClass) sfDrawable_GetX;
float function(SFMLClass) sfDrawable_GetY;
float function(SFMLClass) sfDrawable_GetScaleX;
float function(SFMLClass) sfDrawable_GetScaleY;
float function(SFMLClass) sfDrawable_GetRotation;
float function(SFMLClass) sfDrawable_GetOriginX;
float function(SFMLClass) sfDrawable_GetOriginY;
Color function(SFMLClass) sfDrawable_GetColor;
BlendMode function(SFMLClass) sfDrawable_GetBlendMode;
void function(SFMLClass, float, float) sfDrawable_Move;
void function(SFMLClass, float, float) sfDrawable_Scale;
void function(SFMLClass, float) sfDrawable_Rotate;
void function(SFMLClass, float, float, float*, float*) sfDrawable_TransformToLocal;
void function(SFMLClass, float, float, float*, float*) sfDrawable_TransformToGlobal;
typedef void function(void*, void*) pf_sfRenderWindow_DrawThis;
typedef void function(void*, void*, void*) pf_sfRenderWindow_DrawThisWithShader;
typedef void function(void*, void*) pf_sfRenderImage_DrawThis;
typedef void function(void*, void*, void*) pf_sfRenderImage_DrawThisWithShader;
typedef void function(SFMLClass, SFMLClass) pf_sfRenderWindow_DrawThis;
typedef void function(SFMLClass, SFMLClass, SFMLClass) pf_sfRenderWindow_DrawThisWithShader;
typedef void function(SFMLClass, SFMLClass) pf_sfRenderImage_DrawThis;
typedef void function(SFMLClass, SFMLClass, SFMLClass) pf_sfRenderImage_DrawThisWithShader;
static pf_sfDrawable_Create sfDrawable_Create;
static pf_sfDrawable_Destroy sfDrawable_Destroy;
static pf_sfDrawable_SetX sfDrawable_SetX;
static pf_sfDrawable_SetY sfDrawable_SetY;
static pf_sfDrawable_SetPosition sfDrawable_SetPosition;
static pf_sfDrawable_SetScaleX sfDrawable_SetScaleX;
static pf_sfDrawable_SetScaleY sfDrawable_SetScaleY;
static pf_sfDrawable_SetScale sfDrawable_SetScale;
static pf_sfDrawable_SetRotation sfDrawable_SetRotation;
static pf_sfDrawable_SetOrigin sfDrawable_SetOrigin;
static pf_sfDrawable_SetColor sfDrawable_SetColor;
static pf_sfDrawable_SetBlendMode sfDrawable_SetBlendMode;
static pf_sfDrawable_GetX sfDrawable_GetX;
static pf_sfDrawable_GetY sfDrawable_GetY;
static pf_sfDrawable_GetScaleX sfDrawable_GetScaleX;
static pf_sfDrawable_GetScaleY sfDrawable_GetScaleY;
static pf_sfDrawable_GetRotation sfDrawable_GetRotation;
static pf_sfDrawable_GetOriginX sfDrawable_GetOriginX;
static pf_sfDrawable_GetOriginY sfDrawable_GetOriginY;
static pf_sfDrawable_GetColor sfDrawable_GetColor;
static pf_sfDrawable_GetBlendMode sfDrawable_GetBlendMode;
static pf_sfDrawable_Move sfDrawable_Move;
static pf_sfDrawable_Scale sfDrawable_Scale;
static pf_sfDrawable_Rotate sfDrawable_Rotate;
static pf_sfDrawable_TransformToLocal sfDrawable_TransformToLocal;
static pf_sfDrawable_TransformToGlobal sfDrawable_TransformToGlobal;
static pf_sfRenderWindow_DrawThis sfRenderWindow_DrawThis;
static pf_sfRenderWindow_DrawThisWithShader sfRenderWindow_DrawThisWithShader;
static pf_sfRenderImage_DrawThis sfRenderImage_DrawThis;
static pf_sfRenderImage_DrawThisWithShader sfRenderImage_DrawThisWithShader;
pf_sfRenderWindow_DrawThis sfRenderWindow_DrawThis;
pf_sfRenderWindow_DrawThisWithShader sfRenderWindow_DrawThisWithShader;
pf_sfRenderImage_DrawThis sfRenderImage_DrawThis;
pf_sfRenderImage_DrawThisWithShader sfRenderImage_DrawThisWithShader;
}
mixin(loadDerivedFromSharedLib("csfml-graphics", "sfDrawable", derivedClassName,
"Create", "Destroy", "SetX", "SetY", "SetPosition", "SetScaleX", "SetScaleY", "SetScale", "SetRotation", "SetOrigin", "SetColor", "SetBlendMode",
"GetX", "GetY", "GetScaleX", "GetScaleY", "GetRotation", "GetOriginX", "GetOriginY", "GetColor", "GetBlendMode", "Move",
"Scale", "Rotate", "TransformToLocal", "TransformToGlobal"));
static this()
{
debug
DllLoader dll = DllLoader.load("csfml-graphics-d");
else
DllLoader dll = DllLoader.load("csfml-graphics");
sfDrawable_Create = cast(pf_sfDrawable_Create)dll.getSymbol(derivedClassName ~ "_Create");
sfDrawable_Destroy = cast(pf_sfDrawable_Destroy)dll.getSymbol(derivedClassName ~ "_Destroy");
sfDrawable_SetX = cast(pf_sfDrawable_SetX)dll.getSymbol(derivedClassName ~ "_SetX");
sfDrawable_SetY = cast(pf_sfDrawable_SetY)dll.getSymbol(derivedClassName ~ "_SetY");
sfDrawable_SetPosition = cast(pf_sfDrawable_SetPosition)dll.getSymbol(derivedClassName ~ "_SetPosition");
sfDrawable_SetScaleX = cast(pf_sfDrawable_SetScaleX)dll.getSymbol(derivedClassName ~ "_SetScaleX");
sfDrawable_SetScaleY = cast(pf_sfDrawable_SetScaleY)dll.getSymbol(derivedClassName ~ "_SetScaleY");
sfDrawable_SetScale = cast(pf_sfDrawable_SetScale)dll.getSymbol(derivedClassName ~ "_SetScale");
sfDrawable_SetRotation = cast(pf_sfDrawable_SetRotation)dll.getSymbol(derivedClassName ~ "_SetRotation");
sfDrawable_SetOrigin = cast(pf_sfDrawable_SetOrigin)dll.getSymbol(derivedClassName ~ "_SetOrigin");
sfDrawable_SetColor = cast(pf_sfDrawable_SetColor)dll.getSymbol(derivedClassName ~ "_SetColor");
sfDrawable_SetBlendMode = cast(pf_sfDrawable_SetBlendMode)dll.getSymbol(derivedClassName ~ "_SetBlendMode");
sfDrawable_GetX = cast(pf_sfDrawable_GetX)dll.getSymbol(derivedClassName ~ "_GetX");
sfDrawable_GetY = cast(pf_sfDrawable_GetY)dll.getSymbol(derivedClassName ~ "_GetY");
sfDrawable_GetScaleX = cast(pf_sfDrawable_GetScaleX)dll.getSymbol(derivedClassName ~ "_GetScaleX");
sfDrawable_GetScaleY = cast(pf_sfDrawable_GetScaleY)dll.getSymbol(derivedClassName ~ "_GetScaleX");
sfDrawable_GetRotation = cast(pf_sfDrawable_GetRotation)dll.getSymbol(derivedClassName ~ "_GetRotation");
sfDrawable_GetOriginX = cast(pf_sfDrawable_GetOriginX)dll.getSymbol(derivedClassName ~ "_GetOriginX");
sfDrawable_GetOriginY = cast(pf_sfDrawable_GetOriginY)dll.getSymbol(derivedClassName ~ "_GetOriginY");
sfDrawable_GetColor = cast(pf_sfDrawable_GetColor)dll.getSymbol(derivedClassName ~ "_GetColor");
sfDrawable_GetBlendMode = cast(pf_sfDrawable_GetBlendMode)dll.getSymbol(derivedClassName ~ "_GetBlendMode");
sfDrawable_Move = cast(pf_sfDrawable_Move)dll.getSymbol(derivedClassName ~ "_Move");
sfDrawable_Scale = cast(pf_sfDrawable_Scale)dll.getSymbol(derivedClassName ~ "_Scale");
sfDrawable_Rotate = cast(pf_sfDrawable_Rotate)dll.getSymbol(derivedClassName ~ "_Rotate");
sfDrawable_TransformToLocal = cast(pf_sfDrawable_TransformToLocal)dll.getSymbol(derivedClassName ~ "_TransformToLocal");
sfDrawable_TransformToGlobal= cast(pf_sfDrawable_TransformToGlobal)dll.getSymbol(derivedClassName ~ "_TransformToGlobal");
debug
DllLoader dll = DllLoader.load("csfml-graphics-d");
else
DllLoader dll = DllLoader.load("csfml-graphics");
sfRenderWindow_DrawThis = cast(pf_sfRenderWindow_DrawThis)dll.getSymbol("sfRenderWindow_Draw" ~ derivedClassName[2..$]);
sfRenderWindow_DrawThisWithShader = cast(pf_sfRenderWindow_DrawThisWithShader)dll.getSymbol("sfRenderWindow_Draw" ~ derivedClassName[2..$] ~ "WithShader");
sfRenderImage_DrawThis = cast(pf_sfRenderImage_DrawThis)dll.getSymbol("sfRenderImage_Draw" ~ derivedClassName[2..$]);