+ RenderImage
+ RenderWindow.flush() + View.reset() + Window.waitEvent() * moved TextStyle to module text * Sprite was strangefully missing base constructor call * changed Rect to be a struct instead of a class git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1335 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
parent
2f2fc5d4fa
commit
be3741de5b
@ -52,6 +52,7 @@ package extern (C)
|
|||||||
void* function(void*) sfRenderWindow_GetInput;
|
void* function(void*) sfRenderWindow_GetInput;
|
||||||
// bool function(void*) sfRenderWindow_IsOpened;
|
// bool function(void*) sfRenderWindow_IsOpened;
|
||||||
|
|
||||||
|
/*
|
||||||
void function(void*, void*) sfRenderWindow_DrawSprite;
|
void function(void*, void*) sfRenderWindow_DrawSprite;
|
||||||
void function(void*, void*) sfRenderWindow_DrawShape;
|
void function(void*, void*) sfRenderWindow_DrawShape;
|
||||||
void function(void*, void*) sfRenderWindow_DrawText;
|
void function(void*, void*) sfRenderWindow_DrawText;
|
||||||
@ -59,6 +60,7 @@ package extern (C)
|
|||||||
void function(void*, void*, void*) sfRenderWindow_DrawSpriteWithShader;
|
void function(void*, void*, void*) sfRenderWindow_DrawSpriteWithShader;
|
||||||
void function(void*, void*, void*) sfRenderWindow_DrawShapeWithShader;
|
void function(void*, void*, void*) sfRenderWindow_DrawShapeWithShader;
|
||||||
void function(void*, void*, void*) sfRenderWindow_DrawTextWithShader;
|
void function(void*, void*, void*) sfRenderWindow_DrawTextWithShader;
|
||||||
|
*/
|
||||||
|
|
||||||
void* function(void*) sfRenderWindow_Capture;
|
void* function(void*) sfRenderWindow_Capture;
|
||||||
void function(void*, Color) sfRenderWindow_Clear;
|
void function(void*, Color) sfRenderWindow_Clear;
|
||||||
@ -67,6 +69,10 @@ package extern (C)
|
|||||||
void* function (void*) sfRenderWindow_GetDefaultView;
|
void* function (void*) sfRenderWindow_GetDefaultView;
|
||||||
void function(void*, uint, uint, float*, float*, void*) sfRenderWindow_ConvertCoords;
|
void function(void*, uint, uint, float*, float*, void*) sfRenderWindow_ConvertCoords;
|
||||||
|
|
||||||
|
// DSFML2
|
||||||
|
|
||||||
|
void function(void*) sfRenderWindow_Flush;
|
||||||
|
|
||||||
// sfShader
|
// sfShader
|
||||||
void* function(cchar*) sfShader_CreateFromFile;
|
void* function(cchar*) sfShader_CreateFromFile;
|
||||||
void* function(cchar*) sfShader_CreateFromMemory;
|
void* function(cchar*) sfShader_CreateFromMemory;
|
||||||
@ -82,22 +88,24 @@ package extern (C)
|
|||||||
|
|
||||||
// sfView
|
// sfView
|
||||||
void* function() sfView_Create;
|
void* function() sfView_Create;
|
||||||
void* function(sfFloatRect) sfView_CreateFromRect;
|
void* function(FloatRect) sfView_CreateFromRect;
|
||||||
void function(void*) sfView_Destroy;
|
void function(void*) sfView_Destroy;
|
||||||
void function(void*, float, float) sfView_SetCenter;
|
void function(void*, float, float) sfView_SetCenter;
|
||||||
void function(void*, float, float) sfView_SetSize;
|
void function(void*, float, float) sfView_SetSize;
|
||||||
void function(void*, sfFloatRect) sfView_SetViewport;
|
void function(void*, FloatRect) sfView_SetViewport;
|
||||||
float function(void*) sfView_GetCenterX;
|
float function(void*) sfView_GetCenterX;
|
||||||
float function(void*) sfView_GetCenterY;
|
float function(void*) sfView_GetCenterY;
|
||||||
float function(void*) sfView_GetWidth;
|
float function(void*) sfView_GetWidth;
|
||||||
float function(void*) sfView_GetHeight;
|
float function(void*) sfView_GetHeight;
|
||||||
sfFloatRect function(void*) sfView_GetViewport;
|
FloatRect function(void*) sfView_GetViewport;
|
||||||
void function(void*, float, float) sfView_Move;
|
void function(void*, float, float) sfView_Move;
|
||||||
void function(void*, float) sfView_Zoom;
|
void function(void*, float) sfView_Zoom;
|
||||||
|
|
||||||
|
// DSFML2
|
||||||
void function(void*, float) sfView_SetRotation;
|
void function(void*, float) sfView_SetRotation;
|
||||||
float function(void*) sfView_GetRotation;
|
float function(void*) sfView_GetRotation;
|
||||||
void function(void*, float) sfView_Rotate;
|
void function(void*, float) sfView_Rotate;
|
||||||
|
void function(void*, FloatRect) sfView_Reset;
|
||||||
}
|
}
|
||||||
|
|
||||||
static this()
|
static this()
|
||||||
@ -120,6 +128,7 @@ else
|
|||||||
mixin(loadFromSharedLib("sfRenderWindow_Destroy"));
|
mixin(loadFromSharedLib("sfRenderWindow_Destroy"));
|
||||||
mixin(loadFromSharedLib("sfRenderWindow_GetInput"));
|
mixin(loadFromSharedLib("sfRenderWindow_GetInput"));
|
||||||
|
|
||||||
|
/*
|
||||||
mixin(loadFromSharedLib("sfRenderWindow_DrawSprite"));
|
mixin(loadFromSharedLib("sfRenderWindow_DrawSprite"));
|
||||||
mixin(loadFromSharedLib("sfRenderWindow_DrawShape"));
|
mixin(loadFromSharedLib("sfRenderWindow_DrawShape"));
|
||||||
mixin(loadFromSharedLib("sfRenderWindow_DrawText"));
|
mixin(loadFromSharedLib("sfRenderWindow_DrawText"));
|
||||||
@ -127,6 +136,7 @@ else
|
|||||||
mixin(loadFromSharedLib("sfRenderWindow_DrawSpriteWithShader"));
|
mixin(loadFromSharedLib("sfRenderWindow_DrawSpriteWithShader"));
|
||||||
mixin(loadFromSharedLib("sfRenderWindow_DrawShapeWithShader"));
|
mixin(loadFromSharedLib("sfRenderWindow_DrawShapeWithShader"));
|
||||||
mixin(loadFromSharedLib("sfRenderWindow_DrawTextWithShader"));
|
mixin(loadFromSharedLib("sfRenderWindow_DrawTextWithShader"));
|
||||||
|
*/
|
||||||
|
|
||||||
mixin(loadFromSharedLib("sfRenderWindow_Clear"));
|
mixin(loadFromSharedLib("sfRenderWindow_Clear"));
|
||||||
mixin(loadFromSharedLib("sfRenderWindow_SetView"));
|
mixin(loadFromSharedLib("sfRenderWindow_SetView"));
|
||||||
@ -134,6 +144,9 @@ else
|
|||||||
mixin(loadFromSharedLib("sfRenderWindow_GetDefaultView"));
|
mixin(loadFromSharedLib("sfRenderWindow_GetDefaultView"));
|
||||||
mixin(loadFromSharedLib("sfRenderWindow_ConvertCoords"));
|
mixin(loadFromSharedLib("sfRenderWindow_ConvertCoords"));
|
||||||
|
|
||||||
|
// DSFML2
|
||||||
|
mixin(loadFromSharedLib("sfRenderWindow_Flush"));
|
||||||
|
|
||||||
// sfShader
|
// sfShader
|
||||||
mixin(loadFromSharedLib("sfShader_CreateFromFile"));
|
mixin(loadFromSharedLib("sfShader_CreateFromFile"));
|
||||||
mixin(loadFromSharedLib("sfShader_CreateFromMemory"));
|
mixin(loadFromSharedLib("sfShader_CreateFromMemory"));
|
||||||
@ -162,7 +175,9 @@ else
|
|||||||
mixin(loadFromSharedLib("sfView_Move"));
|
mixin(loadFromSharedLib("sfView_Move"));
|
||||||
mixin(loadFromSharedLib("sfView_Zoom"));
|
mixin(loadFromSharedLib("sfView_Zoom"));
|
||||||
|
|
||||||
|
// DSFML2
|
||||||
mixin(loadFromSharedLib("sfView_SetRotation"));
|
mixin(loadFromSharedLib("sfView_SetRotation"));
|
||||||
mixin(loadFromSharedLib("sfView_GetRotation"));
|
mixin(loadFromSharedLib("sfView_GetRotation"));
|
||||||
mixin(loadFromSharedLib("sfView_Rotate"));
|
mixin(loadFromSharedLib("sfView_Rotate"));
|
||||||
|
mixin(loadFromSharedLib("sfView_Reset"));
|
||||||
}
|
}
|
@ -29,11 +29,12 @@ module dsfml.graphics.drawableimpl;
|
|||||||
public import dsfml.system.common;
|
public import dsfml.system.common;
|
||||||
import dsfml.system.vector2;
|
import dsfml.system.vector2;
|
||||||
|
|
||||||
import dsfml.graphics.idrawable;
|
import dsfml.graphics.idrawable,
|
||||||
import dsfml.graphics.color;
|
dsfml.graphics.color,
|
||||||
import dsfml.graphics.blendmode;
|
dsfml.graphics.blendmode,
|
||||||
import dsfml.graphics.renderwindow;
|
dsfml.graphics.renderwindow,
|
||||||
import dsfml.graphics.shader;
|
dsfml.graphics.renderimage,
|
||||||
|
dsfml.graphics.shader;
|
||||||
|
|
||||||
package
|
package
|
||||||
{
|
{
|
||||||
@ -202,7 +203,7 @@ public:
|
|||||||
|
|
||||||
void render(RenderWindow window)
|
void render(RenderWindow window)
|
||||||
{
|
{
|
||||||
sfRenderWindow_DrawThis(window.getNativePointer, m_ptr);
|
sfRenderWindow_DrawThis(window.getNativePointer(), m_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void renderWithShader(RenderWindow window, Shader shader)
|
void renderWithShader(RenderWindow window, Shader shader)
|
||||||
@ -210,6 +211,16 @@ public:
|
|||||||
sfRenderWindow_DrawThisWithShader(window.getNativePointer, m_ptr, shader.getNativePointer);
|
sfRenderWindow_DrawThisWithShader(window.getNativePointer, m_ptr, shader.getNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void render(RenderImage image)
|
||||||
|
{
|
||||||
|
sfRenderImage_DrawThis(image.getNativePointer(), m_ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void renderWithShader(RenderImage image, Shader shader)
|
||||||
|
{
|
||||||
|
sfRenderImage_DrawThisWithShader(image.getNativePointer, m_ptr, shader.getNativePointer);
|
||||||
|
}
|
||||||
|
|
||||||
override void dispose()
|
override void dispose()
|
||||||
{
|
{
|
||||||
sfDrawable_Destroy(m_ptr);
|
sfDrawable_Destroy(m_ptr);
|
||||||
@ -248,6 +259,8 @@ private:
|
|||||||
|
|
||||||
typedef void function(void*, void*) pf_sfRenderWindow_DrawThis;
|
typedef void function(void*, void*) pf_sfRenderWindow_DrawThis;
|
||||||
typedef void function(void*, void*, void*) pf_sfRenderWindow_DrawThisWithShader;
|
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;
|
||||||
|
|
||||||
static pf_sfDrawable_Create sfDrawable_Create;
|
static pf_sfDrawable_Create sfDrawable_Create;
|
||||||
static pf_sfDrawable_Destroy sfDrawable_Destroy;
|
static pf_sfDrawable_Destroy sfDrawable_Destroy;
|
||||||
@ -278,6 +291,8 @@ private:
|
|||||||
|
|
||||||
static pf_sfRenderWindow_DrawThis sfRenderWindow_DrawThis;
|
static pf_sfRenderWindow_DrawThis sfRenderWindow_DrawThis;
|
||||||
static pf_sfRenderWindow_DrawThisWithShader sfRenderWindow_DrawThisWithShader;
|
static pf_sfRenderWindow_DrawThisWithShader sfRenderWindow_DrawThisWithShader;
|
||||||
|
static pf_sfRenderImage_DrawThis sfRenderImage_DrawThis;
|
||||||
|
static pf_sfRenderImage_DrawThisWithShader sfRenderImage_DrawThisWithShader;
|
||||||
}
|
}
|
||||||
|
|
||||||
static this()
|
static this()
|
||||||
@ -329,5 +344,7 @@ private:
|
|||||||
|
|
||||||
sfRenderWindow_DrawThis = cast(pf_sfRenderWindow_DrawThis)dll.getSymbol("sfRenderWindow_Draw" ~ symbol[2..$]);
|
sfRenderWindow_DrawThis = cast(pf_sfRenderWindow_DrawThis)dll.getSymbol("sfRenderWindow_Draw" ~ symbol[2..$]);
|
||||||
sfRenderWindow_DrawThisWithShader = cast(pf_sfRenderWindow_DrawThisWithShader)dll.getSymbol("sfRenderWindow_Draw" ~ symbol[2..$] ~ "WithShader");
|
sfRenderWindow_DrawThisWithShader = cast(pf_sfRenderWindow_DrawThisWithShader)dll.getSymbol("sfRenderWindow_Draw" ~ symbol[2..$] ~ "WithShader");
|
||||||
|
sfRenderImage_DrawThis = cast(pf_sfRenderImage_DrawThis)dll.getSymbol("sfRenderImage_Draw" ~ symbol[2..$]);
|
||||||
|
sfRenderImage_DrawThisWithShader = cast(pf_sfRenderImage_DrawThisWithShader)dll.getSymbol("sfRenderImage_Draw" ~ symbol[2..$] ~ "WithShader");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,8 +38,8 @@ import dsfml.graphics.common,
|
|||||||
struct Glyph
|
struct Glyph
|
||||||
{
|
{
|
||||||
int Advance; /// Offset to move horizontically to the next character
|
int Advance; /// Offset to move horizontically to the next character
|
||||||
sfIntRect Rectangle; /// Bounding rectangle of the glyph, in relative coordinates
|
IntRect Rectangle; /// Bounding rectangle of the glyph, in relative coordinates
|
||||||
sfFloatRect TexCoords; /// Texture coordinates of the glyph inside the bitmap font
|
FloatRect TexCoords; /// Texture coordinates of the glyph inside the bitmap font
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -31,6 +31,7 @@ import dsfml.system.vector2;
|
|||||||
import dsfml.graphics.color,
|
import dsfml.graphics.color,
|
||||||
dsfml.graphics.blendmode,
|
dsfml.graphics.blendmode,
|
||||||
dsfml.graphics.renderwindow,
|
dsfml.graphics.renderwindow,
|
||||||
|
dsfml.graphics.renderimage,
|
||||||
dsfml.graphics.shader;
|
dsfml.graphics.shader;
|
||||||
|
|
||||||
|
|
||||||
@ -290,4 +291,21 @@ interface IDrawable
|
|||||||
* shader = Shader to use
|
* shader = Shader to use
|
||||||
*/
|
*/
|
||||||
void renderWithShader(RenderWindow window, Shader shader);
|
void renderWithShader(RenderWindow window, Shader shader);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render the specific geometry of the object
|
||||||
|
*
|
||||||
|
* Params:
|
||||||
|
* image = Target into which render the object
|
||||||
|
*/
|
||||||
|
void render(RenderImage image);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render the specific geometry of the object with a shader
|
||||||
|
*
|
||||||
|
* Params:
|
||||||
|
* image = Render target
|
||||||
|
* shader = Shader to use
|
||||||
|
*/
|
||||||
|
void renderWithShader(RenderImage image, Shader shader);
|
||||||
}
|
}
|
@ -42,6 +42,14 @@ import dsfml.system.common,
|
|||||||
*/
|
*/
|
||||||
class Image : DSFMLObject
|
class Image : DSFMLObject
|
||||||
{
|
{
|
||||||
|
package:
|
||||||
|
this(void* ptr)
|
||||||
|
{
|
||||||
|
super(ptr, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor
|
* Default constructor
|
||||||
*/
|
*/
|
||||||
@ -176,7 +184,7 @@ class Image : DSFMLObject
|
|||||||
// */
|
// */
|
||||||
// void copyScreen(RenderWindow window, IntRect sourceRect = new IntRect())
|
// void copyScreen(RenderWindow window, IntRect sourceRect = new IntRect())
|
||||||
// {
|
// {
|
||||||
// return cast(bool)sfImage_CopyScreen(m_ptr, window.getNativePointer, sourceRect.toCIntRect());
|
// return cast(bool)sfImage_CopyScreen(m_ptr, window.getNativePointer, sourceRect);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -190,9 +198,9 @@ class Image : DSFMLObject
|
|||||||
* destY = Y coordinate of the destination position
|
* destY = Y coordinate of the destination position
|
||||||
* sourceRect = Sub-rectangle of the source image to copy
|
* sourceRect = Sub-rectangle of the source image to copy
|
||||||
*/
|
*/
|
||||||
void copy(Image source, uint destX, uint destY, IntRect sourceRect = new IntRect())
|
void copy(Image source, uint destX, uint destY, IntRect sourceRect = IntRect())
|
||||||
{
|
{
|
||||||
sfImage_Copy(m_ptr, source.getNativePointer, destX, destY, sourceRect.toCIntRect());
|
sfImage_Copy(m_ptr, source.getNativePointer, destX, destY, sourceRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -290,52 +298,30 @@ class Image : DSFMLObject
|
|||||||
return cast(bool)sfImage_IsSmooth(m_ptr);
|
return cast(bool)sfImage_IsSmooth(m_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
package:
|
|
||||||
this(void* ptr)
|
|
||||||
{
|
|
||||||
super(ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
extern (C)
|
extern (C)
|
||||||
{
|
{
|
||||||
typedef void* function() pf_sfImage_Create;
|
static
|
||||||
typedef void* function(uint, uint, Color) pf_sfImage_CreateFromColor;
|
{
|
||||||
typedef void* function(uint, uint, ubyte*) pf_sfImage_CreateFromPixels;
|
void* function() sfImage_Create;
|
||||||
typedef void* function(cchar*) pf_sfImage_CreateFromFile;
|
void* function(uint, uint, Color) sfImage_CreateFromColor;
|
||||||
typedef void* function(ubyte* ,size_t) pf_sfImage_CreateFromMemory;
|
void* function(uint, uint, ubyte*) sfImage_CreateFromPixels;
|
||||||
typedef void function(void*) pf_sfImage_Destroy;
|
void* function(cchar*) sfImage_CreateFromFile;
|
||||||
typedef int function(void*, cchar*) pf_sfImage_SaveToFile;
|
void* function(ubyte* ,size_t) sfImage_CreateFromMemory;
|
||||||
typedef void function(void*, Color, ubyte) pf_sfImage_CreateMaskFromColor;
|
void function(void*) sfImage_Destroy;
|
||||||
typedef int function(void*, void*, sfIntRect) pf_sfImage_CopyScreen;
|
int function(void*, cchar*) sfImage_SaveToFile;
|
||||||
typedef void function(void*, void*, uint, uint, sfIntRect) pf_sfImage_Copy;
|
void function(void*, Color, ubyte) sfImage_CreateMaskFromColor;
|
||||||
typedef void function(void*, uint, uint, Color) pf_sfImage_SetPixel;
|
int function(void*, void*, IntRect) sfImage_CopyScreen;
|
||||||
typedef Color function(void*, uint, uint) pf_sfImage_GetPixel;
|
void function(void*, void*, uint, uint, IntRect) sfImage_Copy;
|
||||||
typedef ubyte* function(void*) pf_sfImage_GetPixelsPtr;
|
void function(void*, uint, uint, Color) sfImage_SetPixel;
|
||||||
typedef void function(void*) pf_sfImage_Bind;
|
Color function(void*, uint, uint) sfImage_GetPixel;
|
||||||
typedef void function(void*, int) pf_sfImage_SetSmooth;
|
ubyte* function(void*) sfImage_GetPixelsPtr;
|
||||||
typedef uint function(void*) pf_sfImage_GetWidth;
|
void function(void*) sfImage_Bind;
|
||||||
typedef uint function(void*) pf_sfImage_GetHeight;
|
void function(void*, int) sfImage_SetSmooth;
|
||||||
typedef int function(void*) pf_sfImage_IsSmooth;
|
uint function(void*) sfImage_GetWidth;
|
||||||
|
uint function(void*) sfImage_GetHeight;
|
||||||
static pf_sfImage_Create sfImage_Create;
|
int function(void*) sfImage_IsSmooth;
|
||||||
static pf_sfImage_CreateFromColor sfImage_CreateFromColor;
|
}
|
||||||
static pf_sfImage_CreateFromPixels sfImage_CreateFromPixels;
|
|
||||||
static pf_sfImage_CreateFromFile sfImage_CreateFromFile;
|
|
||||||
static pf_sfImage_CreateFromMemory sfImage_CreateFromMemory;
|
|
||||||
static pf_sfImage_Destroy sfImage_Destroy;
|
|
||||||
static pf_sfImage_SaveToFile sfImage_SaveToFile;
|
|
||||||
static pf_sfImage_CreateMaskFromColor sfImage_CreateMaskFromColor;
|
|
||||||
static pf_sfImage_CopyScreen sfImage_CopyScreen;
|
|
||||||
static pf_sfImage_Copy sfImage_Copy;
|
|
||||||
static pf_sfImage_SetPixel sfImage_SetPixel;
|
|
||||||
static pf_sfImage_GetPixel sfImage_GetPixel;
|
|
||||||
static pf_sfImage_GetPixelsPtr sfImage_GetPixelsPtr;
|
|
||||||
static pf_sfImage_Bind sfImage_Bind;
|
|
||||||
static pf_sfImage_SetSmooth sfImage_SetSmooth;
|
|
||||||
static pf_sfImage_GetWidth sfImage_GetWidth;
|
|
||||||
static pf_sfImage_GetHeight sfImage_GetHeight;
|
|
||||||
static pf_sfImage_IsSmooth sfImage_IsSmooth;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static this()
|
static this()
|
||||||
@ -345,23 +331,23 @@ private:
|
|||||||
else
|
else
|
||||||
DllLoader dll = DllLoader.load("csfml-graphics");
|
DllLoader dll = DllLoader.load("csfml-graphics");
|
||||||
|
|
||||||
sfImage_Create = cast(pf_sfImage_Create)dll.getSymbol("sfImage_Create");
|
mixin(loadFromSharedLib("sfImage_Create"));
|
||||||
sfImage_CreateFromColor = cast(pf_sfImage_CreateFromColor)dll.getSymbol("sfImage_CreateFromColor");
|
mixin(loadFromSharedLib("sfImage_CreateFromColor"));
|
||||||
sfImage_CreateFromPixels = cast(pf_sfImage_CreateFromPixels)dll.getSymbol("sfImage_CreateFromPixels");
|
mixin(loadFromSharedLib("sfImage_CreateFromPixels"));
|
||||||
sfImage_CreateFromFile = cast(pf_sfImage_CreateFromFile)dll.getSymbol("sfImage_CreateFromFile");
|
mixin(loadFromSharedLib("sfImage_CreateFromFile"));
|
||||||
sfImage_CreateFromMemory = cast(pf_sfImage_CreateFromMemory)dll.getSymbol("sfImage_CreateFromMemory");
|
mixin(loadFromSharedLib("sfImage_CreateFromMemory"));
|
||||||
sfImage_Destroy = cast(pf_sfImage_Destroy)dll.getSymbol("sfImage_Destroy");
|
mixin(loadFromSharedLib("sfImage_Destroy"));
|
||||||
sfImage_SaveToFile = cast(pf_sfImage_SaveToFile)dll.getSymbol("sfImage_SaveToFile");
|
mixin(loadFromSharedLib("sfImage_SaveToFile"));
|
||||||
sfImage_CreateMaskFromColor = cast(pf_sfImage_CreateMaskFromColor)dll.getSymbol("sfImage_CreateMaskFromColor");
|
mixin(loadFromSharedLib("sfImage_CreateMaskFromColor"));
|
||||||
sfImage_CopyScreen = cast(pf_sfImage_CopyScreen)dll.getSymbol("sfImage_CopyScreen");
|
mixin(loadFromSharedLib("sfImage_CopyScreen"));
|
||||||
sfImage_Copy = cast(pf_sfImage_Copy)dll.getSymbol("sfImage_Copy");
|
mixin(loadFromSharedLib("sfImage_Copy"));
|
||||||
sfImage_SetPixel = cast(pf_sfImage_SetPixel)dll.getSymbol("sfImage_SetPixel");
|
mixin(loadFromSharedLib("sfImage_SetPixel"));
|
||||||
sfImage_GetPixel = cast(pf_sfImage_GetPixel)dll.getSymbol("sfImage_GetPixel");
|
mixin(loadFromSharedLib("sfImage_GetPixel"));
|
||||||
sfImage_GetPixelsPtr = cast(pf_sfImage_GetPixelsPtr)dll.getSymbol("sfImage_GetPixelsPtr");
|
mixin(loadFromSharedLib("sfImage_GetPixelsPtr"));
|
||||||
sfImage_Bind = cast(pf_sfImage_Bind)dll.getSymbol("sfImage_Bind");
|
mixin(loadFromSharedLib("sfImage_Bind"));
|
||||||
sfImage_SetSmooth = cast(pf_sfImage_SetSmooth)dll.getSymbol("sfImage_SetSmooth");
|
mixin(loadFromSharedLib("sfImage_SetSmooth"));
|
||||||
sfImage_GetWidth = cast(pf_sfImage_GetWidth)dll.getSymbol("sfImage_GetWidth");
|
mixin(loadFromSharedLib("sfImage_GetWidth"));
|
||||||
sfImage_GetHeight = cast(pf_sfImage_GetHeight)dll.getSymbol("sfImage_GetHeight");
|
mixin(loadFromSharedLib("sfImage_GetHeight"));
|
||||||
sfImage_IsSmooth = cast(pf_sfImage_IsSmooth)dll.getSymbol("sfImage_IsSmooth");
|
mixin(loadFromSharedLib("sfImage_IsSmooth"));
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -26,22 +26,6 @@
|
|||||||
|
|
||||||
module dsfml.graphics.rect;
|
module dsfml.graphics.rect;
|
||||||
|
|
||||||
struct sfFloatRect
|
|
||||||
{
|
|
||||||
float Left;
|
|
||||||
float Top;
|
|
||||||
float Right;
|
|
||||||
float Bottom;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct sfIntRect
|
|
||||||
{
|
|
||||||
int Left;
|
|
||||||
int Top;
|
|
||||||
int Right;
|
|
||||||
int Bottom;
|
|
||||||
}
|
|
||||||
|
|
||||||
version (Tango)
|
version (Tango)
|
||||||
{
|
{
|
||||||
import tango.core.Traits;
|
import tango.core.Traits;
|
||||||
@ -65,19 +49,19 @@ else
|
|||||||
is (T == real);
|
is (T == real);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rect is an utility class for manipulating rectangles.
|
* Rect is an utility class for manipulating rectangles.
|
||||||
* Template parameter defines the type of coordinates (integer float, ...)
|
* Template parameter defines the type of coordinates (integer float, ...)
|
||||||
*/
|
*/
|
||||||
|
struct Rect(T)
|
||||||
class Rect (T)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
private:
|
private:
|
||||||
T m_Left; // Left coordinate of the rectangle
|
T left; // Left coordinate of the rectangle
|
||||||
T m_Top; // Top coordinate of the rectangle
|
T top; // Top coordinate of the rectangle
|
||||||
T m_Right; // Right coordinate of the rectangle
|
T right; // Right coordinate of the rectangle
|
||||||
T m_Bottom; // Bottom coordinate of the rectangle
|
T bottom; // Bottom coordinate of the rectangle
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static if (!isIntegerType!(T) && !isRealType!(T))
|
static if (!isIntegerType!(T) && !isRealType!(T))
|
||||||
@ -95,17 +79,7 @@ public:
|
|||||||
return i > j ? i : j;
|
return i > j ? i : j;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/+
|
||||||
* Default constructor
|
|
||||||
*/
|
|
||||||
this()
|
|
||||||
{
|
|
||||||
m_Left = 0;
|
|
||||||
m_Top = 0;
|
|
||||||
m_Right = 0;
|
|
||||||
m_Bottom = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct the rectangle from its coordinates
|
* Construct the rectangle from its coordinates
|
||||||
*
|
*
|
||||||
@ -117,11 +91,12 @@ public:
|
|||||||
*/
|
*/
|
||||||
this(T leftCoord, T topCoord, T rightCoord, T bottomCoord)
|
this(T leftCoord, T topCoord, T rightCoord, T bottomCoord)
|
||||||
{
|
{
|
||||||
m_Left = leftCoord;
|
left = leftCoord;
|
||||||
m_Top = topCoord;
|
top = topCoord;
|
||||||
m_Right = rightCoord;
|
right = rightCoord;
|
||||||
m_Bottom = bottomCoord;
|
bottom = bottomCoord;
|
||||||
}
|
}
|
||||||
|
+/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the width of the rectangle
|
* Get the width of the rectangle
|
||||||
@ -131,7 +106,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
T getWidth()
|
T getWidth()
|
||||||
{
|
{
|
||||||
return m_Right - m_Left;
|
return right - left;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -142,7 +117,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
T getHeight()
|
T getHeight()
|
||||||
{
|
{
|
||||||
return m_Bottom - m_Top;
|
return bottom - top;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -154,10 +129,10 @@ public:
|
|||||||
*/
|
*/
|
||||||
void offset(T offsetX, T offsetY)
|
void offset(T offsetX, T offsetY)
|
||||||
{
|
{
|
||||||
m_Left += offsetX;
|
left += offsetX;
|
||||||
m_Right += offsetX;
|
right += offsetX;
|
||||||
m_Top += offsetY;
|
top += offsetY;
|
||||||
m_Bottom += offsetY;
|
bottom += offsetY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -172,7 +147,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool contains(T x, T y)
|
bool contains(T x, T y)
|
||||||
{
|
{
|
||||||
return (x >= m_Left) && (x <= m_Right) && (y >= m_Top) && (y <= m_Bottom);
|
return (x >= left) && (x <= right) && (y >= top) && (y <= bottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -185,103 +160,30 @@ public:
|
|||||||
* Returns:
|
* Returns:
|
||||||
* True if rectangles overlap
|
* True if rectangles overlap
|
||||||
*/
|
*/
|
||||||
bool intersects(Rect!(T) rectangle, out Rect!(T) overlappingRect = null)
|
bool intersects(Rect!(T) rectangle, out Rect!(T) overlappingRect = Rect!(T)())
|
||||||
{
|
{
|
||||||
// Compute overlapping rect
|
// Compute overlapping rect
|
||||||
Rect!(T) overlapping = new Rect!(T)(
|
auto overlapping = Rect!(T)(
|
||||||
max(m_Left, rectangle.getLeft),
|
max(left, rectangle.left),
|
||||||
max(m_Top, rectangle.getTop),
|
max(top, rectangle.top),
|
||||||
min(m_Right, rectangle.getRight),
|
min(right, rectangle.right),
|
||||||
min(m_Bottom, rectangle.getBottom)
|
min(bottom, rectangle.bottom)
|
||||||
);
|
);
|
||||||
|
|
||||||
// If overlapping rect is valid, then there is intersection
|
// If overlapping rect is valid, then there is intersection
|
||||||
if ((overlapping.getLeft() < overlapping.getRight() ) && (overlapping.getTop() < overlapping.getBottom()))
|
if ((overlapping.left < overlapping.right) && (overlapping.top < overlapping.bottom))
|
||||||
{
|
{
|
||||||
overlappingRect = overlapping;
|
overlappingRect = overlapping;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
overlappingRect = new Rect!(T)();
|
overlappingRect = Rect!(T)();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
//bool opEquals
|
||||||
* Set left Coordinate
|
|
||||||
*/
|
|
||||||
void setLeft(T left)
|
|
||||||
{
|
|
||||||
m_Left = left;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set top Coordinate
|
|
||||||
*/
|
|
||||||
void setTop(T top)
|
|
||||||
{
|
|
||||||
m_Top = top;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set right Coordinate
|
|
||||||
*/
|
|
||||||
void setRight(T right)
|
|
||||||
{
|
|
||||||
m_Right = right;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set bottom Coordinate
|
|
||||||
*/
|
|
||||||
void setBottom(T bottom)
|
|
||||||
{
|
|
||||||
m_Bottom = bottom;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get left Coordinate
|
|
||||||
*/
|
|
||||||
T getLeft()
|
|
||||||
{
|
|
||||||
return m_Left;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get top Coordinate
|
|
||||||
*/
|
|
||||||
T getTop()
|
|
||||||
{
|
|
||||||
return m_Top;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get right Coordinate
|
|
||||||
*/
|
|
||||||
T getRight()
|
|
||||||
{
|
|
||||||
return m_Right;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get bottom Coordinate
|
|
||||||
*/
|
|
||||||
T getBottom()
|
|
||||||
{
|
|
||||||
return m_Bottom;
|
|
||||||
}
|
|
||||||
|
|
||||||
package:
|
|
||||||
sfFloatRect toCFloatRect()
|
|
||||||
{
|
|
||||||
return sfFloatRect(m_Left, m_Top, m_Right, m_Bottom);
|
|
||||||
}
|
|
||||||
|
|
||||||
sfIntRect toCIntRect()
|
|
||||||
{
|
|
||||||
return sfIntRect(cast(int)m_Left, cast(int)m_Top, cast(int)m_Right, cast(int)m_Bottom);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///Alias
|
///Alias
|
||||||
|
336
DSFML/import/dsfml/graphics/renderimage.d
Normal file
336
DSFML/import/dsfml/graphics/renderimage.d
Normal file
@ -0,0 +1,336 @@
|
|||||||
|
/*
|
||||||
|
* DSFML - SFML Library wrapper for the D programming language.
|
||||||
|
* 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.graphics.renderimage;
|
||||||
|
|
||||||
|
import dsfml.system.common,
|
||||||
|
dsfml.system.exception,
|
||||||
|
dsfml.system.stringutil,
|
||||||
|
dsfml.system.vector2;
|
||||||
|
|
||||||
|
import dsfml.graphics.common,
|
||||||
|
dsfml.graphics.idrawable,
|
||||||
|
dsfml.graphics.image,
|
||||||
|
dsfml.graphics.color,
|
||||||
|
dsfml.graphics.rect,
|
||||||
|
dsfml.graphics.shader,
|
||||||
|
dsfml.graphics.view;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Target for 2D rendering into an image that can be reused in a sprite
|
||||||
|
*/
|
||||||
|
class RenderImage : DSFMLObject
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
Image _image = null;
|
||||||
|
View _view = null;
|
||||||
|
View _defaultView = null;
|
||||||
|
|
||||||
|
package:
|
||||||
|
this(void* ptr)
|
||||||
|
{
|
||||||
|
super(ptr, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct a new renderimage
|
||||||
|
*
|
||||||
|
* Params:
|
||||||
|
* width = Width of the renderimage
|
||||||
|
* height = Height of the renderimage
|
||||||
|
* depthBuffer = Do you want a depth-buffer attached? (useful only if you're doing 3D OpenGL on the renderimage)
|
||||||
|
*/
|
||||||
|
this(uint width, uint height, bool depthBuffer = false)
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make sure that what has been drawn so far is rendered
|
||||||
|
*
|
||||||
|
* Use this function if you use OpenGL rendering commands, and you want to make sure that things will appear on top
|
||||||
|
* of all the SFML objects that have been drawn so far. This is needed because SFML doesn't use immediate rendering,
|
||||||
|
* it first accumulates drawables into a queue and trigger the actual rendering afterwards.
|
||||||
|
*
|
||||||
|
* You don't need to call this function if you're not dealing with OpenGL directly.
|
||||||
|
*/
|
||||||
|
void flush()
|
||||||
|
{
|
||||||
|
sfRenderImage_Flush(m_ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the contents of the target image
|
||||||
|
*/
|
||||||
|
void display()
|
||||||
|
{
|
||||||
|
sfRenderImage_Display(m_ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw something on a renderimage
|
||||||
|
*
|
||||||
|
* Params:
|
||||||
|
* drawable = object to draw
|
||||||
|
*/
|
||||||
|
void draw(IDrawable drawable)
|
||||||
|
{
|
||||||
|
drawable.render(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Params:
|
||||||
|
* drawable = Object to draw
|
||||||
|
* shader = Shader to use
|
||||||
|
*/
|
||||||
|
void drawWithShader(IDrawable drawable, Shader shader)
|
||||||
|
{
|
||||||
|
drawable.renderWithShader(this, shader);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear the renderimage with the given color
|
||||||
|
*
|
||||||
|
* Params:
|
||||||
|
* color = Fill color
|
||||||
|
*/
|
||||||
|
void clear(Color color)
|
||||||
|
{
|
||||||
|
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.getNativePointer);
|
||||||
|
|
||||||
|
_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() // TODO: is there a need to accept other Views than the currently assigned one?
|
||||||
|
{
|
||||||
|
return sfRenderImage_GetViewport(m_ptr, _view.getNativePointer);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert a point in image coordinates into view coordinates
|
||||||
|
*
|
||||||
|
* Params:
|
||||||
|
* imageX = X coordinate of the point to convert, relative to the image
|
||||||
|
* imageY = Y coordinate of the point to convert, relative to the image
|
||||||
|
* targetView = Target view to convert the point to (pass NULL to use the current view)
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* Converted point
|
||||||
|
*/
|
||||||
|
Vector2f convertCoords(uint imageX, uint imageY, View targetView = null)
|
||||||
|
{
|
||||||
|
Vector2f vec;
|
||||||
|
sfRenderImage_ConvertCoords(m_ptr, imageX, imageY, &vec.x, &vec.y, targetView is null ? null : targetView.getNativePointer);
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
extern (C)
|
||||||
|
{
|
||||||
|
static
|
||||||
|
{
|
||||||
|
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_Flush;
|
||||||
|
void function(void*) sfRenderImage_Display;
|
||||||
|
|
||||||
|
void function(void*, void*) sfRenderImage_DrawSprite;
|
||||||
|
void function(void*, void*) sfRenderImage_DrawShape;
|
||||||
|
void function(void*, 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(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;
|
||||||
|
bool function() sfRenderImage_IsAvailable;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static this()
|
||||||
|
{
|
||||||
|
debug
|
||||||
|
DllLoader dll = DllLoader.load("csfml-graphics-d");
|
||||||
|
else
|
||||||
|
DllLoader dll = DllLoader.load("csfml-graphics");
|
||||||
|
|
||||||
|
mixin(loadFromSharedLib("sfRenderImage_Create"));
|
||||||
|
mixin(loadFromSharedLib("sfRenderImage_Destroy"));
|
||||||
|
mixin(loadFromSharedLib("sfRenderImage_GetWidth"));
|
||||||
|
mixin(loadFromSharedLib("sfRenderImage_GetHeight"));
|
||||||
|
mixin(loadFromSharedLib("sfRenderImage_SetActive"));
|
||||||
|
mixin(loadFromSharedLib("sfRenderImage_Flush"));
|
||||||
|
mixin(loadFromSharedLib("sfRenderImage_Display"));
|
||||||
|
/*
|
||||||
|
mixin(loadFromSharedLib("sfRenderImage_DrawSprite"));
|
||||||
|
mixin(loadFromSharedLib("sfRenderImage_DrawShape"));
|
||||||
|
mixin(loadFromSharedLib("sfRenderImage_DrawText"));
|
||||||
|
|
||||||
|
mixin(loadFromSharedLib("sfRenderImage_DrawSpriteWithShader"));
|
||||||
|
mixin(loadFromSharedLib("sfRenderImage_DrawShapeWithShader"));
|
||||||
|
mixin(loadFromSharedLib("sfRenderImage_DrawTextWithShader"));
|
||||||
|
*/
|
||||||
|
|
||||||
|
mixin(loadFromSharedLib("sfRenderImage_Clear"));
|
||||||
|
mixin(loadFromSharedLib("sfRenderImage_SetView"));
|
||||||
|
mixin(loadFromSharedLib("sfRenderImage_GetView"));
|
||||||
|
mixin(loadFromSharedLib("sfRenderImage_GetDefaultView"));
|
||||||
|
mixin(loadFromSharedLib("sfRenderImage_GetViewport"));
|
||||||
|
mixin(loadFromSharedLib("sfRenderImage_ConvertCoords"));
|
||||||
|
mixin(loadFromSharedLib("sfRenderImage_GetImage"));
|
||||||
|
mixin(loadFromSharedLib("sfRenderImage_IsAvailable"));
|
||||||
|
}
|
||||||
|
}
|
@ -234,4 +234,17 @@ public:
|
|||||||
sfRenderWindow_ConvertCoords(m_ptr, windowX, windowY, &vec.x, &vec.y, targetView is null ? null : targetView.getNativePointer);
|
sfRenderWindow_ConvertCoords(m_ptr, windowX, windowY, &vec.x, &vec.y, targetView is null ? null : targetView.getNativePointer);
|
||||||
return vec;
|
return vec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make sure that what has been drawn so far is rendered
|
||||||
|
* Use this function if you use OpenGL rendering commands, and you want to make sure that things will appear on top
|
||||||
|
* of all the SFML objects that have been drawn so far. This is needed because SFML doesn't use immediate rendering,
|
||||||
|
* it first accumulates drawables into a queue and trigger the actual rendering afterwards.
|
||||||
|
*
|
||||||
|
* You don't need to call this function if you're not dealing with OpenGL directly.
|
||||||
|
*/
|
||||||
|
void flush()
|
||||||
|
{
|
||||||
|
sfRenderWindow_Flush(m_ptr);
|
||||||
|
}
|
||||||
}
|
}
|
@ -42,11 +42,18 @@ import dsfml.system.vector2;
|
|||||||
*/
|
*/
|
||||||
class Sprite : Drawableimpl!(sfSprite)
|
class Sprite : Drawableimpl!(sfSprite)
|
||||||
{
|
{
|
||||||
|
private:
|
||||||
|
Image m_image; //< Image used to draw the sprite
|
||||||
|
IntRect m_subRect; //< Sub-rectangle of source image to assign to the sprite
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor
|
* Default constructor
|
||||||
*/
|
*/
|
||||||
this()
|
this()
|
||||||
{
|
{
|
||||||
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -63,6 +70,7 @@ class Sprite : Drawableimpl!(sfSprite)
|
|||||||
*/
|
*/
|
||||||
this(Image img, float left = 0.f, float top = 0.f, float scaleX = 1.f, float scaleY = 1.f, float rotation = 0.f, Color col = Color.WHITE)
|
this(Image img, float left = 0.f, float top = 0.f, float scaleX = 1.f, float scaleY = 1.f, float rotation = 0.f, Color col = Color.WHITE)
|
||||||
{
|
{
|
||||||
|
super();
|
||||||
m_image = img;
|
m_image = img;
|
||||||
sfSprite_SetImage(m_ptr, img.getNativePointer);
|
sfSprite_SetImage(m_ptr, img.getNativePointer);
|
||||||
setX(left);
|
setX(left);
|
||||||
@ -94,7 +102,7 @@ class Sprite : Drawableimpl!(sfSprite)
|
|||||||
*/
|
*/
|
||||||
void setSubRect(IntRect rect)
|
void setSubRect(IntRect rect)
|
||||||
{
|
{
|
||||||
sfIntRect r = rect.toCIntRect();
|
IntRect r = rect;
|
||||||
sfSprite_SetSubRect(m_ptr, &r);
|
sfSprite_SetSubRect(m_ptr, &r);
|
||||||
m_subRect = rect;
|
m_subRect = rect;
|
||||||
}
|
}
|
||||||
@ -168,8 +176,8 @@ class Sprite : Drawableimpl!(sfSprite)
|
|||||||
*/
|
*/
|
||||||
IntRect getSubRect()
|
IntRect getSubRect()
|
||||||
{
|
{
|
||||||
if (m_subRect is null)
|
if (m_subRect == IntRect())
|
||||||
m_subRect = new IntRect(0, 0, m_image.getWidth(), m_image.getHeight());
|
m_subRect = IntRect(0, 0, m_image.getWidth(), m_image.getHeight());
|
||||||
|
|
||||||
return m_subRect;
|
return m_subRect;
|
||||||
}
|
}
|
||||||
@ -201,13 +209,11 @@ class Sprite : Drawableimpl!(sfSprite)
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Image m_image; //< Image used to draw the sprite
|
|
||||||
IntRect m_subRect; //< Sub-rectangle of source image to assign to the sprite
|
|
||||||
|
|
||||||
extern (C)
|
extern (C)
|
||||||
{
|
{
|
||||||
typedef void function(void*, void*) pf_sfSprite_SetImage;
|
typedef void function(void*, void*) pf_sfSprite_SetImage;
|
||||||
typedef void function(void*, sfIntRect*) pf_sfSprite_SetSubRect;
|
typedef void function(void*, IntRect*) pf_sfSprite_SetSubRect;
|
||||||
typedef void function(void*, float, float) pf_sfSprite_Resize;
|
typedef void function(void*, float, float) pf_sfSprite_Resize;
|
||||||
typedef void function(void*, int) pf_sfSprite_FlipX;
|
typedef void function(void*, int) pf_sfSprite_FlipX;
|
||||||
typedef void function(void*, int) pf_sfSprite_FlipY;
|
typedef void function(void*, int) pf_sfSprite_FlipY;
|
||||||
@ -247,6 +253,4 @@ private:
|
|||||||
sfSprite_GetHeight = cast(pf_sfSprite_GetHeight)dll.getSymbol("sfSprite_GetHeight");
|
sfSprite_GetHeight = cast(pf_sfSprite_GetHeight)dll.getSymbol("sfSprite_GetHeight");
|
||||||
sfSprite_GetPixel = cast(pf_sfSprite_GetPixel)dll.getSymbol("sfSprite_GetPixel");
|
sfSprite_GetPixel = cast(pf_sfSprite_GetPixel)dll.getSymbol("sfSprite_GetPixel");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,6 +37,17 @@ import dsfml.system.stringutil;
|
|||||||
import dsfml.system.vector2;
|
import dsfml.system.vector2;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enumerate the text drawing styles
|
||||||
|
*/
|
||||||
|
enum TextStyle
|
||||||
|
{
|
||||||
|
REGULAR = 0, /// Regular characters, no style
|
||||||
|
BOLD = 1 << 0, /// Characters are bold
|
||||||
|
ITALIC = 1 << 1, /// Characters are in italic
|
||||||
|
UNDERLINED = 1 << 2 /// Characters are underlined
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Text defines a graphical 2D text, that can be drawn on screen
|
* Text defines a graphical 2D text, that can be drawn on screen
|
||||||
*
|
*
|
||||||
@ -56,6 +67,10 @@ import dsfml.system.vector2;
|
|||||||
*/
|
*/
|
||||||
class Text : Drawableimpl!(sfText)
|
class Text : Drawableimpl!(sfText)
|
||||||
{
|
{
|
||||||
|
private:
|
||||||
|
Font m_font;
|
||||||
|
|
||||||
|
public:
|
||||||
/**
|
/**
|
||||||
* Construct the string from a text
|
* Construct the string from a text
|
||||||
*
|
*
|
||||||
@ -99,7 +114,6 @@ class Text : Drawableimpl!(sfText)
|
|||||||
*
|
*
|
||||||
* Params:
|
* Params:
|
||||||
* text = New text
|
* text = New text
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
void setString(string text)
|
void setString(string text)
|
||||||
{
|
{
|
||||||
@ -234,13 +248,10 @@ class Text : Drawableimpl!(sfText)
|
|||||||
*/
|
*/
|
||||||
FloatRect getRect()
|
FloatRect getRect()
|
||||||
{
|
{
|
||||||
sfFloatRect sfRect = sfText_GetRect(m_ptr);
|
return sfText_GetRect(m_ptr);
|
||||||
|
|
||||||
return new Rect!(float)(sfRect.Left, sfRect.Top, sfRect.Right, sfRect.Bottom);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Font m_font;
|
|
||||||
|
|
||||||
extern (C)
|
extern (C)
|
||||||
{
|
{
|
||||||
@ -255,7 +266,7 @@ private:
|
|||||||
typedef uint function(void*) pf_sfText_GetCharacterSize;
|
typedef uint function(void*) pf_sfText_GetCharacterSize;
|
||||||
typedef TextStyle function (void*) pf_sfText_GetStyle;
|
typedef TextStyle function (void*) pf_sfText_GetStyle;
|
||||||
typedef void function(void*, size_t, float*, float*) pf_sfText_GetCharacterPos;
|
typedef void function(void*, size_t, float*, float*) pf_sfText_GetCharacterPos;
|
||||||
typedef sfFloatRect function(void*) pf_sfText_GetRect;
|
typedef FloatRect function(void*) pf_sfText_GetRect;
|
||||||
|
|
||||||
static pf_sfText_SetString sfText_SetString;
|
static pf_sfText_SetString sfText_SetString;
|
||||||
static pf_sfText_SetUnicodeString sfText_SetUnicodeString;
|
static pf_sfText_SetUnicodeString sfText_SetUnicodeString;
|
||||||
|
@ -1,38 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.graphics.textstyle;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enumerate the string drawing styles
|
|
||||||
*/
|
|
||||||
enum TextStyle
|
|
||||||
{
|
|
||||||
REGULAR = 0, /// Regular characters, no style
|
|
||||||
BOLD = 1 << 0, /// Characters are bold
|
|
||||||
ITALIC = 1 << 1, /// Characters are in italic
|
|
||||||
UNDERLINED = 1 << 2 /// Characters are underlined
|
|
||||||
}
|
|
@ -39,7 +39,8 @@ import dsfml.system.common,
|
|||||||
class View : DSFMLObject
|
class View : DSFMLObject
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
FloatRect m_viewport;
|
FloatRect _rect; // a view defines a source area of the scene to display, and a destination area into the rendertarget where to map the source area
|
||||||
|
FloatRect _viewport; // the viewport is the destination area in the rendertarget
|
||||||
bool m_isModified = true;
|
bool m_isModified = true;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -62,7 +63,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
this(Vector2f center, Vector2f size)
|
this(Vector2f center, Vector2f size)
|
||||||
{
|
{
|
||||||
super(sfView_CreateFromRect(sfFloatRect(center.x - size.x / 2, center.y - size.y / 2, center.x + size.x / 2, center.y + size.y / 2) ));
|
super(sfView_CreateFromRect(FloatRect(center.x - size.x / 2, center.y - size.y / 2, center.x + size.x / 2, center.y + size.y / 2) ));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -73,7 +74,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
this(FloatRect rect)
|
this(FloatRect rect)
|
||||||
{
|
{
|
||||||
super(sfView_CreateFromRect(rect.toCFloatRect()));
|
super(sfView_CreateFromRect(rect));
|
||||||
}
|
}
|
||||||
|
|
||||||
override void dispose()
|
override void dispose()
|
||||||
@ -139,8 +140,8 @@ public:
|
|||||||
*/
|
*/
|
||||||
void setViewport(FloatRect viewport)
|
void setViewport(FloatRect viewport)
|
||||||
{
|
{
|
||||||
sfView_SetViewport(m_ptr, viewport.toCFloatRect());
|
sfView_SetViewport(m_ptr, viewport);
|
||||||
m_viewport = viewport;
|
_viewport = viewport;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -195,10 +196,9 @@ public:
|
|||||||
if (m_isModified)
|
if (m_isModified)
|
||||||
{
|
{
|
||||||
m_isModified = false;
|
m_isModified = false;
|
||||||
sfFloatRect cViewport = sfView_GetViewport(m_ptr);
|
_viewport = sfView_GetViewport(m_ptr);
|
||||||
m_viewport = new FloatRect(cViewport.Left, cViewport.Top, cViewport.Right, cViewport.Bottom);
|
|
||||||
}
|
}
|
||||||
return m_viewport;
|
return _viewport;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -272,6 +272,11 @@ public:
|
|||||||
return sfView_GetRotation(m_ptr);
|
return sfView_GetRotation(m_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void reset(FloatRect rect)
|
||||||
|
{
|
||||||
|
sfView_Reset(m_ptr, rect);
|
||||||
|
_rect = rect;
|
||||||
|
}
|
||||||
package:
|
package:
|
||||||
|
|
||||||
this(void* ptr, bool preventDelete)
|
this(void* ptr, bool preventDelete)
|
||||||
|
@ -62,6 +62,7 @@ public:
|
|||||||
this(void* ptr, bool preventDelete = false)
|
this(void* ptr, bool preventDelete = false)
|
||||||
{
|
{
|
||||||
m_ptr = ptr;
|
m_ptr = ptr;
|
||||||
|
m_preventDelete = preventDelete;
|
||||||
}
|
}
|
||||||
|
|
||||||
~this()
|
~this()
|
||||||
|
@ -67,6 +67,15 @@ struct ContextSettings
|
|||||||
*/
|
*/
|
||||||
class Window : DSFMLObject
|
class Window : DSFMLObject
|
||||||
{
|
{
|
||||||
|
protected:
|
||||||
|
this(void* ptr)
|
||||||
|
{
|
||||||
|
super(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
Input m_input;
|
||||||
|
|
||||||
|
public:
|
||||||
/**
|
/**
|
||||||
* Construct a new window
|
* Construct a new window
|
||||||
*
|
*
|
||||||
@ -197,7 +206,7 @@ class Window : DSFMLObject
|
|||||||
* Returns:
|
* Returns:
|
||||||
* True if an event was returned, false if events stack was empty
|
* True if an event was returned, false if events stack was empty
|
||||||
*/
|
*/
|
||||||
bool getEvent(ref Event eventReceived)
|
bool getEvent(out Event eventReceived)
|
||||||
{
|
{
|
||||||
return cast(bool) sfWindow_GetEvent(m_ptr, &eventReceived);
|
return cast(bool) sfWindow_GetEvent(m_ptr, &eventReceived);
|
||||||
}
|
}
|
||||||
@ -369,65 +378,59 @@ class Window : DSFMLObject
|
|||||||
sfWindow_SetJoystickThreshold(m_ptr, threshold);
|
sfWindow_SetJoystickThreshold(m_ptr, threshold);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
/**
|
||||||
this(void* ptr)
|
* 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)
|
||||||
{
|
{
|
||||||
super(ptr);
|
return sfWindow_WaitEvent(m_ptr, &e);
|
||||||
}
|
}
|
||||||
|
|
||||||
Input m_input;
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// External ====================================================================
|
// External ====================================================================
|
||||||
extern (C)
|
extern (C)
|
||||||
{
|
{
|
||||||
typedef void* function(VideoMode, cchar*, uint, ContextSettings) pf_sfWindow_Create;
|
static
|
||||||
typedef void* function(WindowHandle, ContextSettings) pf_sfWindow_CreateFromHandle;
|
{
|
||||||
typedef void function(void*) pf_sfWindow_Destroy;
|
void* function(VideoMode, cchar*, uint, ContextSettings) sfWindow_Create;
|
||||||
typedef void function(void*) pf_sfWindow_Close;
|
void* function(WindowHandle, ContextSettings) sfWindow_CreateFromHandle;
|
||||||
typedef int function(void*) pf_sfWindow_IsOpened;
|
void function(void*) sfWindow_Destroy;
|
||||||
typedef uint function(void*) pf_sfWindow_GetWidth;
|
void function(void*) sfWindow_Close;
|
||||||
typedef uint function(void*) pf_sfWindow_GetHeight;
|
int function(void*) sfWindow_IsOpened;
|
||||||
typedef ContextSettings function(void* Window) pf_sfWindow_GetSettings;
|
uint function(void*) sfWindow_GetWidth;
|
||||||
typedef int function(void*, Event*) pf_sfWindow_GetEvent;
|
uint function(void*) sfWindow_GetHeight;
|
||||||
typedef void function(void*, int) pf_sfWindow_UseVerticalSync;
|
ContextSettings function(void* Window) sfWindow_GetSettings;
|
||||||
typedef void function(void*, int) pf_sfWindow_ShowMouseCursor;
|
int function(void*, Event*) sfWindow_GetEvent;
|
||||||
typedef void function(void*, uint, uint) pf_sfWindow_SetCursorPosition;
|
void function(void*, int) sfWindow_UseVerticalSync;
|
||||||
typedef void function(void*, int, int) pf_sfWindow_SetPosition;
|
void function(void*, int) sfWindow_ShowMouseCursor;
|
||||||
typedef void function(void*, uint, uint) pf_sfWindow_SetSize;
|
void function(void*, uint, uint) sfWindow_SetCursorPosition;
|
||||||
typedef void function(void*, int) pf_sfWindow_Show;
|
void function(void*, int, int) sfWindow_SetPosition;
|
||||||
typedef void function(void*, int) pf_sfWindow_EnableKeyRepeat;
|
void function(void*, uint, uint) sfWindow_SetSize;
|
||||||
typedef void function(void*, size_t, size_t, ubyte*) pf_sfWindow_SetIcon;
|
void function(void*, int) sfWindow_Show;
|
||||||
typedef int function(void*, int) pf_sfWindow_SetActive;
|
void function(void*, int) sfWindow_EnableKeyRepeat;
|
||||||
typedef void function(void*) pf_sfWindow_Display;
|
void function(void*, size_t, size_t, ubyte*) sfWindow_SetIcon;
|
||||||
typedef void* function(void*) pf_sfWindow_GetInput;
|
int function(void*, int) sfWindow_SetActive;
|
||||||
typedef void function(void*, uint) pf_sfWindow_SetFramerateLimit;
|
void function(void*) sfWindow_Display;
|
||||||
typedef float function(void*) pf_sfWindow_GetFrameTime;
|
void* function(void*) sfWindow_GetInput;
|
||||||
typedef void function(void*, float) pf_sfWindow_SetJoystickThreshold;
|
void function(void*, uint) sfWindow_SetFramerateLimit;
|
||||||
|
float function(void*) sfWindow_GetFrameTime;
|
||||||
|
void function(void*, float) sfWindow_SetJoystickThreshold;
|
||||||
|
|
||||||
static pf_sfWindow_Create sfWindow_Create;
|
// DSFML2
|
||||||
static pf_sfWindow_CreateFromHandle sfWindow_CreateFromHandle;
|
bool function(void*, void*) sfWindow_WaitEvent;
|
||||||
static pf_sfWindow_Destroy sfWindow_Destroy;
|
}
|
||||||
static pf_sfWindow_Close sfWindow_Close;
|
|
||||||
static pf_sfWindow_IsOpened sfWindow_IsOpened;
|
|
||||||
static pf_sfWindow_GetWidth sfWindow_GetWidth;
|
|
||||||
static pf_sfWindow_GetHeight sfWindow_GetHeight;
|
|
||||||
static pf_sfWindow_GetSettings sfWindow_GetSettings;
|
|
||||||
static pf_sfWindow_GetEvent sfWindow_GetEvent;
|
|
||||||
static pf_sfWindow_UseVerticalSync sfWindow_UseVerticalSync;
|
|
||||||
static pf_sfWindow_ShowMouseCursor sfWindow_ShowMouseCursor;
|
|
||||||
static pf_sfWindow_SetCursorPosition sfWindow_SetCursorPosition;
|
|
||||||
static pf_sfWindow_SetPosition sfWindow_SetPosition;
|
|
||||||
static pf_sfWindow_SetSize sfWindow_SetSize;
|
|
||||||
static pf_sfWindow_Show sfWindow_Show;
|
|
||||||
static pf_sfWindow_EnableKeyRepeat sfWindow_EnableKeyRepeat;
|
|
||||||
static pf_sfWindow_SetIcon sfWindow_SetIcon;
|
|
||||||
static pf_sfWindow_SetActive sfWindow_SetActive;
|
|
||||||
static pf_sfWindow_Display sfWindow_Display;
|
|
||||||
static pf_sfWindow_GetInput sfWindow_GetInput;
|
|
||||||
static pf_sfWindow_SetFramerateLimit sfWindow_SetFramerateLimit;
|
|
||||||
static pf_sfWindow_GetFrameTime sfWindow_GetFrameTime;
|
|
||||||
static pf_sfWindow_SetJoystickThreshold sfWindow_SetJoystickThreshold;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static this()
|
static this()
|
||||||
@ -437,28 +440,29 @@ private:
|
|||||||
else
|
else
|
||||||
DllLoader dll = DllLoader.load("csfml-window");
|
DllLoader dll = DllLoader.load("csfml-window");
|
||||||
|
|
||||||
sfWindow_Create = cast(pf_sfWindow_Create)dll.getSymbol("sfWindow_Create");
|
mixin(loadFromSharedLib("sfWindow_Create"));
|
||||||
sfWindow_CreateFromHandle = cast(pf_sfWindow_CreateFromHandle)dll.getSymbol("sfWindow_CreateFromHandle");
|
mixin(loadFromSharedLib("sfWindow_CreateFromHandle"));
|
||||||
sfWindow_Destroy = cast(pf_sfWindow_Destroy)dll.getSymbol("sfWindow_Destroy");
|
mixin(loadFromSharedLib("sfWindow_Destroy"));
|
||||||
sfWindow_Close = cast(pf_sfWindow_Close)dll.getSymbol("sfWindow_Close");
|
mixin(loadFromSharedLib("sfWindow_Close"));
|
||||||
sfWindow_IsOpened = cast(pf_sfWindow_IsOpened)dll.getSymbol("sfWindow_IsOpened");
|
mixin(loadFromSharedLib("sfWindow_IsOpened"));
|
||||||
sfWindow_GetWidth = cast(pf_sfWindow_GetWidth)dll.getSymbol("sfWindow_GetWidth");
|
mixin(loadFromSharedLib("sfWindow_GetWidth"));
|
||||||
sfWindow_GetHeight = cast(pf_sfWindow_GetHeight)dll.getSymbol("sfWindow_GetHeight");
|
mixin(loadFromSharedLib("sfWindow_GetHeight"));
|
||||||
sfWindow_GetSettings = cast(pf_sfWindow_GetSettings)dll.getSymbol("sfWindow_GetSettings");
|
mixin(loadFromSharedLib("sfWindow_GetSettings"));
|
||||||
sfWindow_GetEvent = cast(pf_sfWindow_GetEvent)dll.getSymbol("sfWindow_GetEvent");
|
mixin(loadFromSharedLib("sfWindow_GetEvent"));
|
||||||
sfWindow_UseVerticalSync = cast(pf_sfWindow_UseVerticalSync)dll.getSymbol("sfWindow_UseVerticalSync");
|
mixin(loadFromSharedLib("sfWindow_UseVerticalSync"));
|
||||||
sfWindow_ShowMouseCursor = cast(pf_sfWindow_ShowMouseCursor)dll.getSymbol("sfWindow_ShowMouseCursor");
|
mixin(loadFromSharedLib("sfWindow_ShowMouseCursor"));
|
||||||
sfWindow_SetCursorPosition = cast(pf_sfWindow_SetCursorPosition)dll.getSymbol("sfWindow_SetCursorPosition");
|
mixin(loadFromSharedLib("sfWindow_SetCursorPosition"));
|
||||||
sfWindow_SetPosition = cast(pf_sfWindow_SetPosition)dll.getSymbol("sfWindow_SetPosition");
|
mixin(loadFromSharedLib("sfWindow_SetPosition"));
|
||||||
sfWindow_SetSize = cast(pf_sfWindow_SetSize)dll.getSymbol("sfWindow_SetSize");
|
mixin(loadFromSharedLib("sfWindow_SetSize"));
|
||||||
sfWindow_Show = cast(pf_sfWindow_Show)dll.getSymbol("sfWindow_Show");
|
mixin(loadFromSharedLib("sfWindow_Show"));
|
||||||
sfWindow_EnableKeyRepeat = cast(pf_sfWindow_EnableKeyRepeat)dll.getSymbol("sfWindow_EnableKeyRepeat");
|
mixin(loadFromSharedLib("sfWindow_EnableKeyRepeat"));
|
||||||
sfWindow_SetIcon = cast(pf_sfWindow_SetIcon)dll.getSymbol("sfWindow_SetIcon");
|
mixin(loadFromSharedLib("sfWindow_SetIcon"));
|
||||||
sfWindow_SetActive = cast(pf_sfWindow_SetActive)dll.getSymbol("sfWindow_SetActive");
|
mixin(loadFromSharedLib("sfWindow_SetActive"));
|
||||||
sfWindow_Display = cast(pf_sfWindow_Display)dll.getSymbol("sfWindow_Display");
|
mixin(loadFromSharedLib("sfWindow_Display"));
|
||||||
sfWindow_GetInput = cast(pf_sfWindow_GetInput)dll.getSymbol("sfWindow_GetInput");
|
mixin(loadFromSharedLib("sfWindow_GetInput"));
|
||||||
sfWindow_SetFramerateLimit = cast(pf_sfWindow_SetFramerateLimit)dll.getSymbol("sfWindow_SetFramerateLimit");
|
mixin(loadFromSharedLib("sfWindow_SetFramerateLimit"));
|
||||||
sfWindow_GetFrameTime = cast(pf_sfWindow_GetFrameTime)dll.getSymbol("sfWindow_GetFrameTime");
|
mixin(loadFromSharedLib("sfWindow_GetFrameTime"));
|
||||||
sfWindow_SetJoystickThreshold = cast(pf_sfWindow_SetJoystickThreshold)dll.getSymbol("sfWindow_SetJoystickThreshold");
|
mixin(loadFromSharedLib("sfWindow_SetJoystickThreshold"));
|
||||||
|
mixin(loadFromSharedLib("sfWindow_WaitEvent"));
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user