* 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,73 +210,51 @@ 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
@ -284,33 +262,6 @@ private:
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");
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..$]);

View File

@ -29,6 +29,7 @@ module dsfml.graphics.image;
import dsfml.graphics.color,
dsfml.graphics.rect;
// dsfml.graphics.renderwindow;
import dsfml.system.common,
dsfml.system.exception,
@ -42,7 +43,7 @@ import dsfml.system.common,
class Image : DSFMLObject
{
package:
this(void* ptr)
this(SFMLClass ptr)
{
super(ptr, true);
}
@ -170,21 +171,23 @@ public:
sfImage_CreateMaskFromColor(m_ptr, colorKey, alpha);
}
// /**
// * Create the image from the current contents of the
// * given window
// *
// * Params:
// * window = Window to capture
// * sourceRect = Sub-rectangle of the screen to copy (empty by default - entire image)
// *
// * Returns:
// * True if copy was successful
// */
// void copyScreen(RenderWindow window, IntRect sourceRect = IntRect())
// {
// return cast(bool)sfImage_CopyScreen(m_ptr, window.nativePointer, sourceRect);
// }
/+
/**
* Create the image from the current contents of the
* given window
*
* Params:
* window = Window to capture
* sourceRect = Sub-rectangle of the screen to copy (empty by default - entire image)
*
* Returns:
* True if copy was successful
*/
bool copyScreen(RenderWindow window, IntRect sourceRect = IntRect())
{
return cast(bool)sfImage_CopyScreen(m_ptr, window.nativePointer, sourceRect);
}
+/
/**
* Copy pixels from another image onto this one.
@ -197,9 +200,9 @@ public:
* destY = Y coordinate of the destination position
* sourceRect = Sub-rectangle of the source image to copy
*/
void copy(Image source, uint destX, uint destY, IntRect sourceRect = IntRect())
void copyImage(Image source, uint destX, uint destY, IntRect sourceRect = IntRect())
{
sfImage_Copy(m_ptr, source.nativePointer, destX, destY, sourceRect);
sfImage_CopyImage(m_ptr, source.nativePointer, destX, destY, sourceRect);
}
/**
@ -241,7 +244,7 @@ public:
*/
ubyte[] getPixelsArray()
{
return sfImage_GetPixelsPtr(m_ptr)[0..getWidth() * getHeight() * 4];
return sfImage_GetPixelsPtr(m_ptr)[0..width() * height() * 4];
}
/**
@ -252,51 +255,6 @@ public:
sfImage_Bind(m_ptr);
}
/**
* Enable or disable image smooth filter.
* This parameter is enabled by default
*
* Params:
* smooth = True to enable smoothing filter, false to disable it
*/
void setSmooth(bool smooth)
{
sfImage_SetSmooth(m_ptr, smooth);
}
/**
* Return the width of the image
*
* Returns:
* Width in pixels
*/
uint getWidth()
{
return sfImage_GetWidth(m_ptr);
}
/**
* Return the height of the image
*
* Returns:
* Height in pixels
*/
uint getHeight()
{
return sfImage_GetHeight(m_ptr);
}
/**
* Tells whether the smooth filtering is enabled or not
*
* Returns:
* True if image smoothing is enabled
*/
bool isSmooth()
{
return cast(bool)sfImage_IsSmooth(m_ptr);
}
/**
* Update a sub-rectangle of the image from an array of pixels
*
@ -314,32 +272,81 @@ public:
sfImage_UpdatePixels(m_ptr, pixels.ptr, rectangle);
}
@property
{
/**
* Enable or disable image smooth filter.
* This parameter is enabled by default
*
* Params:
* s = True to enable smoothing filter, false to disable it
*/
void smooth(bool s)
{
sfImage_SetSmooth(m_ptr, s);
}
/**
* Return the width of the image
*
* Returns:
* Width in pixels
*/
uint width()
{
return sfImage_GetWidth(m_ptr);
}
/**
* Return the height of the image
*
* Returns:
* Height in pixels
*/
uint height()
{
return sfImage_GetHeight(m_ptr);
}
/**
* Tells whether the smooth filtering is enabled or not
*
* Returns:
* True if image smoothing is enabled
*/
bool smooth()
{
return cast(bool)sfImage_IsSmooth(m_ptr);
}
}
private:
static extern (C)
{
void* function() sfImage_Create;
void* function(uint, uint, Color) sfImage_CreateFromColor;
void* function(uint, uint, ubyte*) sfImage_CreateFromPixels;
void* function(cchar*) sfImage_CreateFromFile;
void* function(ubyte* ,size_t) sfImage_CreateFromMemory;
void function(void*) sfImage_Destroy;
int function(void*, cchar*) sfImage_SaveToFile;
void function(void*, Color, ubyte) sfImage_CreateMaskFromColor;
int function(void*, void*, IntRect) sfImage_CopyScreen;
void function(void*, void*, uint, uint, IntRect) sfImage_Copy;
void function(void*, uint, uint, Color) sfImage_SetPixel;
Color function(void*, uint, uint) sfImage_GetPixel;
ubyte* function(void*) sfImage_GetPixelsPtr;
void function(void*) sfImage_Bind;
void function(void*, int) sfImage_SetSmooth;
uint function(void*) sfImage_GetWidth;
uint function(void*) sfImage_GetHeight;
int function(void*) sfImage_IsSmooth;
void function(void*, ubyte*, IntRect) sfImage_UpdatePixels;
SFMLClass function() sfImage_Create;
SFMLClass function(uint, uint, Color) sfImage_CreateFromColor;
SFMLClass function(uint, uint, ubyte*) sfImage_CreateFromPixels;
SFMLClass function(cchar*) sfImage_CreateFromFile;
SFMLClass function(ubyte* ,size_t) sfImage_CreateFromMemory;
void function(SFMLClass) sfImage_Destroy;
int function(SFMLClass, cchar*) sfImage_SaveToFile;
void function(SFMLClass, Color, ubyte) sfImage_CreateMaskFromColor;
SFMLClass function(SFMLClass) sfImage_Copy;
int function(SFMLClass, SFMLClass, IntRect) sfImage_CopyScreen;
void function(SFMLClass, SFMLClass, uint, uint, IntRect) sfImage_CopyImage;
void function(SFMLClass, uint, uint, Color) sfImage_SetPixel;
Color function(SFMLClass, uint, uint) sfImage_GetPixel;
ubyte* function(SFMLClass) sfImage_GetPixelsPtr;
void function(SFMLClass) sfImage_Bind;
void function(SFMLClass, int) sfImage_SetSmooth;
uint function(SFMLClass) sfImage_GetWidth;
uint function(SFMLClass) sfImage_GetHeight;
int function(SFMLClass) sfImage_IsSmooth;
void function(SFMLClass, ubyte*, IntRect) sfImage_UpdatePixels;
}
mixin(loadFromSharedLib2("csfml-graphics", "sfImage",
"Create", "CreateFromColor", "CreateFromPixels", "CreateFromFile", "CreateFromMemory", "Destroy", "SaveToFile",
"CreateMaskFromColor", "CopyScreen", "Copy", "SetPixel", "GetPixel", "GetPixelsPtr", "Bind", "SetSmooth", "GetWidth",
"CreateMaskFromColor", "Copy", "CopyScreen", "CopyImage", "SetPixel", "GetPixel", "GetPixelsPtr", "Bind", "SetSmooth", "GetWidth",
"GetHeight", "IsSmooth", "UpdatePixels"));
}

