* Fixed regression bug with DllLoader
+ added missing Font functions * using alias template parameter for DrawableImpl now git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1337 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
parent
0baf8e9b46
commit
8293de5c50
@ -38,5 +38,4 @@ public import
|
||||
dsfml.graphics.shape,
|
||||
dsfml.graphics.sprite,
|
||||
dsfml.graphics.text,
|
||||
dsfml.graphics.textstyle,
|
||||
dsfml.graphics.view;
|
||||
|
@ -1,183 +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.common;
|
||||
|
||||
private import dsfml.system.common,
|
||||
dsfml.window.window,
|
||||
dsfml.window.windowhandle,
|
||||
dsfml.graphics.color,
|
||||
dsfml.graphics.rect,
|
||||
dsfml.graphics.font,
|
||||
dsfml.window.videomode;
|
||||
|
||||
package extern (C)
|
||||
{
|
||||
// sfFont
|
||||
void* function() sfFont_Create;
|
||||
void* function(cchar*) sfFont_CreateFromFile;
|
||||
void* function(ubyte*, size_t) sfFont_CreateFromMemory;
|
||||
void function(void*) sfFont_Destroy;
|
||||
void* function() sfFont_GetDefaultFont;
|
||||
|
||||
Glyph function(void*, uint, uint, bool) sfFont_GetGlyph;
|
||||
|
||||
// sfRenderWindow
|
||||
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;
|
||||
|
||||
/*
|
||||
void function(void*, void*) sfRenderWindow_DrawSprite;
|
||||
void function(void*, void*) sfRenderWindow_DrawShape;
|
||||
void function(void*, void*) 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(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;
|
||||
|
||||
// DSFML2
|
||||
|
||||
void function(void*) sfRenderWindow_Flush;
|
||||
|
||||
// sfShader
|
||||
void* function(cchar*) sfShader_CreateFromFile;
|
||||
void* function(cchar*) sfShader_CreateFromMemory;
|
||||
void function(void*) sfShader_Destroy;
|
||||
void function(void*, cchar*, float) sfShader_SetParameter1;
|
||||
void function(void*, cchar*, float, float) sfShader_SetParameter2;
|
||||
void function(void*, cchar*, float, float, float) sfShader_SetParameter3;
|
||||
void function(void*, cchar*, float, float, float, float) sfShader_SetParameter4;
|
||||
void function(void*, cchar*, void*) sfShader_SetTexture;
|
||||
int function() sfShader_IsAvailable;
|
||||
void function(void*) sfShader_Bind;
|
||||
void function(void*) sfShader_Unbind;
|
||||
|
||||
// sfView
|
||||
void* function() sfView_Create;
|
||||
void* function(FloatRect) sfView_CreateFromRect;
|
||||
void function(void*) sfView_Destroy;
|
||||
void function(void*, float, float) sfView_SetCenter;
|
||||
void function(void*, float, float) sfView_SetSize;
|
||||
void function(void*, FloatRect) sfView_SetViewport;
|
||||
float function(void*) sfView_GetCenterX;
|
||||
float function(void*) sfView_GetCenterY;
|
||||
float function(void*) sfView_GetWidth;
|
||||
float function(void*) sfView_GetHeight;
|
||||
FloatRect function(void*) sfView_GetViewport;
|
||||
void function(void*, float, float) sfView_Move;
|
||||
void function(void*, float) sfView_Zoom;
|
||||
|
||||
// DSFML2
|
||||
void function(void*, float) sfView_SetRotation;
|
||||
float function(void*) sfView_GetRotation;
|
||||
void function(void*, float) sfView_Rotate;
|
||||
void function(void*, FloatRect) sfView_Reset;
|
||||
}
|
||||
|
||||
static this()
|
||||
{
|
||||
debug
|
||||
DllLoader dll = DllLoader.load("csfml-graphics-d");
|
||||
else
|
||||
DllLoader dll = DllLoader.load("csfml-graphics");
|
||||
|
||||
// sfFont
|
||||
mixin(loadFromSharedLib("sfFont_CreateFromFile"));
|
||||
mixin(loadFromSharedLib("sfFont_CreateFromMemory"));
|
||||
mixin(loadFromSharedLib("sfFont_Destroy"));
|
||||
mixin(loadFromSharedLib("sfFont_GetDefaultFont"));
|
||||
mixin(loadFromSharedLib("sfFont_GetGlyph"));
|
||||
|
||||
// sfRenderWindow
|
||||
mixin(loadFromSharedLib("sfRenderWindow_Create"));
|
||||
mixin(loadFromSharedLib("sfRenderWindow_CreateFromHandle"));
|
||||
mixin(loadFromSharedLib("sfRenderWindow_Destroy"));
|
||||
mixin(loadFromSharedLib("sfRenderWindow_GetInput"));
|
||||
|
||||
/*
|
||||
mixin(loadFromSharedLib("sfRenderWindow_DrawSprite"));
|
||||
mixin(loadFromSharedLib("sfRenderWindow_DrawShape"));
|
||||
mixin(loadFromSharedLib("sfRenderWindow_DrawText"));
|
||||
|
||||
mixin(loadFromSharedLib("sfRenderWindow_DrawSpriteWithShader"));
|
||||
mixin(loadFromSharedLib("sfRenderWindow_DrawShapeWithShader"));
|
||||
mixin(loadFromSharedLib("sfRenderWindow_DrawTextWithShader"));
|
||||
*/
|
||||
|
||||
mixin(loadFromSharedLib("sfRenderWindow_Clear"));
|
||||
mixin(loadFromSharedLib("sfRenderWindow_SetView"));
|
||||
mixin(loadFromSharedLib("sfRenderWindow_GetView"));
|
||||
mixin(loadFromSharedLib("sfRenderWindow_GetDefaultView"));
|
||||
mixin(loadFromSharedLib("sfRenderWindow_ConvertCoords"));
|
||||
|
||||
// DSFML2
|
||||
mixin(loadFromSharedLib("sfRenderWindow_Flush"));
|
||||
|
||||
// sfShader
|
||||
mixin(loadFromSharedLib("sfShader_CreateFromFile"));
|
||||
mixin(loadFromSharedLib("sfShader_CreateFromMemory"));
|
||||
mixin(loadFromSharedLib("sfShader_Destroy"));
|
||||
mixin(loadFromSharedLib("sfShader_SetParameter1"));
|
||||
mixin(loadFromSharedLib("sfShader_SetParameter2"));
|
||||
mixin(loadFromSharedLib("sfShader_SetParameter3"));
|
||||
mixin(loadFromSharedLib("sfShader_SetParameter4"));
|
||||
mixin(loadFromSharedLib("sfShader_SetTexture"));
|
||||
mixin(loadFromSharedLib("sfShader_IsAvailable"));
|
||||
mixin(loadFromSharedLib("sfShader_Bind"));
|
||||
mixin(loadFromSharedLib("sfShader_Unbind"));
|
||||
|
||||
// sfView
|
||||
mixin(loadFromSharedLib("sfView_Create"));
|
||||
mixin(loadFromSharedLib("sfView_CreateFromRect"));
|
||||
mixin(loadFromSharedLib("sfView_Destroy"));
|
||||
mixin(loadFromSharedLib("sfView_SetCenter"));
|
||||
mixin(loadFromSharedLib("sfView_SetSize"));
|
||||
mixin(loadFromSharedLib("sfView_SetViewport"));
|
||||
mixin(loadFromSharedLib("sfView_GetCenterX"));
|
||||
mixin(loadFromSharedLib("sfView_GetCenterY"));
|
||||
mixin(loadFromSharedLib("sfView_GetWidth"));
|
||||
mixin(loadFromSharedLib("sfView_GetHeight"));
|
||||
mixin(loadFromSharedLib("sfView_GetViewport"));
|
||||
mixin(loadFromSharedLib("sfView_Move"));
|
||||
mixin(loadFromSharedLib("sfView_Zoom"));
|
||||
|
||||
// DSFML2
|
||||
mixin(loadFromSharedLib("sfView_SetRotation"));
|
||||
mixin(loadFromSharedLib("sfView_GetRotation"));
|
||||
mixin(loadFromSharedLib("sfView_Rotate"));
|
||||
mixin(loadFromSharedLib("sfView_Reset"));
|
||||
}
|
@ -36,18 +36,12 @@ import dsfml.graphics.idrawable,
|
||||
dsfml.graphics.renderimage,
|
||||
dsfml.graphics.shader;
|
||||
|
||||
package
|
||||
{
|
||||
struct sfSprite{};
|
||||
struct sfShape{};
|
||||
struct sfText{};
|
||||
}
|
||||
|
||||
/*
|
||||
* Package base class of all drawable.
|
||||
* Provide implementation of IDrawable and functions aliases.
|
||||
*/
|
||||
package class Drawableimpl(T) : DSFMLObject, IDrawable
|
||||
package class Drawableimpl(alias symbol) : DSFMLObject, IDrawable
|
||||
{
|
||||
protected:
|
||||
this()
|
||||
@ -302,19 +296,6 @@ private:
|
||||
else
|
||||
DllLoader dll = DllLoader.load("csfml-graphics");
|
||||
|
||||
static if (is (T : sfSprite))
|
||||
{
|
||||
string symbol = "sfSprite";
|
||||
}
|
||||
else static if (is (T : sfText))
|
||||
{
|
||||
string symbol = "sfText";
|
||||
}
|
||||
else static if (is (T : sfShape))
|
||||
{
|
||||
string symbol = "sfShape";
|
||||
}
|
||||
|
||||
sfDrawable_Create = cast(pf_sfDrawable_Create)dll.getSymbol(symbol ~ "_Create");
|
||||
sfDrawable_Destroy = cast(pf_sfDrawable_Destroy)dll.getSymbol(symbol ~ "_Destroy");
|
||||
sfDrawable_SetX = cast(pf_sfDrawable_SetX)dll.getSymbol(symbol ~ "_SetX");
|
||||
|
@ -30,8 +30,8 @@ import dsfml.system.common,
|
||||
dsfml.system.exception,
|
||||
dsfml.system.stringutil;
|
||||
|
||||
import dsfml.graphics.common,
|
||||
dsfml.graphics.rect;
|
||||
import dsfml.graphics.rect,
|
||||
dsfml.graphics.image;
|
||||
|
||||
|
||||
/// Glyph describes a glyph (a visual character)
|
||||
@ -96,6 +96,55 @@ public:
|
||||
sfFont_Destroy(m_ptr);
|
||||
}
|
||||
|
||||
/**
|
||||
* get a glyph in a font
|
||||
*
|
||||
* Params:
|
||||
* codePoint = Unicode code point of the character to get
|
||||
* charSize = Reference character size
|
||||
* bold = Retrieve the bold version or the regular one?
|
||||
* Returns:
|
||||
* The glyph corresponding to codePoint and charSize
|
||||
*/
|
||||
Glyph getGlyph(uint codePoint, uint charSize, bool bold)
|
||||
{
|
||||
return sfFont_GetGlyph(m_ptr, codePoint, charSize, bold);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the kerning offset of two glyphs
|
||||
*
|
||||
* Params:
|
||||
* first = Unicode code point of the first character
|
||||
* second = Unicode code point of the second character
|
||||
* charSize = Reference character size
|
||||
*
|
||||
* Returns:
|
||||
* Kerning value for first and second, in pixels
|
||||
*/
|
||||
int getKerning(uint first, uint second, uint charSize)
|
||||
{
|
||||
return sfFont_GetKerning(m_ptr, first, second, charSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the vertical offset to apply between two consecutive lines of text.
|
||||
*
|
||||
* Params:
|
||||
* charSize = Reference character size
|
||||
*
|
||||
* Returns:
|
||||
* Line spacing, in pixels
|
||||
*/
|
||||
int getLineSpacing(uint charSize)
|
||||
{
|
||||
return sfFont_GetLineSpacing(m_ptr, charSize);
|
||||
}
|
||||
|
||||
Image getImage(uint charSize)
|
||||
{
|
||||
return new Image(sfFont_GetImage(m_ptr, charSize));
|
||||
}
|
||||
|
||||
package:
|
||||
|
||||
@ -103,4 +152,42 @@ package:
|
||||
{
|
||||
super(ptr, true);
|
||||
}
|
||||
|
||||
private:
|
||||
static extern(C)
|
||||
{
|
||||
// sfFont
|
||||
void* function() sfFont_Create;
|
||||
void* function(cchar*) sfFont_CreateFromFile;
|
||||
void* function(ubyte*, size_t) sfFont_CreateFromMemory;
|
||||
void function(void*) sfFont_Destroy;
|
||||
void* function() sfFont_GetDefaultFont;
|
||||
|
||||
// DSFML2
|
||||
Glyph function(void*, uint, uint, bool) sfFont_GetGlyph;
|
||||
int function(void*, uint, uint, uint) sfFont_GetKerning;
|
||||
int function(void*, uint) sfFont_GetLineSpacing;
|
||||
void* function(void*, uint) sfFont_GetImage;
|
||||
}
|
||||
|
||||
static this()
|
||||
{
|
||||
debug
|
||||
DllLoader dll = DllLoader.load("csfml-graphics-d");
|
||||
else
|
||||
DllLoader dll = DllLoader.load("csfml-graphics");
|
||||
|
||||
// sfFont
|
||||
mixin(loadFromSharedLib("sfFont_CreateFromFile"));
|
||||
mixin(loadFromSharedLib("sfFont_CreateFromMemory"));
|
||||
mixin(loadFromSharedLib("sfFont_Destroy"));
|
||||
mixin(loadFromSharedLib("sfFont_GetDefaultFont"));
|
||||
|
||||
// DSFML2
|
||||
mixin(loadFromSharedLib("sfFont_GetGlyph"));
|
||||
mixin(loadFromSharedLib("sfFont_GetKerning"));
|
||||
mixin(loadFromSharedLib("sfFont_GetLineSpacing"));
|
||||
mixin(loadFromSharedLib("sfFont_GetImage"));
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -27,8 +27,7 @@
|
||||
|
||||
module dsfml.graphics.image;
|
||||
|
||||
import dsfml.graphics.common,
|
||||
dsfml.graphics.color,
|
||||
import dsfml.graphics.color,
|
||||
dsfml.graphics.rect;
|
||||
|
||||
import dsfml.system.common,
|
||||
|
@ -31,8 +31,7 @@ import dsfml.system.common,
|
||||
dsfml.system.stringutil,
|
||||
dsfml.system.vector2;
|
||||
|
||||
import dsfml.graphics.common,
|
||||
dsfml.graphics.idrawable,
|
||||
import dsfml.graphics.idrawable,
|
||||
dsfml.graphics.image,
|
||||
dsfml.graphics.color,
|
||||
dsfml.graphics.rect,
|
||||
|
@ -26,8 +26,7 @@
|
||||
|
||||
module dsfml.graphics.renderwindow;
|
||||
|
||||
import dsfml.graphics.common,
|
||||
dsfml.graphics.color,
|
||||
import dsfml.graphics.color,
|
||||
dsfml.graphics.sprite,
|
||||
dsfml.graphics.shape,
|
||||
dsfml.graphics.text,
|
||||
@ -247,4 +246,72 @@ public:
|
||||
{
|
||||
sfRenderWindow_Flush(m_ptr);
|
||||
}
|
||||
|
||||
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; // also in Window
|
||||
|
||||
/*
|
||||
void function(void*, void*) sfRenderWindow_DrawSprite;
|
||||
void function(void*, void*) sfRenderWindow_DrawShape;
|
||||
void function(void*, void*) 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(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;
|
||||
|
||||
// DSFML2
|
||||
void function(void*) sfRenderWindow_Flush;
|
||||
}
|
||||
|
||||
static this()
|
||||
{
|
||||
debug
|
||||
DllLoader dll = DllLoader.load("csfml-graphics-d");
|
||||
else
|
||||
DllLoader dll = DllLoader.load("csfml-graphics");
|
||||
|
||||
mixin(loadFromSharedLib("sfRenderWindow_Create"));
|
||||
mixin(loadFromSharedLib("sfRenderWindow_CreateFromHandle"));
|
||||
mixin(loadFromSharedLib("sfRenderWindow_Destroy"));
|
||||
mixin(loadFromSharedLib("sfRenderWindow_GetInput"));
|
||||
|
||||
/*
|
||||
mixin(loadFromSharedLib("sfRenderWindow_DrawSprite"));
|
||||
mixin(loadFromSharedLib("sfRenderWindow_DrawShape"));
|
||||
mixin(loadFromSharedLib("sfRenderWindow_DrawText"));
|
||||
|
||||
mixin(loadFromSharedLib("sfRenderWindow_DrawSpriteWithShader"));
|
||||
mixin(loadFromSharedLib("sfRenderWindow_DrawShapeWithShader"));
|
||||
mixin(loadFromSharedLib("sfRenderWindow_DrawTextWithShader"));
|
||||
*/
|
||||
|
||||
mixin(loadFromSharedLib("sfRenderWindow_Clear"));
|
||||
mixin(loadFromSharedLib("sfRenderWindow_SetView"));
|
||||
mixin(loadFromSharedLib("sfRenderWindow_GetView"));
|
||||
mixin(loadFromSharedLib("sfRenderWindow_GetDefaultView"));
|
||||
mixin(loadFromSharedLib("sfRenderWindow_ConvertCoords"));
|
||||
|
||||
// DSFML2
|
||||
mixin(loadFromSharedLib("sfRenderWindow_Flush"));
|
||||
}
|
||||
|
||||
static ~this()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -26,7 +26,6 @@
|
||||
|
||||
module dsfml.graphics.shader;
|
||||
|
||||
import dsfml.graphics.common;
|
||||
import dsfml.graphics.image;
|
||||
|
||||
import dsfml.system.common;
|
||||
@ -51,6 +50,11 @@ enum LoadingType
|
||||
*/
|
||||
class Shader : DSFMLObject
|
||||
{
|
||||
private:
|
||||
Image m_texture;
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* construct the effect
|
||||
*
|
||||
@ -135,5 +139,39 @@ class Shader : DSFMLObject
|
||||
|
||||
|
||||
private:
|
||||
Image m_texture;
|
||||
|
||||
static extern(C)
|
||||
{
|
||||
void* function(cchar*) sfShader_CreateFromFile;
|
||||
void* function(cchar*) sfShader_CreateFromMemory;
|
||||
void function(void*) sfShader_Destroy;
|
||||
void function(void*, cchar*, float) sfShader_SetParameter1;
|
||||
void function(void*, cchar*, float, float) sfShader_SetParameter2;
|
||||
void function(void*, cchar*, float, float, float) sfShader_SetParameter3;
|
||||
void function(void*, cchar*, float, float, float, float) sfShader_SetParameter4;
|
||||
void function(void*, cchar*, void*) sfShader_SetTexture;
|
||||
int function() sfShader_IsAvailable;
|
||||
void function(void*) sfShader_Bind;
|
||||
void function(void*) sfShader_Unbind;
|
||||
}
|
||||
|
||||
static this()
|
||||
{
|
||||
debug
|
||||
DllLoader dll = DllLoader.load("csfml-graphics-d");
|
||||
else
|
||||
DllLoader dll = DllLoader.load("csfml-graphics");
|
||||
|
||||
mixin(loadFromSharedLib("sfShader_CreateFromFile"));
|
||||
mixin(loadFromSharedLib("sfShader_CreateFromMemory"));
|
||||
mixin(loadFromSharedLib("sfShader_Destroy"));
|
||||
mixin(loadFromSharedLib("sfShader_SetParameter1"));
|
||||
mixin(loadFromSharedLib("sfShader_SetParameter2"));
|
||||
mixin(loadFromSharedLib("sfShader_SetParameter3"));
|
||||
mixin(loadFromSharedLib("sfShader_SetParameter4"));
|
||||
mixin(loadFromSharedLib("sfShader_SetTexture"));
|
||||
mixin(loadFromSharedLib("sfShader_IsAvailable"));
|
||||
mixin(loadFromSharedLib("sfShader_Bind"));
|
||||
mixin(loadFromSharedLib("sfShader_Unbind"));
|
||||
}
|
||||
}
|
@ -37,8 +37,15 @@ import dsfml.graphics.drawableimpl;
|
||||
* helper functions to draw simple shapes like
|
||||
* lines, rectangles, circles, etc.
|
||||
*/
|
||||
class Shape : Drawableimpl!(sfShape)
|
||||
class Shape : Drawableimpl!("sfShape")
|
||||
{
|
||||
private:
|
||||
this (void* ptr)
|
||||
{
|
||||
super(ptr);
|
||||
}
|
||||
|
||||
public:
|
||||
this()
|
||||
{
|
||||
super();
|
||||
@ -271,10 +278,6 @@ class Shape : Drawableimpl!(sfShape)
|
||||
}
|
||||
|
||||
private:
|
||||
this (void* ptr)
|
||||
{
|
||||
super(ptr);
|
||||
}
|
||||
|
||||
extern (C)
|
||||
{
|
||||
|
@ -40,7 +40,7 @@ import dsfml.system.vector2;
|
||||
* See_Also:
|
||||
* IDrawable
|
||||
*/
|
||||
class Sprite : Drawableimpl!(sfSprite)
|
||||
class Sprite : Drawableimpl!("sfSprite")
|
||||
{
|
||||
private:
|
||||
Image m_image; //< Image used to draw the sprite
|
||||
|
@ -29,7 +29,6 @@ module dsfml.graphics.text;
|
||||
import dsfml.graphics.blendmode;
|
||||
import dsfml.graphics.color;
|
||||
import dsfml.graphics.font;
|
||||
import dsfml.graphics.textstyle;
|
||||
import dsfml.graphics.drawableimpl;
|
||||
import dsfml.graphics.rect;
|
||||
|
||||
@ -65,7 +64,7 @@ enum TextStyle
|
||||
* See_Also:
|
||||
* IDrawable
|
||||
*/
|
||||
class Text : Drawableimpl!(sfText)
|
||||
class Text : Drawableimpl!("sfText")
|
||||
{
|
||||
private:
|
||||
Font m_font;
|
||||
|
@ -26,8 +26,7 @@
|
||||
|
||||
module dsfml.graphics.view;
|
||||
|
||||
import dsfml.graphics.common,
|
||||
dsfml.graphics.rect;
|
||||
import dsfml.graphics.rect;
|
||||
|
||||
import dsfml.system.common,
|
||||
dsfml.system.vector2;
|
||||
@ -283,4 +282,56 @@ package:
|
||||
{
|
||||
super(ptr, preventDelete);
|
||||
}
|
||||
|
||||
private:
|
||||
static extern(C)
|
||||
{
|
||||
void* function() sfView_Create;
|
||||
void* function(FloatRect) sfView_CreateFromRect;
|
||||
void function(void*) sfView_Destroy;
|
||||
void function(void*, float, float) sfView_SetCenter;
|
||||
void function(void*, float, float) sfView_SetSize;
|
||||
void function(void*, FloatRect) sfView_SetViewport;
|
||||
float function(void*) sfView_GetCenterX;
|
||||
float function(void*) sfView_GetCenterY;
|
||||
float function(void*) sfView_GetWidth;
|
||||
float function(void*) sfView_GetHeight;
|
||||
FloatRect function(void*) sfView_GetViewport;
|
||||
void function(void*, float, float) sfView_Move;
|
||||
void function(void*, float) sfView_Zoom;
|
||||
|
||||
// DSFML2
|
||||
void function(void*, float) sfView_SetRotation;
|
||||
float function(void*) sfView_GetRotation;
|
||||
void function(void*, float) sfView_Rotate;
|
||||
void function(void*, FloatRect) sfView_Reset;
|
||||
}
|
||||
|
||||
static this()
|
||||
{
|
||||
debug
|
||||
DllLoader dll = DllLoader.load("csfml-graphics-d");
|
||||
else
|
||||
DllLoader dll = DllLoader.load("csfml-graphics");
|
||||
|
||||
mixin(loadFromSharedLib("sfView_Create"));
|
||||
mixin(loadFromSharedLib("sfView_CreateFromRect"));
|
||||
mixin(loadFromSharedLib("sfView_Destroy"));
|
||||
mixin(loadFromSharedLib("sfView_SetCenter"));
|
||||
mixin(loadFromSharedLib("sfView_SetSize"));
|
||||
mixin(loadFromSharedLib("sfView_SetViewport"));
|
||||
mixin(loadFromSharedLib("sfView_GetCenterX"));
|
||||
mixin(loadFromSharedLib("sfView_GetCenterY"));
|
||||
mixin(loadFromSharedLib("sfView_GetWidth"));
|
||||
mixin(loadFromSharedLib("sfView_GetHeight"));
|
||||
mixin(loadFromSharedLib("sfView_GetViewport"));
|
||||
mixin(loadFromSharedLib("sfView_Move"));
|
||||
mixin(loadFromSharedLib("sfView_Zoom"));
|
||||
|
||||
// DSFML2
|
||||
mixin(loadFromSharedLib("sfView_SetRotation"));
|
||||
mixin(loadFromSharedLib("sfView_GetRotation"));
|
||||
mixin(loadFromSharedLib("sfView_Rotate"));
|
||||
mixin(loadFromSharedLib("sfView_Reset"));
|
||||
}
|
||||
}
|
@ -60,6 +60,11 @@ static this()
|
||||
}
|
||||
}
|
||||
|
||||
static ~this()
|
||||
{
|
||||
// DllLoader.closeAll();
|
||||
}
|
||||
|
||||
private void report(string msg, string lib, string symb)
|
||||
{
|
||||
string str = "Loading error. Reason : " ~ msg ~ " (library : " ~ lib ~ ", symbol : " ~ symb ~ ")";
|
||||
@ -102,11 +107,6 @@ class DllLoader
|
||||
}
|
||||
}
|
||||
|
||||
~this()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
void* getSymbol(string symbolName)
|
||||
{
|
||||
void* symb;
|
||||
@ -152,6 +152,14 @@ class DllLoader
|
||||
}
|
||||
}
|
||||
|
||||
static void closeAll()
|
||||
{
|
||||
foreach(lib; alreadyLoaded.values)
|
||||
{
|
||||
lib.close();
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
this(string libraryPath)
|
||||
{
|
||||
|
@ -1,50 +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.window.common;
|
||||
|
||||
import dsfml.system.dllloader;
|
||||
|
||||
package extern(C)
|
||||
{
|
||||
|
||||
void* function() sfContext_Create;
|
||||
void function(void*) sfContext_Destroy;
|
||||
void function(void*, bool) sfContext_SetActive;
|
||||
|
||||
}
|
||||
|
||||
static this()
|
||||
{
|
||||
debug
|
||||
DllLoader dll = DllLoader.load("csfml-window-d");
|
||||
else
|
||||
DllLoader dll = DllLoader.load("csfml-window");
|
||||
|
||||
mixin(loadFromSharedLib("sfContext_Create"));
|
||||
mixin(loadFromSharedLib("sfContext_Destroy"));
|
||||
mixin(loadFromSharedLib("sfContext_SetActive"));
|
||||
}
|
@ -55,5 +55,24 @@ class Context : DSFMLObject
|
||||
{
|
||||
sfContext_SetActive(m_ptr, active);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
static extern(C)
|
||||
{
|
||||
void* function() sfContext_Create;
|
||||
void function(void*) sfContext_Destroy;
|
||||
void function(void*, bool) sfContext_SetActive;
|
||||
}
|
||||
|
||||
static this()
|
||||
{
|
||||
debug
|
||||
DllLoader dll = DllLoader.load("csfml-window-d");
|
||||
else
|
||||
DllLoader dll = DllLoader.load("csfml-window");
|
||||
|
||||
mixin(loadFromSharedLib("sfContext_Create"));
|
||||
mixin(loadFromSharedLib("sfContext_Destroy"));
|
||||
mixin(loadFromSharedLib("sfContext_SetActive"));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user