View File

@ -59,58 +59,6 @@ interface IRenderTarget
*/
void draw(IDrawable object, Shader shader);
/**
* Get the width of the rendering region of the target
*
* \return Width in pixels
*
*/
uint getWidth();
/**
* Get the height of the rendering region of the target
*
* \return Height in pixels
*
*/
uint getHeight();
/**
* Change the current active view.
*
* \param view : New view to use (pass GetDefaultView() to set the default view)
*
*/
void setView(View view);
/**
* Get the current view
*
* \return Current view active in the window
*
*/
View getView();
/**
* Get the default view of the window
*
* \return Default view
*
*/
View getDefaultView();
/**
* Get the viewport of a view applied to this target
*
* \param view Target view
*
* \return Viewport rectangle, expressed in pixels in the current target
*
*/
IntRect getViewport(View view);
/**
* Convert a point in target coordinates into view coordinates
*
@ -134,4 +82,57 @@ interface IRenderTarget
*
*/
void restoreGLStates();
@property
{
/**
* Get the width of the rendering region of the target
*
* \return Width in pixels
*
*/
uint width();
/**
* Get the height of the rendering region of the target
*
* \return Height in pixels
*
*/
uint height();
/**
* Change the current active view.
*
* \param view : New view to use (pass GetDefaultView() to set the default view)
*
*/
void view(View view);
/**
* Get the current view
*
* \return Current view active in the window
*
*/
View view();
/**
* Get the default view of the window
*
* \return Default view
*
*/
View defaultView();
/**
* Get the viewport of a view applied to this target
*
* \param view Target view
*
* \return Viewport rectangle, expressed in pixels in the current target
*
*/
IntRect viewport(View view);
}
}

View File

@ -51,11 +51,16 @@ private:
View _defaultView = null;
package:
this(void* ptr)
this(SFMLClass ptr)
{
super(ptr, true);
}
override void dispose()
{
sfRenderImage_Destroy(m_ptr);
}
public:
/**
@ -71,46 +76,6 @@ public:
super(sfRenderImage_Create(width, height, depthBuffer));
}
override void dispose()
{
sfRenderImage_Destroy(m_ptr);
}
/**
* Return the width of the rendering region of a renderimage
*
* Returns:
* Width in pixels
*/
uint getWidth()
{
return sfRenderImage_GetWidth(m_ptr);
}
/**
* Return the height of the rendering region of a renderimage
*
* Returns:
* Height in pixels
*/
uint getHeight()
{
return sfRenderImage_GetHeight(m_ptr);
}
/**
* Activate or deactivate a renderimage as the current target for rendering
*
* Params:
* active = true to activate, false to deactivate
* Returns:
* true if operation was successful, false otherwise
*/
bool setActive(bool active)
{
return sfRenderImage_SetActive(m_ptr, active);
}
/**
* Update the contents of the target image
*/
@ -152,63 +117,6 @@ public:
sfRenderImage_Clear(m_ptr, color);
}
/**
* Change the current active view of a renderimage
*
* Params:
* view = Pointer to the new view
*/
void setView(View view)
{
if (_view !is null)
{
_view.setHandled(false);
}
sfRenderImage_SetView(m_ptr, view.nativePointer);
_view = view;
_view.setHandled(true);
}
/**
* Get the current active view rectangle
*
* Returns:
* current view rectangle, in global coordinates
*/
View getView()
{
if (_view is null)
{
void* cView = sfRenderImage_GetView(m_ptr);
_view = new View(cView, true);
}
return _view;
}
/**
* Get the default view
*
* Returns:
* default view
*/
View getDefaultView()
{
if (_defaultView is null)
{
void* cView = sfRenderImage_GetDefaultView(m_ptr);
_defaultView = new View(cView, true);
}
return _defaultView;
}
IntRect getViewport(View view = null) // TODO: is there a need to accept other Views than the currently assigned one?
{
return sfRenderImage_GetViewport(m_ptr, view is null ? _view.nativePointer : view.nativePointer);
}
/**
* Convert a point in image coordinates into view coordinates
*
@ -227,32 +135,7 @@ public:
return vec;
}
/**
* Get the target image
*
* Returns:
* target image
*/
Image getImage()
{
if (_image is null)
{
void* cImage = sfRenderImage_GetImage(m_ptr);
_image = new Image(cImage);
}
return _image;
}
/**
* Check whether the system supports render images or not
*
* Returns:
* true if the RenderImage class can be used
*/
bool isAvailable()
{
return sfRenderImage_IsAvailable();
}
/**
* Save the current OpenGL render states and matrices
@ -270,36 +153,158 @@ public:
sfRenderImage_RestoreGLStates(m_ptr);
}
@property
{
/**
* Return the width of the rendering region of a renderimage
*
* Returns:
* Width in pixels
*/
uint width()
{
return sfRenderImage_GetWidth(m_ptr);
}
/**
* Return the height of the rendering region of a renderimage
*
* Returns:
* Height in pixels
*/
uint height()
{
return sfRenderImage_GetHeight(m_ptr);
}
/**
* Activate or deactivate a renderimage as the current target for rendering
*
* Params:
* active = true to activate, false to deactivate
* Returns:
* true if operation was successful, false otherwise
*/
bool active(bool activ)
{
return sfRenderImage_SetActive(m_ptr, activ);
}
/**
* Change the current active view of a renderimage
*
* Params:
* view = Pointer to the new view
*/
void view(View v)
{
if (_view !is null)
{
_view.setHandled(false);
}
sfRenderImage_SetView(m_ptr, v.nativePointer);
_view = v;
_view.setHandled(true);
}
/**
* Get the current active view rectangle
*
* Returns:
* current view rectangle, in global coordinates
*/
View view()
{
if (_view is null)
{
SFMLClass cView = sfRenderImage_GetView(m_ptr);
_view = new View(cView, true);
}
return _view;
}
/**
* Get the default view
*
* Returns:
* default view
*/
View defaultView()
{
if (_defaultView is null)
{
SFMLClass cView = sfRenderImage_GetDefaultView(m_ptr);
_defaultView = new View(cView, true);
}
return _defaultView;
}
IntRect viewport(View v = null) // TODO: is there a need to accept other Views than the currently assigned one?
{
return sfRenderImage_GetViewport(m_ptr, v is null ? _view.nativePointer : v.nativePointer);
}
/**
* Get the target image
*
* Returns:
* target image
*/
Image image()
{
if (_image is null)
{
SFMLClass cImage = sfRenderImage_GetImage(m_ptr);
_image = new Image(cImage);
}
return _image;
}
/**
* Check whether the system supports render images or not
*
* Returns:
* true if the RenderImage class can be used
*/
bool isAvailable()
{
return sfRenderImage_IsAvailable();
}
}
private:
static extern(C)
{
void* function(uint, uint, bool) sfRenderImage_Create;
void function(void*) sfRenderImage_Destroy;
uint function(void*) sfRenderImage_GetWidth;
uint function(void*) sfRenderImage_GetHeight;
bool function(void*, bool) sfRenderImage_SetActive;
void function(void*) sfRenderImage_Display;
SFMLClass function(uint, uint, bool) sfRenderImage_Create;
void function(SFMLClass) sfRenderImage_Destroy;
uint function(SFMLClass) sfRenderImage_GetWidth;
uint function(SFMLClass) sfRenderImage_GetHeight;
bool function(SFMLClass, bool) sfRenderImage_SetActive;
void function(SFMLClass) sfRenderImage_Display;
void function(void*, void*) sfRenderImage_DrawSprite;
void function(void*, void*) sfRenderImage_DrawShape;
void function(void*, void*) sfRenderImage_DrawText;
void function(SFMLClass, void*) sfRenderImage_DrawSprite;
void function(SFMLClass, void*) sfRenderImage_DrawShape;
void function(SFMLClass, void*) sfRenderImage_DrawText;
void function(void*, void*, void*) sfRenderImage_DrawSpriteWithShader;
void function(void*, void*, void*) sfRenderImage_DrawShapeWithShader;
void function(void*, void*, void*) sfRenderImage_DrawTextWithShader;
void function(SFMLClass, void*, void*) sfRenderImage_DrawSpriteWithShader;
void function(SFMLClass, void*, void*) sfRenderImage_DrawShapeWithShader;
void function(SFMLClass, void*, void*) sfRenderImage_DrawTextWithShader;
void function(void*, Color) sfRenderImage_Clear;
void function(void*, void*) sfRenderImage_SetView;
void* function(void*) sfRenderImage_GetView;
void* function(void*) sfRenderImage_GetDefaultView;
IntRect function(void*, void*) sfRenderImage_GetViewport;
void function(void*, uint, uint, float*, float*, void*) sfRenderImage_ConvertCoords;
void* function(void*) sfRenderImage_GetImage;
void function(SFMLClass, Color) sfRenderImage_Clear;
void function(SFMLClass, SFMLClass) sfRenderImage_SetView;
SFMLClass function(SFMLClass) sfRenderImage_GetView;
SFMLClass function(SFMLClass) sfRenderImage_GetDefaultView;
IntRect function(SFMLClass, SFMLClass) sfRenderImage_GetViewport;
void function(SFMLClass, uint, uint, float*, float*, SFMLClass) sfRenderImage_ConvertCoords;
SFMLClass function(SFMLClass) sfRenderImage_GetImage;
bool function() sfRenderImage_IsAvailable;
// DSFML2
void function(void*) sfRenderImage_SaveGLStates;
void function(void*) sfRenderImage_RestoreGLStates;
void function(SFMLClass) sfRenderImage_SaveGLStates;
void function(SFMLClass) sfRenderImage_RestoreGLStates;
}
mixin(loadFromSharedLib2("csfml-graphics", "sfRenderImage", "Create", "Destroy", "GetWidth", "GetHeight",

View File

@ -30,7 +30,6 @@ import dsfml.graphics.color,
dsfml.graphics.sprite,
dsfml.graphics.shape,
dsfml.graphics.text,
dsfml.graphics.image,
dsfml.graphics.rect,
dsfml.graphics.shader,
dsfml.graphics.view,
@ -48,8 +47,8 @@ import dsfml.system.common,
dsfml.system.vector2;
/**
* Simple wrapper for Window that allows easy 2D rendering.
*/
* Simple wrapper for Window that allows easy 2D rendering.
*/
class RenderWindow : Window, IRenderTarget
{
private:
@ -67,7 +66,7 @@ public:
* windowStyle = Window style (Resize | Close by default)
* settings = Context settings (default is default ContextSettings values)
*/
this(VideoMode mode, string title, uint windowStyle = Style.Default, ContextSettings settings = ContextSettings())
this(VideoMode mode, string title, Style windowStyle = Style.Default, ContextSettings settings = ContextSettings())
{
super(sfRenderWindow_Create(mode, toStringz(title), windowStyle, &settings));
m_input = new Input(sfRenderWindow_GetInput(m_ptr));
@ -103,7 +102,7 @@ public:
* settings = Context settings (default is default ContextSettings values)
*
*/
void create(VideoMode mode, string title, uint windowStyle = Style.Default, ContextSettings settings = ContextSettings())
override void create(VideoMode mode, string title, Style windowStyle = Style.Default, ContextSettings settings = ContextSettings())
{
if (m_ptr !is null)
dispose();
@ -122,7 +121,7 @@ public:
* settings = Context settings (default is default ContextSettings values)
*
*/
void create(WindowHandle handle, ContextSettings settings = ContextSettings())
override void create(WindowHandle handle, ContextSettings settings = ContextSettings())
{
if (m_ptr !is null)
dispose();
@ -165,57 +164,7 @@ public:
sfRenderWindow_Clear(m_ptr, col);
}
/**
* Change the current active view.
* The current view is defined with the initial size of the window
*
* Params:
* newView = Pointer to the new view (pass getDefaultView to set the default view)
*/
void setView(View newView)
{
if (m_view !is null)
{
m_view.setHandled(false);
}
sfRenderWindow_SetView(m_ptr, newView.nativePointer);
m_view = newView;
m_view.setHandled(true);
}
/**
* Get the current view rectangle
*
* Returns:
* current view rectangle, in global coordinates
*/
View getView()
{
if (m_view is null)
{
void* cView = sfRenderWindow_GetView(m_ptr);
m_view = new View(cView, true);
}
return m_view;
}
/**
* Get the default view
*
* Returns:
* default view
*/
View getDefaultView()
{
if (m_defaultView is null)
{
void* cView = sfRenderWindow_GetDefaultView(m_ptr);
m_defaultView = new View(cView, true);
}
return m_defaultView;
}
/**
* Convert a point in window coordinates into view coordinates
@ -251,6 +200,59 @@ public:
sfRenderWindow_RestoreGLStates(m_ptr);
}
@property
{
/**
* Change the current active view.
* The current view is defined with the initial size of the window
*
* Params:
* newView = Pointer to the new view (pass getDefaultView to set the default view)
*/
void view(View newView)
{
if (m_view !is null)
{
m_view.setHandled(false);
}
sfRenderWindow_SetView(m_ptr, newView.nativePointer);
m_view = newView;
m_view.setHandled(true);
}
/**
* Get the current view rectangle
*
* Returns:
* current view rectangle, in global coordinates
*/
View view()
{
if (m_view is null)
{
SFMLClass cView = sfRenderWindow_GetView(m_ptr);
m_view = new View(cView, true);
}
return m_view;
}
/**
* Get the default view
*
* Returns:
* default view
*/
View defaultView()
{
if (m_defaultView is null)
{
SFMLClass cView = sfRenderWindow_GetDefaultView(m_ptr);
m_defaultView = new View(cView, true);
}
return m_defaultView;
}
/**
* Return the width of the rendering region of a renderwindow
@ -258,7 +260,7 @@ public:
* Returns:
* Width in pixels
*/
uint getWidth()
override uint width()
{
return sfRenderWindow_GetWidth(m_ptr);
}
@ -269,49 +271,58 @@ public:
* Returns:
* Height in pixels
*/
uint getHeight()
override uint height()
{
return sfRenderWindow_GetHeight(m_ptr);
}
IntRect getViewport(View view = null) // TODO: is there a need to accept other Views than the currently assigned one?
/**
* Get the viewport of a view applied to this target
*
* Params:
* view = Target view
* Returns:
* Viewport rectangle, expressed in pixels in the current target
*/
IntRect viewport(View v = null) // TODO: is there a need to accept other Views than the currently assigned one?
{
return sfRenderWindow_GetViewport(m_ptr, view is null ? m_view.nativePointer : view.nativePointer);
return sfRenderWindow_GetViewport(m_ptr, v is null ? m_view.nativePointer : v.nativePointer);
}
}
private:
static extern(C)
{
void* function(VideoMode, cchar*, uint, ContextSettings*) sfRenderWindow_Create;
void* function(WindowHandle, ContextSettings*) sfRenderWindow_CreateFromHandle;
void function(void*) sfRenderWindow_Destroy;
void* function(void*) sfRenderWindow_GetInput;
bool function(void*) sfRenderWindow_IsOpened;
uint function(void*) sfRenderWindow_GetWidth;
uint function(void*) sfRenderWindow_GetHeight;
SFMLClass function(VideoMode, cchar*, Style, ContextSettings*)sfRenderWindow_Create;
SFMLClass function(WindowHandle, ContextSettings*) sfRenderWindow_CreateFromHandle;
void function(SFMLClass) sfRenderWindow_Destroy;
SFMLClass function(SFMLClass) sfRenderWindow_GetInput;
bool function(SFMLClass) sfRenderWindow_IsOpened;
uint function(SFMLClass) sfRenderWindow_GetWidth;
uint function(SFMLClass) sfRenderWindow_GetHeight;
/*
void function(void*, void*) sfRenderWindow_DrawSprite;
void function(void*, void*) sfRenderWindow_DrawShape;
void function(void*, void*) sfRenderWindow_DrawText;
void function(SFMLClass, SFMLClass) sfRenderWindow_DrawSprite;
void function(SFMLClass, SFMLClass) sfRenderWindow_DrawShape;
void function(SFMLClass, SFMLClass) sfRenderWindow_DrawText;
void function(void*, void*, void*) sfRenderWindow_DrawSpriteWithShader;
void function(void*, void*, void*) sfRenderWindow_DrawShapeWithShader;
void function(void*, void*, void*) sfRenderWindow_DrawTextWithShader;
void function(SFMLClass, SFMLClass, SFMLClass) sfRenderWindow_DrawSpriteWithShader;
void function(SFMLClass, SFMLClass, SFMLClass) sfRenderWindow_DrawShapeWithShader;
void function(SFMLClass, SFMLClass, SFMLClass) sfRenderWindow_DrawTextWithShader;
*/
void* function(void*) sfRenderWindow_Capture;
void function(void*, Color) sfRenderWindow_Clear;
void function(void*, void*) sfRenderWindow_SetView;
void* function(void*) sfRenderWindow_GetView;
void* function (void*) sfRenderWindow_GetDefaultView;
void function(void*, uint, uint, float*, float*, void*) sfRenderWindow_ConvertCoords;
SFMLClass function(SFMLClass) sfRenderWindow_Capture;
void function(SFMLClass, Color) sfRenderWindow_Clear;
void function(SFMLClass, SFMLClass) sfRenderWindow_SetView;
SFMLClass function(SFMLClass) sfRenderWindow_GetView;
SFMLClass function(SFMLClass) sfRenderWindow_GetDefaultView;
void function(SFMLClass, uint, uint, float*, float*, SFMLClass) sfRenderWindow_ConvertCoords;
// DSFML2
void function(void*) sfRenderWindow_SaveGLStates;
void function(void*) sfRenderWindow_RestoreGLStates;
IntRect function(void*, void*) sfRenderWindow_GetViewport;
void function(SFMLClass) sfRenderWindow_SaveGLStates;
void function(SFMLClass) sfRenderWindow_RestoreGLStates;
IntRect function(SFMLClass, SFMLClass) sfRenderWindow_GetViewport;
}
mixin(loadFromSharedLib2("csfml-graphics", "sfRenderWindow", "Create", "CreateFromHandle",

View File

@ -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.window;
@ -36,9 +36,9 @@ import dsfml.system.stringutil;
/**
* Window style
*/
enum Style
* Window style
*/
enum Style : uint
{
None = 0, /// No border / title bar (this flag and all others are mutually exclusive)
Titlebar = 1 << 0, /// Title bar + fixed border
@ -51,8 +51,8 @@ enum Style
/**
* Structure defining the creation settings of windows
*/
* Structure defining the creation settings of windows
*/
struct ContextSettings
{
uint DepthBits = 24; /// Bits of the depth buffer
@ -64,19 +64,25 @@ struct ContextSettings
/**
* Window is a rendering window ; it can create a new window
* or connect to an existing one
*/
* Window is a rendering window ; it can create a new window
* or connect to an existing one
*/
class Window : DSFMLObject
{
protected:
this(void* ptr)
this(SFMLClass ptr)
{
super(ptr);
}
Input m_input;
override void dispose()
{
m_input = null;
sfWindow_Destroy(m_ptr);
}
public:
/**
* Construct a new window
@ -89,7 +95,7 @@ public:
*/
this(VideoMode mode, string title, Style windowStyle = Style.Default, ContextSettings settings = ContextSettings())
{
super(sfWindow_Create(mode, toStringz(title), windowStyle, settings));
super(sfWindow_Create(mode, toStringz(title), windowStyle, &settings));
}
/**
@ -101,13 +107,7 @@ public:
*/
this(WindowHandle handle, ContextSettings settings = ContextSettings())
{
super(sfWindow_CreateFromHandle(handle, settings));
}
override void dispose()
{
m_input = null;
sfWindow_Destroy(m_ptr);
super(sfWindow_CreateFromHandle(handle, &settings));
}
/**
@ -126,7 +126,7 @@ public:
if (m_ptr !is null)
dispose();
m_ptr = sfWindow_Create(mode, toStringz(title), windowStyle, settings);
m_ptr = sfWindow_Create(mode, toStringz(title), windowStyle, &settings);
}
/**
@ -143,7 +143,7 @@ public:
if (m_ptr !is null)
dispose();
m_ptr = sfWindow_CreateFromHandle(handle, settings);
m_ptr = sfWindow_CreateFromHandle(handle, &settings);
}
/**
@ -155,6 +155,62 @@ public:
sfWindow_Close(m_ptr);
}
/**
* Get the event on top of events stack, if any, and pop it
*
* Params:
* eventReceived = Event to fill, if any
*
* Returns:
* True if an event was returned, false if events stack was empty
*/
bool getEvent(out Event eventReceived)
{
return cast(bool) sfWindow_GetEvent(m_ptr, &eventReceived);
}
/**
* Wait for an event and return it
*
* This function is blocking: if there's no pending event then it will wait until an event is received.
* After this function returns (and no error occured), the \a event object is always valid and filled properly.
* This function is typically used when you have a thread that is dedicated to events handling: you want to make this thread
* sleep as long as no new event is received.
*
* Params:
* e Event to be returned
*
* Returns:
* false if any error occured
*/
bool waitEvent(out Event e)
{
return sfWindow_WaitEvent(m_ptr, &e);
}
/**
* Show or hide the window
*
* Params:
* state = True to show, false to hide
*
*/
void show(bool state)
{
sfWindow_Show(m_ptr, state);
}
/**
* Display the window on screen
*/
void display()
{
sfWindow_Display(m_ptr);
}
@property
{
/**
* Tell whether or not a window is opened
*
@ -171,7 +227,7 @@ public:
* Returns:
* Width in pixels
*/
uint getWidth()
uint width()
{
return sfWindow_GetWidth(m_ptr);
}
@ -182,7 +238,7 @@ public:
* Returns:
* Height in pixels
*/
uint getHeight()
uint height()
{
return sfWindow_GetHeight(m_ptr);
}
@ -193,26 +249,11 @@ public:
* Returns:
* Settings used to create the window
*/
ContextSettings getSettings()
ContextSettings settings()
{
return sfWindow_GetSettings(m_ptr);
}
/**
* Get the event on top of events stack, if any, and pop it
*
* Params:
* eventReceived = Event to fill, if any
*
* Returns:
* True if an event was returned, false if events stack was empty
*/
bool getEvent(out Event eventReceived)
{
return cast(bool) sfWindow_GetEvent(m_ptr, &eventReceived);
}
/**
* Enable / disable vertical synchronization
*
@ -235,6 +276,81 @@ public:
sfWindow_ShowMouseCursor(m_ptr, show);
}
/**
* Enable or disable automatic key-repeat for keydown events.
* Automatic key-repeat is enabled by default.
*
* Params:
* enabled = true to enable, false to disable
*/
void enableKeyRepeat(bool enabled)
{
sfWindow_EnableKeyRepeat(m_ptr, enabled);
}
/**
* Set the window as the current target for rendering
*
* Params:
* active = True to activate, false to deactivate
* Returns:
* True if operation was successful, false otherwise
*/
bool active(bool active)
{
return cast(bool)sfWindow_SetActive(m_ptr, active);
}
/**
* Get the input manager of the window
*
* Returns:
* An input manager
* See_Also :
* Input
*/
Input input()
{
if (m_input is null)
m_input = new Input(sfWindow_GetInput(m_ptr));
return m_input;
}
/**
* Limit the framerate to a maximum fixed frequency
*
* Params:
* limit : Framerate limit, in frames per seconds (use 0 to disable limit)
*/
void framerateLimit(uint limit)
{
sfWindow_SetFramerateLimit(m_ptr, limit);
}
/**
* Get the time the last frame took
*
* Returns:
* time in seconds
*/
float frameTime()
{
return sfWindow_GetFrameTime(m_ptr);
}
/**
* Change the joystick threshold, ie. the value below which
* no move event will be generated
*
* Params:
* threshold : New threshold, in range [0, 100]
*/
void joystickThreshold(float threshold)
{
sfWindow_SetJoystickThreshold(m_ptr, threshold);
}
}
/**
* Change the position of the mouse cursor
*
@ -272,30 +388,6 @@ public:
sfWindow_SetSize(m_ptr, width, height);
}
/**
* Show or hide the window
*
* Params:
* state = True to show, false to hide
*
*/
void show(bool state)
{
sfWindow_Show(m_ptr, state);
}
/**
* Enable or disable automatic key-repeat for keydown events.
* Automatic key-repeat is enabled by default.
*
* Params:
* enabled = true to enable, false to disable
*/
void enableKeyRepeat(bool enabled)
{
sfWindow_EnableKeyRepeat(m_ptr, enabled);
}
/**
* Change the window's icon
*
@ -310,161 +402,41 @@ public:
sfWindow_SetIcon(m_ptr, width, height, data.ptr);
}
/**
* Set the window as the current target for rendering
*
* Params:
* active = True to activate, false to deactivate
* Returns:
* True if operation was successful, false otherwise
*/
bool setActive(bool active = true)
{
return cast(bool)sfWindow_SetActive(m_ptr, active);
}
/**
* Display the window on screen
*/
void display()
{
sfWindow_Display(m_ptr);
}
/**
* Get the input manager of the window
*
* Returns:
* An input manager
* See_Also :
* Input
*/
Input getInput()
{
if (m_input is null)
m_input = new Input(sfWindow_GetInput(m_ptr));
return m_input;
}
/**
* Limit the framerate to a maximum fixed frequency
*
* Params:
* limit : Framerate limit, in frames per seconds (use 0 to disable limit)
*/
void setFramerateLimit(uint limit)
{
sfWindow_SetFramerateLimit(m_ptr, limit);
}
/**
* Get the time the last frame took
*
* Returns:
* time in seconds
*/
float getFrameTime()
{
return sfWindow_GetFrameTime(m_ptr);
}
/**
* Change the joystick threshold, ie. the value below which
* no move event will be generated
*
* Params:
* threshold : New threshold, in range [0, 100]
*/
void setJoystickThreshold(float threshold)
{
sfWindow_SetJoystickThreshold(m_ptr, threshold);
}
/**
* Wait for an event and return it
*
* This function is blocking: if there's no pending event then it will wait until an event is received.
* After this function returns (and no error occured), the \a event object is always valid and filled properly.
* This function is typically used when you have a thread that is dedicated to events handling: you want to make this thread
* sleep as long as no new event is received.
*
* Params:
* e Event to be returned
*
* Returns:
* false if any error occured
*/
bool waitEvent(out Event e)
{
return sfWindow_WaitEvent(m_ptr, &e);
}
private:
// External ====================================================================
extern (C)
static extern(C)
{
static
{
void* function(VideoMode, cchar*, uint, ContextSettings) sfWindow_Create;
void* function(WindowHandle, ContextSettings) sfWindow_CreateFromHandle;
void function(void*) sfWindow_Destroy;
void function(void*) sfWindow_Close;
int function(void*) sfWindow_IsOpened;
uint function(void*) sfWindow_GetWidth;
uint function(void*) sfWindow_GetHeight;
ContextSettings function(void* Window) sfWindow_GetSettings;
int function(void*, Event*) sfWindow_GetEvent;
void function(void*, int) sfWindow_UseVerticalSync;
void function(void*, int) sfWindow_ShowMouseCursor;
void function(void*, uint, uint) sfWindow_SetCursorPosition;
void function(void*, int, int) sfWindow_SetPosition;
void function(void*, uint, uint) sfWindow_SetSize;
void function(void*, int) sfWindow_Show;
void function(void*, int) sfWindow_EnableKeyRepeat;
void function(void*, size_t, size_t, ubyte*) sfWindow_SetIcon;
int function(void*, int) sfWindow_SetActive;
void function(void*) sfWindow_Display;
void* function(void*) sfWindow_GetInput;
void function(void*, uint) sfWindow_SetFramerateLimit;
float function(void*) sfWindow_GetFrameTime;
void function(void*, float) sfWindow_SetJoystickThreshold;
SFMLClass function(VideoMode, cchar*, Style, ContextSettings*)sfWindow_Create;
SFMLClass function(WindowHandle, ContextSettings*) sfWindow_CreateFromHandle;
void function(SFMLClass) sfWindow_Destroy;
void function(SFMLClass) sfWindow_Close;
int function(SFMLClass) sfWindow_IsOpened;
uint function(SFMLClass) sfWindow_GetWidth;
uint function(SFMLClass) sfWindow_GetHeight;
ContextSettings function(SFMLClass Window) sfWindow_GetSettings;
int function(SFMLClass, Event*) sfWindow_GetEvent;
void function(SFMLClass, int) sfWindow_UseVerticalSync;
void function(SFMLClass, int) sfWindow_ShowMouseCursor;
void function(SFMLClass, uint, uint) sfWindow_SetCursorPosition;
void function(SFMLClass, int, int) sfWindow_SetPosition;
void function(SFMLClass, uint, uint) sfWindow_SetSize;
void function(SFMLClass, int) sfWindow_Show;
void function(SFMLClass, int) sfWindow_EnableKeyRepeat;
void function(SFMLClass, size_t, size_t, ubyte*) sfWindow_SetIcon;
int function(SFMLClass, int) sfWindow_SetActive;
void function(SFMLClass) sfWindow_Display;
SFMLClass function(SFMLClass) sfWindow_GetInput;
void function(SFMLClass, uint) sfWindow_SetFramerateLimit;
float function(SFMLClass) sfWindow_GetFrameTime;
void function(SFMLClass, float) sfWindow_SetJoystickThreshold;
// DSFML2
bool function(void*, void*) sfWindow_WaitEvent;
}
bool function(SFMLClass, void*) sfWindow_WaitEvent;
}
static this()
{
debug
DllLoader dll = DllLoader.load("csfml-window-d");
else
DllLoader dll = DllLoader.load("csfml-window");
mixin(loadFromSharedLib("sfWindow_Create"));
mixin(loadFromSharedLib("sfWindow_CreateFromHandle"));
mixin(loadFromSharedLib("sfWindow_Destroy"));
mixin(loadFromSharedLib("sfWindow_Close"));
mixin(loadFromSharedLib("sfWindow_IsOpened"));
mixin(loadFromSharedLib("sfWindow_GetWidth"));
mixin(loadFromSharedLib("sfWindow_GetHeight"));
mixin(loadFromSharedLib("sfWindow_GetSettings"));
mixin(loadFromSharedLib("sfWindow_GetEvent"));
mixin(loadFromSharedLib("sfWindow_UseVerticalSync"));
mixin(loadFromSharedLib("sfWindow_ShowMouseCursor"));
mixin(loadFromSharedLib("sfWindow_SetCursorPosition"));
mixin(loadFromSharedLib("sfWindow_SetPosition"));
mixin(loadFromSharedLib("sfWindow_SetSize"));
mixin(loadFromSharedLib("sfWindow_Show"));
mixin(loadFromSharedLib("sfWindow_EnableKeyRepeat"));
mixin(loadFromSharedLib("sfWindow_SetIcon"));
mixin(loadFromSharedLib("sfWindow_SetActive"));
mixin(loadFromSharedLib("sfWindow_Display"));
mixin(loadFromSharedLib("sfWindow_GetInput"));
mixin(loadFromSharedLib("sfWindow_SetFramerateLimit"));
mixin(loadFromSharedLib("sfWindow_GetFrameTime"));
mixin(loadFromSharedLib("sfWindow_SetJoystickThreshold"));
mixin(loadFromSharedLib("sfWindow_WaitEvent"));
}
mixin(loadFromSharedLib2("csfml-window", "sfWindow",
"Create", "CreateFromHandle", "Destroy", "Close", "IsOpened", "GetWidth", "GetHeight", "GetSettings", "GetEvent", "UseVerticalSync",
"ShowMouseCursor", "SetCursorPosition", "SetPosition", "SetSize", "Show", "EnableKeyRepeat", "SetIcon", "SetActive", "Display",
"GetInput", "SetFramerateLimit", "GetFrameTime", "SetJoystickThreshold", "WaitEvent"));
}