mirror of
https://github.com/SFML/SFML.git
synced 2024-12-01 15:51:04 +08:00
* introduced SFMLClass type for all C pointers
* getNativePointer -> nativePointer property - IpAddress.isValid + IpAddress.None git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1459 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
parent
6b444d338e
commit
cfedeee112
@ -156,16 +156,16 @@ private:
|
||||
|
||||
extern(C)
|
||||
{
|
||||
void* function(cchar*) sfMusic_CreateFromFile;
|
||||
void* function(byte*, size_t) sfMusic_CreateFromMemory;
|
||||
void function(void*, int) sfMusic_SetLoop;
|
||||
bool function(void*) sfMusic_GetLoop;
|
||||
float function(void*) sfMusic_GetDuration;
|
||||
void function(void*) sfMusic_Play;
|
||||
void function(void*) sfMusic_Pause;
|
||||
void function(void*) sfMusic_Stop;
|
||||
uint function(void*) sfMusic_GetChannelsCount;
|
||||
uint function(void*) sfMusic_GetSampleRate;
|
||||
SFMLClass function(cchar*) sfMusic_CreateFromFile;
|
||||
SFMLClass function(byte*, size_t) sfMusic_CreateFromMemory;
|
||||
void function(SFMLClass, int) sfMusic_SetLoop;
|
||||
bool function(SFMLClass) sfMusic_GetLoop;
|
||||
float function(SFMLClass) sfMusic_GetDuration;
|
||||
void function(SFMLClass) sfMusic_Play;
|
||||
void function(SFMLClass) sfMusic_Pause;
|
||||
void function(SFMLClass) sfMusic_Stop;
|
||||
uint function(SFMLClass) sfMusic_GetChannelsCount;
|
||||
uint function(SFMLClass) sfMusic_GetSampleRate;
|
||||
}
|
||||
|
||||
static this()
|
||||
|
@ -114,7 +114,7 @@ class Sound : SoundSource!("sfSound")
|
||||
throw new NullParameterException("NullParameterException : SoundBuffer is null.");
|
||||
|
||||
m_buffer = buffer;
|
||||
sfSound_SetBuffer(m_ptr, buffer.getNativePointer);
|
||||
sfSound_SetBuffer(m_ptr, buffer.nativePointer);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -183,15 +183,15 @@ private:
|
||||
|
||||
extern (C)
|
||||
{
|
||||
typedef void function(void*) pf_sfSound_Play;
|
||||
typedef void function(void*) pf_sfSound_Pause;
|
||||
typedef void function(void*) pf_sfSound_Stop;
|
||||
typedef void function(void*, void*) pf_sfSound_SetBuffer;
|
||||
typedef void* function(void*) pf_sfSound_GetBuffer;
|
||||
typedef void function(void*, int) pf_sfSound_SetLoop;
|
||||
typedef int function(void*) pf_sfSound_GetLoop;
|
||||
typedef float function(void*) pf_sfSound_GetPlayingOffset;
|
||||
typedef void function(void*, float) pf_sfSound_SetPlayingOffset;
|
||||
typedef void function(SFMLClass) pf_sfSound_Play;
|
||||
typedef void function(SFMLClass) pf_sfSound_Pause;
|
||||
typedef void function(SFMLClass) pf_sfSound_Stop;
|
||||
typedef void function(SFMLClass, SFMLClass) pf_sfSound_SetBuffer;
|
||||
typedef SFMLClass function(SFMLClass) pf_sfSound_GetBuffer;
|
||||
typedef void function(SFMLClass, int) pf_sfSound_SetLoop;
|
||||
typedef int function(SFMLClass) pf_sfSound_GetLoop;
|
||||
typedef float function(SFMLClass) pf_sfSound_GetPlayingOffset;
|
||||
typedef void function(SFMLClass, float) pf_sfSound_SetPlayingOffset;
|
||||
|
||||
static pf_sfSound_Play sfSound_Play;
|
||||
static pf_sfSound_Pause sfSound_Pause;
|
||||
|
@ -178,7 +178,7 @@ class SoundBuffer : DSFMLObject
|
||||
}
|
||||
|
||||
package:
|
||||
this(void* ptr)
|
||||
this(SFMLClass ptr)
|
||||
{
|
||||
super(ptr, true);
|
||||
}
|
||||
@ -187,16 +187,16 @@ private:
|
||||
|
||||
static extern(C)
|
||||
{
|
||||
void* function(cchar*) sfSoundBuffer_CreateFromFile;
|
||||
void* function(const(byte)*, size_t) sfSoundBuffer_CreateFromMemory;
|
||||
void* function(const(short)*, size_t, uint, uint) sfSoundBuffer_CreateFromSamples;
|
||||
void function(void*) sfSoundBuffer_Destroy;
|
||||
int function(void*, cchar*) sfSoundBuffer_SaveToFile;
|
||||
short* function(void*) sfSoundBuffer_GetSamples;
|
||||
size_t function(void*) sfSoundBuffer_GetSamplesCount;
|
||||
uint function(void*) sfSoundBuffer_GetSampleRate;
|
||||
uint function(void*) sfSoundBuffer_GetChannelsCount;
|
||||
float function(void*) sfSoundBuffer_GetDuration;
|
||||
SFMLClass function(cchar*) sfSoundBuffer_CreateFromFile;
|
||||
SFMLClass function(const(byte)*, size_t) sfSoundBuffer_CreateFromMemory;
|
||||
SFMLClass function(const(short)*, size_t, uint, uint) sfSoundBuffer_CreateFromSamples;
|
||||
void function(SFMLClass) sfSoundBuffer_Destroy;
|
||||
int function(SFMLClass, cchar*) sfSoundBuffer_SaveToFile;
|
||||
short* function(SFMLClass) sfSoundBuffer_GetSamples;
|
||||
size_t function(SFMLClass) sfSoundBuffer_GetSamplesCount;
|
||||
uint function(SFMLClass) sfSoundBuffer_GetSampleRate;
|
||||
uint function(SFMLClass) sfSoundBuffer_GetChannelsCount;
|
||||
float function(SFMLClass) sfSoundBuffer_GetDuration;
|
||||
}
|
||||
|
||||
mixin(loadFromSharedLib2("csfml-audio", "sfSoundBuffer",
|
||||
|
@ -85,9 +85,9 @@ private:
|
||||
|
||||
extern (C)
|
||||
{
|
||||
typedef void* function() pf_sfSoundBufferRecorder_Create;
|
||||
typedef void function(void*) pf_sfSoundBufferRecorder_Destroy;
|
||||
typedef void* function(void*) pf_sfSoundBufferRecorder_GetBuffer;
|
||||
typedef SFMLClass function() pf_sfSoundBufferRecorder_Create;
|
||||
typedef void function(SFMLClass) pf_sfSoundBufferRecorder_Destroy;
|
||||
typedef SFMLClass function(SFMLClass) pf_sfSoundBufferRecorder_GetBuffer;
|
||||
|
||||
static pf_sfSoundBufferRecorder_Create sfSoundBufferRecorder_Create;
|
||||
static pf_sfSoundBufferRecorder_Destroy sfSoundBufferRecorder_Destroy;
|
||||
|
@ -146,7 +146,7 @@ protected:
|
||||
init(true);
|
||||
}
|
||||
|
||||
this(void* ptr)
|
||||
this(SFMLClass ptr)
|
||||
{
|
||||
super(ptr);
|
||||
|
||||
@ -288,11 +288,11 @@ private:
|
||||
|
||||
static extern (C)
|
||||
{
|
||||
void* function(int function(void*), int function(short*, size_t, void*), void function(void*), void*) sfSoundRecorder_Create;
|
||||
void function(void*) sfSoundRecorder_Destroy;
|
||||
void function(void*, uint SampleRate) sfSoundRecorder_Start;
|
||||
void function(void*) sfSoundRecorder_Stop;
|
||||
uint function(void*) sfSoundRecorder_GetSampleRate;
|
||||
SFMLClass function(int function(void*), int function(const(short)*, size_t, void*), void function(void*), void*) sfSoundRecorder_Create;
|
||||
void function(SFMLClass) sfSoundRecorder_Destroy;
|
||||
void function(SFMLClass, uint SampleRate) sfSoundRecorder_Start;
|
||||
void function(SFMLClass) sfSoundRecorder_Stop;
|
||||
uint function(SFMLClass) sfSoundRecorder_GetSampleRate;
|
||||
int function() sfSoundRecorder_IsAvailable;
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ protected:
|
||||
super(sfSoundSource_Create());
|
||||
}
|
||||
|
||||
this(void* ptr)
|
||||
this(SFMLClass ptr)
|
||||
{
|
||||
super(ptr);
|
||||
}
|
||||
@ -286,23 +286,23 @@ private:
|
||||
|
||||
static extern(C)
|
||||
{
|
||||
void* function() sfSoundSource_Create;
|
||||
void function(void*) sfSoundSource_Destroy;
|
||||
SFMLClass function() sfSoundSource_Create;
|
||||
void function(SFMLClass) sfSoundSource_Destroy;
|
||||
|
||||
SoundStatus function(void*) sfSoundSource_GetStatus;
|
||||
void function(void*, float) sfSoundSource_SetPitch;
|
||||
void function(void*, float) sfSoundSource_SetVolume;
|
||||
void function(void*, float, float, float) sfSoundSource_SetPosition;
|
||||
float function(void*) sfSoundSource_GetPitch;
|
||||
float function(void*) sfSoundSource_GetVolume;
|
||||
void function(void*, float*, float*, float*) sfSoundSource_GetPosition;
|
||||
float function(void*) sfSoundSource_GetMinDistance;
|
||||
float function(void*) sfSoundSource_GetAttenuation;
|
||||
void function(void*, float) sfSoundSource_SetMinDistance;
|
||||
void function(void*, float) sfSoundSource_SetAttenuation;
|
||||
SoundStatus function(SFMLClass) sfSoundSource_GetStatus;
|
||||
void function(SFMLClass, float) sfSoundSource_SetPitch;
|
||||
void function(SFMLClass, float) sfSoundSource_SetVolume;
|
||||
void function(SFMLClass, float, float, float) sfSoundSource_SetPosition;
|
||||
float function(SFMLClass) sfSoundSource_GetPitch;
|
||||
float function(SFMLClass) sfSoundSource_GetVolume;
|
||||
void function(SFMLClass, float*, float*, float*) sfSoundSource_GetPosition;
|
||||
float function(SFMLClass) sfSoundSource_GetMinDistance;
|
||||
float function(SFMLClass) sfSoundSource_GetAttenuation;
|
||||
void function(SFMLClass, float) sfSoundSource_SetMinDistance;
|
||||
void function(SFMLClass, float) sfSoundSource_SetAttenuation;
|
||||
|
||||
void function(void*, bool) sfSoundSource_SetRelativeToListener;
|
||||
bool function(void*) sfSoundSource_IsRelativeToListener;
|
||||
void function(SFMLClass, bool) sfSoundSource_SetRelativeToListener;
|
||||
bool function(SFMLClass) sfSoundSource_IsRelativeToListener;
|
||||
}
|
||||
|
||||
mixin(loadDerivedFromSharedLib("csfml-audio", "sfSoundSource", derivedClassName,
|
||||
|
@ -334,17 +334,17 @@ private:
|
||||
alias void function(float, void*) sfSoundStreamSeekCallback;
|
||||
alias int function (sfSoundStreamChunk*, void*) sfSoundStreamGetDataCallback;
|
||||
|
||||
alias void* function(sfSoundStreamGetDataCallback, sfSoundStreamSeekCallback, uint, uint, void*) pf_sfSoundStream_Create;
|
||||
alias void function(void*) pf_sfSoundStream_Destroy;
|
||||
alias void function(void*) pf_sfSoundStream_Play;
|
||||
alias void function(void*) pf_sfSoundStream_Pause;
|
||||
alias void function(void*) pf_sfSoundStream_Stop;
|
||||
alias uint function(void*) pf_sfSoundStream_GetChannelsCount;
|
||||
alias uint function(void*) pf_sfSoundStream_GetSampleRate;
|
||||
alias float function(void*) pf_sfSoundStream_GetPlayingOffset;
|
||||
alias void function(void*, float) pf_sfSoundStream_SetPlayingOffset;
|
||||
alias int function(void*) pf_sfSoundStream_GetLoop;
|
||||
alias void function(void*, int) pf_sfSoundStream_SetLoop;
|
||||
alias SFMLClass function(sfSoundStreamGetDataCallback, sfSoundStreamSeekCallback, uint, uint, void*) pf_sfSoundStream_Create;
|
||||
alias void function(SFMLClass) pf_sfSoundStream_Destroy;
|
||||
alias void function(SFMLClass) pf_sfSoundStream_Play;
|
||||
alias void function(SFMLClass) pf_sfSoundStream_Pause;
|
||||
alias void function(SFMLClass) pf_sfSoundStream_Stop;
|
||||
alias uint function(SFMLClass) pf_sfSoundStream_GetChannelsCount;
|
||||
alias uint function(SFMLClass) pf_sfSoundStream_GetSampleRate;
|
||||
alias float function(SFMLClass) pf_sfSoundStream_GetPlayingOffset;
|
||||
alias void function(SFMLClass, float) pf_sfSoundStream_SetPlayingOffset;
|
||||
alias int function(SFMLClass) pf_sfSoundStream_GetLoop;
|
||||
alias void function(SFMLClass, int) pf_sfSoundStream_SetLoop;
|
||||
|
||||
|
||||
static pf_sfSoundStream_Create sfSoundStream_Create;
|
||||
|
@ -148,7 +148,7 @@ public:
|
||||
|
||||
package:
|
||||
|
||||
this(void* ptr)
|
||||
this(SFMLClass ptr)
|
||||
{
|
||||
super(ptr, true);
|
||||
}
|
||||
@ -157,17 +157,17 @@ 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;
|
||||
SFMLClass function() sfFont_Create;
|
||||
SFMLClass function(cchar*) sfFont_CreateFromFile;
|
||||
SFMLClass function(ubyte*, size_t) sfFont_CreateFromMemory;
|
||||
void function(SFMLClass) sfFont_Destroy;
|
||||
SFMLClass 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;
|
||||
Glyph function(SFMLClass, uint, uint, bool) sfFont_GetGlyph;
|
||||
int function(SFMLClass, uint, uint, uint) sfFont_GetKerning;
|
||||
int function(SFMLClass, uint) sfFont_GetLineSpacing;
|
||||
SFMLClass function(SFMLClass, uint) sfFont_GetImage;
|
||||
}
|
||||
|
||||
static this()
|
||||
|
@ -123,7 +123,7 @@ public:
|
||||
void setTexture(string name, Image texture)
|
||||
{
|
||||
m_texture = texture;
|
||||
sfShader_SetTexture(m_ptr, toStringz(name), texture is null ? null : texture.getNativePointer);
|
||||
sfShader_SetTexture(m_ptr, toStringz(name), texture is null ? null : texture.nativePointer);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -142,17 +142,17 @@ private:
|
||||
|
||||
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;
|
||||
SFMLClass function(cchar*) sfShader_CreateFromFile;
|
||||
SFMLClass function(cchar*) sfShader_CreateFromMemory;
|
||||
void function(SFMLClass) sfShader_Destroy;
|
||||
void function(SFMLClass, cchar*, float) sfShader_SetParameter1;
|
||||
void function(SFMLClass, cchar*, float, float) sfShader_SetParameter2;
|
||||
void function(SFMLClass, cchar*, float, float, float) sfShader_SetParameter3;
|
||||
void function(SFMLClass, cchar*, float, float, float, float) sfShader_SetParameter4;
|
||||
void function(SFMLClass, cchar*, SFMLClass) sfShader_SetTexture;
|
||||
int function() sfShader_IsAvailable;
|
||||
void function(void*) sfShader_Bind;
|
||||
void function(void*) sfShader_Unbind;
|
||||
void function(SFMLClass) sfShader_Bind;
|
||||
void function(SFMLClass) sfShader_Unbind;
|
||||
}
|
||||
|
||||
static this()
|
||||
|
@ -40,7 +40,7 @@ import dsfml.graphics.drawableimpl;
|
||||
class Shape : DrawableImpl!("sfShape")
|
||||
{
|
||||
private:
|
||||
this (void* ptr)
|
||||
this (SFMLClass ptr)
|
||||
{
|
||||
super(ptr);
|
||||
}
|
||||
@ -284,21 +284,21 @@ private:
|
||||
|
||||
static extern(C)
|
||||
{
|
||||
void* function(float, float, float, float, float, Color, float, Color) sfShape_CreateLine;
|
||||
void* function(float, float, float, float, Color, float, Color) sfShape_CreateRectangle;
|
||||
void* function(float, float, float, Color, float, Color) sfShape_CreateCircle;
|
||||
void function(void*, float, float, Color, Color) sfShape_AddPoint;
|
||||
void function(void*, int) sfShape_EnableFill;
|
||||
void function(void*, int) sfShape_EnableOutline;
|
||||
void function(void*, float Width) sfShape_SetOutlineWidth;
|
||||
float function(void*) sfShape_GetOutlineWidth;
|
||||
uint function(void*) sfShape_GetPointsCount;
|
||||
void function(void*, uint Index, float* X, float* Y) sfShape_GetPointPosition;
|
||||
void function(void*, uint Index, float X, float Y) sfShape_SetPointPosition;
|
||||
Color function(void*, uint index) sfShape_GetPointColor;
|
||||
void function(void*, uint index, Color color) sfShape_SetPointColor;
|
||||
Color function(void*, uint index) sfShape_GetPointOutlineColor;
|
||||
void function(void*, uint index, Color color) sfShape_SetPointOutlineColor;
|
||||
SFMLClass function(float, float, float, float, float, Color, float, Color) sfShape_CreateLine;
|
||||
SFMLClass function(float, float, float, float, Color, float, Color) sfShape_CreateRectangle;
|
||||
SFMLClass function(float, float, float, Color, float, Color) sfShape_CreateCircle;
|
||||
void function(SFMLClass, float, float, Color, Color) sfShape_AddPoint;
|
||||
void function(SFMLClass, int) sfShape_EnableFill;
|
||||
void function(SFMLClass, int) sfShape_EnableOutline;
|
||||
void function(SFMLClass, float Width) sfShape_SetOutlineWidth;
|
||||
float function(SFMLClass) sfShape_GetOutlineWidth;
|
||||
uint function(SFMLClass) sfShape_GetPointsCount;
|
||||
void function(SFMLClass, uint Index, float* X, float* Y) sfShape_GetPointPosition;
|
||||
void function(SFMLClass, uint Index, float X, float Y) sfShape_SetPointPosition;
|
||||
Color function(SFMLClass, uint index) sfShape_GetPointColor;
|
||||
void function(SFMLClass, uint index, Color color) sfShape_SetPointColor;
|
||||
Color function(SFMLClass, uint index) sfShape_GetPointOutlineColor;
|
||||
void function(SFMLClass, uint index, Color color) sfShape_SetPointOutlineColor;
|
||||
}
|
||||
|
||||
mixin(loadFromSharedLib2("csfml-graphics", "sfShape",
|
||||
|
@ -72,7 +72,7 @@ public:
|
||||
{
|
||||
super();
|
||||
m_image = img;
|
||||
sfSprite_SetImage(m_ptr, img.getNativePointer, true);
|
||||
sfSprite_SetImage(m_ptr, img.nativePointer, true);
|
||||
x = left;
|
||||
y = top;
|
||||
scaleX = scalex;
|
||||
@ -91,7 +91,7 @@ public:
|
||||
void setImage(Image img, bool adjustToNewSize = false)
|
||||
{
|
||||
assert(img !is null, "Trying to set a null image.");
|
||||
sfSprite_SetImage(m_ptr, img.getNativePointer, adjustToNewSize);
|
||||
sfSprite_SetImage(m_ptr, img.nativePointer, adjustToNewSize);
|
||||
m_image = img;
|
||||
}
|
||||
|
||||
@ -216,16 +216,16 @@ private:
|
||||
|
||||
static extern(C)
|
||||
{
|
||||
void function(void*, void*, bool) sfSprite_SetImage;
|
||||
void function(void*, IntRect) sfSprite_SetSubRect;
|
||||
void function(void*, float, float) sfSprite_Resize;
|
||||
void function(void*, int) sfSprite_FlipX;
|
||||
void function(void*, int) sfSprite_FlipY;
|
||||
void* function(void*) sfSprite_GetImage;
|
||||
IntRect function(void*) sfSprite_GetSubRect;
|
||||
float function(void*) sfSprite_GetWidth;
|
||||
float function(void*) sfSprite_GetHeight;
|
||||
Color function(void*, uint, uint) sfSprite_GetPixel;
|
||||
void function(SFMLClass, SFMLClass, bool) sfSprite_SetImage;
|
||||
void function(SFMLClass, IntRect) sfSprite_SetSubRect;
|
||||
void function(SFMLClass, float, float) sfSprite_Resize;
|
||||
void function(SFMLClass, int) sfSprite_FlipX;
|
||||
void function(SFMLClass, int) sfSprite_FlipY;
|
||||
SFMLClass function(SFMLClass) sfSprite_GetImage;
|
||||
IntRect function(SFMLClass) sfSprite_GetSubRect;
|
||||
float function(SFMLClass) sfSprite_GetWidth;
|
||||
float function(SFMLClass) sfSprite_GetHeight;
|
||||
Color function(SFMLClass, uint, uint) sfSprite_GetPixel;
|
||||
}
|
||||
|
||||
mixin(loadFromSharedLib2("csfml-graphics", "sfSprite",
|
||||
|
@ -152,7 +152,7 @@ public:
|
||||
void font(Font f)
|
||||
{
|
||||
m_font = f;
|
||||
sfText_SetFont(m_ptr, f.getNativePointer);
|
||||
sfText_SetFont(m_ptr, f.nativePointer);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -257,18 +257,18 @@ private:
|
||||
|
||||
static extern(C)
|
||||
{
|
||||
void function(void*, cchar*) sfText_SetString;
|
||||
void function(void*, cdchar*) sfText_SetUnicodeString;
|
||||
void function(void*, void*) sfText_SetFont;
|
||||
void function(void*, uint) sfText_SetCharacterSize;
|
||||
void function(void*, TextStyle) sfText_SetStyle;
|
||||
idchar* function(void*) sfText_GetUnicodeString;
|
||||
ichar* function(void*) sfText_GetString;
|
||||
void* function(void*) sfText_GetFont;
|
||||
uint function(void*) sfText_GetCharacterSize;
|
||||
TextStyle function (void*) sfText_GetStyle;
|
||||
void function(void*, size_t, float*, float*) sfText_GetCharacterPos;
|
||||
FloatRect function(void*) sfText_GetRect;
|
||||
void function(SFMLClass, cchar*) sfText_SetString;
|
||||
void function(SFMLClass, cdchar*) sfText_SetUnicodeString;
|
||||
void function(SFMLClass, SFMLClass) sfText_SetFont;
|
||||
void function(SFMLClass, uint) sfText_SetCharacterSize;
|
||||
void function(SFMLClass, TextStyle) sfText_SetStyle;
|
||||
idchar* function(SFMLClass) sfText_GetUnicodeString;
|
||||
ichar* function(SFMLClass) sfText_GetString;
|
||||
SFMLClass function(SFMLClass) sfText_GetFont;
|
||||
uint function(SFMLClass) sfText_GetCharacterSize;
|
||||
TextStyle function (SFMLClass) sfText_GetStyle;
|
||||
void function(SFMLClass, size_t, float*, float*) sfText_GetCharacterPos;
|
||||
FloatRect function(SFMLClass) sfText_GetRect;
|
||||
}
|
||||
|
||||
mixin(loadFromSharedLib2("csfml-graphics", "sfText",
|
||||
|
@ -288,7 +288,7 @@ public:
|
||||
}
|
||||
package:
|
||||
|
||||
this(void* ptr, bool preventDelete)
|
||||
this(SFMLClass ptr, bool preventDelete)
|
||||
{
|
||||
super(ptr, preventDelete);
|
||||
}
|
||||
@ -296,25 +296,25 @@ package:
|
||||
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;
|
||||
SFMLClass function() sfView_Create;
|
||||
SFMLClass function(FloatRect) sfView_CreateFromRect;
|
||||
void function(SFMLClass) sfView_Destroy;
|
||||
void function(SFMLClass, float, float) sfView_SetCenter;
|
||||
void function(SFMLClass, float, float) sfView_SetSize;
|
||||
void function(SFMLClass, FloatRect) sfView_SetViewport;
|
||||
float function(SFMLClass) sfView_GetCenterX;
|
||||
float function(SFMLClass) sfView_GetCenterY;
|
||||
float function(SFMLClass) sfView_GetWidth;
|
||||
float function(SFMLClass) sfView_GetHeight;
|
||||
FloatRect function(SFMLClass) sfView_GetViewport;
|
||||
void function(SFMLClass, float, float) sfView_Move;
|
||||
void function(SFMLClass, 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;
|
||||
void function(SFMLClass, float) sfView_SetRotation;
|
||||
float function(SFMLClass) sfView_GetRotation;
|
||||
void function(SFMLClass, float) sfView_Rotate;
|
||||
void function(SFMLClass, FloatRect) sfView_Reset;
|
||||
}
|
||||
|
||||
static this()
|
||||
|
@ -162,7 +162,7 @@ class Ftp : DSFMLObject
|
||||
}
|
||||
|
||||
private:
|
||||
this(void* ptr)
|
||||
this(SFMLClass ptr)
|
||||
{
|
||||
super(ptr);
|
||||
}
|
||||
@ -170,10 +170,10 @@ class Ftp : DSFMLObject
|
||||
|
||||
extern (C)
|
||||
{
|
||||
typedef void function(void*) pf_sfFtpResponse_Destroy;
|
||||
typedef int function(void*) pf_sfFtpResponse_IsOk;
|
||||
typedef FtpStatus function(void*) pf_sfFtpResponse_GetStatus;
|
||||
typedef ichar* function(void*) pf_sfFtpResponse_GetMessage;
|
||||
typedef void function(SFMLClass) pf_sfFtpResponse_Destroy;
|
||||
typedef int function(SFMLClass) pf_sfFtpResponse_IsOk;
|
||||
typedef FtpStatus function(SFMLClass) pf_sfFtpResponse_GetStatus;
|
||||
typedef ichar* function(SFMLClass) pf_sfFtpResponse_GetMessage;
|
||||
|
||||
static pf_sfFtpResponse_Destroy sfFtpResponse_Destroy;
|
||||
static pf_sfFtpResponse_IsOk sfFtpResponse_IsOk;
|
||||
@ -213,7 +213,7 @@ class Ftp : DSFMLObject
|
||||
}
|
||||
|
||||
private:
|
||||
this(void* ptr)
|
||||
this(SFMLClass ptr)
|
||||
{
|
||||
super(ptr);
|
||||
}
|
||||
@ -221,8 +221,8 @@ class Ftp : DSFMLObject
|
||||
|
||||
extern (C)
|
||||
{
|
||||
typedef void function(void*) pf_sfFtpDirectoryResponse_Destroy;
|
||||
typedef ichar* function(void*) pf_sfFtpDirectoryResponse_GetDirectory;
|
||||
typedef void function(SFMLClass) pf_sfFtpDirectoryResponse_Destroy;
|
||||
typedef ichar* function(SFMLClass) pf_sfFtpDirectoryResponse_GetDirectory;
|
||||
|
||||
static pf_sfFtpDirectoryResponse_Destroy sfFtpDirectoryResponse_Destroy;
|
||||
static pf_sfFtpDirectoryResponse_GetDirectory sfFtpDirectoryResponse_GetDirectory;
|
||||
@ -291,7 +291,7 @@ class Ftp : DSFMLObject
|
||||
}
|
||||
|
||||
private:
|
||||
this(void* ptr)
|
||||
this(SFMLClass ptr)
|
||||
{
|
||||
super(ptr);
|
||||
}
|
||||
@ -299,9 +299,9 @@ class Ftp : DSFMLObject
|
||||
// External ================================================================
|
||||
extern (C)
|
||||
{
|
||||
typedef void function(void*) pf_sfFtpListingResponse_Destroy;
|
||||
typedef size_t function(void*) pf_sfFtpListingResponse_GetCount;
|
||||
typedef ichar* function(void*, size_t) pf_sfFtpListingResponse_GetFilename;
|
||||
typedef void function(SFMLClass) pf_sfFtpListingResponse_Destroy;
|
||||
typedef size_t function(SFMLClass) pf_sfFtpListingResponse_GetCount;
|
||||
typedef ichar* function(SFMLClass, size_t) pf_sfFtpListingResponse_GetFilename;
|
||||
|
||||
static pf_sfFtpListingResponse_Destroy sfFtpListingResponse_Destroy;
|
||||
static pf_sfFtpListingResponse_GetCount sfFtpListingResponse_GetCount;
|
||||
@ -538,23 +538,23 @@ private:
|
||||
|
||||
extern (C)
|
||||
{
|
||||
typedef void* function() pf_sfFtp_Create;
|
||||
typedef void function(void*) pf_sfFtp_Destroy;
|
||||
typedef void* function(void*, IPAddress, ushort, float) pf_sfFtp_Connect;
|
||||
typedef void* function(void*) pf_sfFtp_LoginAnonymous;
|
||||
typedef void* function(void*, cchar*, cchar*) pf_sfFtp_Login;
|
||||
typedef void* function(void*) pf_sfFtp_Disconnect;
|
||||
typedef void* function(void*) pf_sfFtp_KeepAlive;
|
||||
typedef void* function(void*) pf_sfFtp_GetWorkingDirectory;
|
||||
typedef void* function(void*, cchar*) pf_sfFtp_GetDirectoryListing;
|
||||
typedef void* function(void*, cchar*) pf_sfFtp_ChangeDirectory;
|
||||
typedef void* function(void*) pf_sfFtp_ParentDirectory;
|
||||
typedef void* function(void*, cchar*) pf_sfFtp_MakeDirectory;
|
||||
typedef void* function(void*, cchar*) pf_sfFtp_DeleteDirectory;
|
||||
typedef void* function(void*, cchar*, cchar*) pf_sfFtp_RenameFile;
|
||||
typedef void* function(void*, cchar*) pf_sfFtp_DeleteFile;
|
||||
typedef void* function(void*, cchar*, cchar*, FtpTransferMode) pf_sfFtp_Download;
|
||||
typedef void* function(void*, cchar*, cchar*, FtpTransferMode) pf_sfFtp_Upload;
|
||||
typedef SFMLClass function() pf_sfFtp_Create;
|
||||
typedef void function(SFMLClass) pf_sfFtp_Destroy;
|
||||
typedef SFMLClass function(SFMLClass, IPAddress, ushort, float) pf_sfFtp_Connect;
|
||||
typedef SFMLClass function(SFMLClass) pf_sfFtp_LoginAnonymous;
|
||||
typedef SFMLClass function(SFMLClass, cchar*, cchar*) pf_sfFtp_Login;
|
||||
typedef SFMLClass function(SFMLClass) pf_sfFtp_Disconnect;
|
||||
typedef SFMLClass function(SFMLClass) pf_sfFtp_KeepAlive;
|
||||
typedef SFMLClass function(SFMLClass) pf_sfFtp_GetWorkingDirectory;
|
||||
typedef SFMLClass function(SFMLClass, cchar*) pf_sfFtp_GetDirectoryListing;
|
||||
typedef SFMLClass function(SFMLClass, cchar*) pf_sfFtp_ChangeDirectory;
|
||||
typedef SFMLClass function(SFMLClass) pf_sfFtp_ParentDirectory;
|
||||
typedef SFMLClass function(SFMLClass, cchar*) pf_sfFtp_MakeDirectory;
|
||||
typedef SFMLClass function(SFMLClass, cchar*) pf_sfFtp_DeleteDirectory;
|
||||
typedef SFMLClass function(SFMLClass, cchar*, cchar*) pf_sfFtp_RenameFile;
|
||||
typedef SFMLClass function(SFMLClass, cchar*) pf_sfFtp_DeleteFile;
|
||||
typedef SFMLClass function(SFMLClass, cchar*, cchar*, FtpTransferMode) pf_sfFtp_Download;
|
||||
typedef SFMLClass function(SFMLClass, cchar*, cchar*, FtpTransferMode) pf_sfFtp_Upload;
|
||||
|
||||
static pf_sfFtp_Create sfFtp_Create;
|
||||
static pf_sfFtp_Destroy sfFtp_Destroy;
|
||||
|
@ -154,19 +154,19 @@ class Http : DSFMLObject
|
||||
}
|
||||
|
||||
private:
|
||||
this(void* ptr)
|
||||
this(SFMLClass ptr)
|
||||
{
|
||||
super(ptr);
|
||||
}
|
||||
// External ================================================================
|
||||
extern (C)
|
||||
{
|
||||
typedef void function(void*) pf_sfHttpResponse_Destroy;
|
||||
typedef ichar* function(void*, cchar*) pf_sfHttpResponse_GetField;
|
||||
typedef HttpStatus function(void*) pf_sfHttpResponse_GetStatus;
|
||||
typedef uint function(void*) pf_sfHttpResponse_GetMajorVersion;
|
||||
typedef uint function(void*) pf_sfHttpResponse_GetMinorVersion;
|
||||
typedef ichar* function(void*) pf_sfHttpResponse_GetBody;
|
||||
typedef void function(SFMLClass) pf_sfHttpResponse_Destroy;
|
||||
typedef ichar* function(SFMLClass, cchar*) pf_sfHttpResponse_GetField;
|
||||
typedef HttpStatus function(SFMLClass) pf_sfHttpResponse_GetStatus;
|
||||
typedef uint function(SFMLClass) pf_sfHttpResponse_GetMajorVersion;
|
||||
typedef uint function(SFMLClass) pf_sfHttpResponse_GetMinorVersion;
|
||||
typedef ichar* function(SFMLClass) pf_sfHttpResponse_GetBody;
|
||||
|
||||
static pf_sfHttpResponse_Destroy sfHttpResponse_Destroy;
|
||||
static pf_sfHttpResponse_GetField sfHttpResponse_GetField;
|
||||
@ -276,13 +276,13 @@ class Http : DSFMLObject
|
||||
// External ================================================================
|
||||
extern (C)
|
||||
{
|
||||
typedef void* function() pf_sfHttpRequest_Create;
|
||||
typedef void function(void*) pf_sfHttpRequest_Destroy;
|
||||
typedef void function(void*, cchar*, cchar*) pf_sfHttpRequest_SetField;
|
||||
typedef void function(void*, HttpMethod) pf_sfHttpRequest_SetMethod;
|
||||
typedef void function(void*, cchar*) pf_sfHttpRequest_SetURI;
|
||||
typedef void function(void*, uint, uint) pf_sfHttpRequest_SetHttpVersion;
|
||||
typedef void function(void*, cchar*) pf_sfHttpRequest_SetBody;
|
||||
typedef SFMLClass function() pf_sfHttpRequest_Create;
|
||||
typedef void function(SFMLClass) pf_sfHttpRequest_Destroy;
|
||||
typedef void function(SFMLClass, cchar*, cchar*) pf_sfHttpRequest_SetField;
|
||||
typedef void function(SFMLClass, HttpMethod) pf_sfHttpRequest_SetMethod;
|
||||
typedef void function(SFMLClass, cchar*) pf_sfHttpRequest_SetURI;
|
||||
typedef void function(SFMLClass, uint, uint) pf_sfHttpRequest_SetHttpVersion;
|
||||
typedef void function(SFMLClass, cchar*) pf_sfHttpRequest_SetBody;
|
||||
|
||||
static pf_sfHttpRequest_Create sfHttpRequest_Create;
|
||||
static pf_sfHttpRequest_Destroy sfHttpRequest_Destroy;
|
||||
@ -363,7 +363,7 @@ class Http : DSFMLObject
|
||||
|
||||
Response sendRequest(Request req)
|
||||
{
|
||||
return new Response( sfHttp_SendRequest(m_ptr, req.getNativePointer) );
|
||||
return new Response( sfHttp_SendRequest(m_ptr, req.nativePointer) );
|
||||
}
|
||||
|
||||
private:
|
||||
@ -372,10 +372,10 @@ private:
|
||||
|
||||
extern (C)
|
||||
{
|
||||
typedef void* function() pf_sfHttp_Create;
|
||||
typedef void function(void*) pf_sfHttp_Destroy;
|
||||
typedef void function(void*, cchar*, ushort) pf_sfHttp_SetHost;
|
||||
typedef void* function(void*, void*) pf_sfHttp_SendRequest;
|
||||
typedef SFMLClass function() pf_sfHttp_Create;
|
||||
typedef void function(SFMLClass) pf_sfHttp_Destroy;
|
||||
typedef void function(SFMLClass, cchar*, ushort) pf_sfHttp_SetHost;
|
||||
typedef SFMLClass function(SFMLClass, SFMLClass) pf_sfHttp_SendRequest;
|
||||
|
||||
static pf_sfHttp_Create sfHttp_Create;
|
||||
static pf_sfHttp_Destroy sfHttp_Destroy;
|
||||
|
@ -77,15 +77,14 @@ struct IPAddress
|
||||
}
|
||||
|
||||
/**
|
||||
* Tell if the address is a valid one
|
||||
*
|
||||
* Returns:
|
||||
* True if address has a valid syntax
|
||||
*
|
||||
*/
|
||||
bool isValid()
|
||||
* Get the empty/invalid address
|
||||
*
|
||||
* Returns:
|
||||
* Empty object that represents invalid addresses
|
||||
*/
|
||||
static IPAddress None()
|
||||
{
|
||||
return cast(bool)sfIpAddress_IsValid(this);
|
||||
return sfIpAddress_None();
|
||||
}
|
||||
|
||||
@property
|
||||
@ -139,11 +138,11 @@ static extern(C)
|
||||
IPAddress function(cchar*) sfIpAddress_FromString;
|
||||
IPAddress function(ubyte, ubyte, ubyte, ubyte)sfIpAddress_FromBytes;
|
||||
IPAddress function(uint) sfIpAddress_FromInteger;
|
||||
int function(IPAddress) sfIpAddress_IsValid;
|
||||
IPAddress function() sfIpAddress_None;
|
||||
IPAddress function() sfIpAddress_GetLocalAddress;
|
||||
IPAddress function() sfIpAddress_GetPublicAddress;
|
||||
IPAddress function() sfIpAddress_LocalHost;
|
||||
}
|
||||
|
||||
mixin(loadFromSharedLib2("csfml-network", "sfIpAddress",
|
||||
"FromBytes", "FromString", "FromInteger", "GetLocalAddress", "GetPublicAddress", "IsValid", "LocalHost"));
|
||||
"FromBytes", "FromString", "FromInteger", "GetLocalAddress", "GetPublicAddress", "None", "LocalHost"));
|
@ -319,34 +319,34 @@ private:
|
||||
|
||||
extern (C)
|
||||
{
|
||||
typedef void* function() pf_sfPacket_Create;
|
||||
typedef void function(void*) pf_sfPacket_Destroy;
|
||||
typedef void function(void*, void*, size_t) pf_sfPacket_Append;
|
||||
typedef void function(void*) pf_sfPacket_Clear;
|
||||
typedef byte* function(void*) pf_sfPacket_GetData;
|
||||
typedef uint function(void*) pf_sfPacket_GetDataSize;
|
||||
typedef int function(void*) pf_sfPacket_EndOfPacket;
|
||||
typedef int function(void*) pf_sfPacket_CanRead;
|
||||
typedef byte function(void*) pf_sfPacket_ReadInt8;
|
||||
typedef ubyte function(void*) pf_sfPacket_ReadUint8;
|
||||
typedef short function(void*) pf_sfPacket_ReadInt16;
|
||||
typedef ushort function(void*) pf_sfPacket_ReadUint16;
|
||||
typedef int function(void*) pf_sfPacket_ReadInt32;
|
||||
typedef uint function(void*) pf_sfPacket_ReadUint32;
|
||||
typedef float function(void*) pf_sfPacket_ReadFloat;
|
||||
typedef double function(void*) pf_sfPacket_ReadDouble;
|
||||
typedef void function(void*, char*) pf_sfPacket_ReadString;
|
||||
typedef void function(void*, wchar*) pf_sfPacket_ReadWideString;
|
||||
typedef void function(void*, byte) pf_sfPacket_WriteInt8;
|
||||
typedef void function(void*, ubyte) pf_sfPacket_WriteUint8;
|
||||
typedef void function(void*, short) pf_sfPacket_WriteInt16;
|
||||
typedef void function(void*, ushort) pf_sfPacket_WriteUint16;
|
||||
typedef void function(void*, int) pf_sfPacket_WriteInt32;
|
||||
typedef void function(void*, uint) pf_sfPacket_WriteUint32;
|
||||
typedef void function(void*, float) pf_sfPacket_WriteFloat;
|
||||
typedef void function(void*, double) pf_sfPacket_WriteDouble;
|
||||
typedef void function(void*, cchar*) pf_sfPacket_WriteString;
|
||||
typedef void function(void*, cwchar*) pf_sfPacket_WriteWideString;
|
||||
typedef SFMLClass function() pf_sfPacket_Create;
|
||||
typedef void function(SFMLClass) pf_sfPacket_Destroy;
|
||||
typedef void function(SFMLClass, const(void)*, size_t) pf_sfPacket_Append;
|
||||
typedef void function(SFMLClass) pf_sfPacket_Clear;
|
||||
typedef byte* function(SFMLClass) pf_sfPacket_GetData;
|
||||
typedef uint function(SFMLClass) pf_sfPacket_GetDataSize;
|
||||
typedef int function(SFMLClass) pf_sfPacket_EndOfPacket;
|
||||
typedef int function(SFMLClass) pf_sfPacket_CanRead;
|
||||
typedef byte function(SFMLClass) pf_sfPacket_ReadInt8;
|
||||
typedef ubyte function(SFMLClass) pf_sfPacket_ReadUint8;
|
||||
typedef short function(SFMLClass) pf_sfPacket_ReadInt16;
|
||||
typedef ushort function(SFMLClass) pf_sfPacket_ReadUint16;
|
||||
typedef int function(SFMLClass) pf_sfPacket_ReadInt32;
|
||||
typedef uint function(SFMLClass) pf_sfPacket_ReadUint32;
|
||||
typedef float function(SFMLClass) pf_sfPacket_ReadFloat;
|
||||
typedef double function(SFMLClass) pf_sfPacket_ReadDouble;
|
||||
typedef void function(SFMLClass, char*) pf_sfPacket_ReadString;
|
||||
typedef void function(SFMLClass, wchar*) pf_sfPacket_ReadWideString;
|
||||
typedef void function(SFMLClass, byte) pf_sfPacket_WriteInt8;
|
||||
typedef void function(SFMLClass, ubyte) pf_sfPacket_WriteUint8;
|
||||
typedef void function(SFMLClass, short) pf_sfPacket_WriteInt16;
|
||||
typedef void function(SFMLClass, ushort) pf_sfPacket_WriteUint16;
|
||||
typedef void function(SFMLClass, int) pf_sfPacket_WriteInt32;
|
||||
typedef void function(SFMLClass, uint) pf_sfPacket_WriteUint32;
|
||||
typedef void function(SFMLClass, float) pf_sfPacket_WriteFloat;
|
||||
typedef void function(SFMLClass, double) pf_sfPacket_WriteDouble;
|
||||
typedef void function(SFMLClass, cchar*) pf_sfPacket_WriteString;
|
||||
typedef void function(SFMLClass, cwchar*) pf_sfPacket_WriteWideString;
|
||||
|
||||
static pf_sfPacket_Create sfPacket_Create;
|
||||
static pf_sfPacket_Destroy sfPacket_Destroy;
|
||||
|
@ -32,10 +32,10 @@ import dsfml.network.socketudp;
|
||||
import dsfml.system.common;
|
||||
|
||||
/**
|
||||
* Selector TCP allow reading from multiple sockets
|
||||
* without blocking. It's a kind of multiplexer. Use SocketTCP or
|
||||
* SocketUDP aliases.
|
||||
*/
|
||||
* Selector TCP allow reading from multiple sockets
|
||||
* without blocking. It's a kind of multiplexer. Use SocketTCP or
|
||||
* SocketUDP aliases.
|
||||
*/
|
||||
class Selector(T) : DSFMLObject
|
||||
{
|
||||
//Ensure type is correct
|
||||
@ -64,10 +64,10 @@ class Selector(T) : DSFMLObject
|
||||
*/
|
||||
void add(T socket)
|
||||
{
|
||||
if (!(socket.getNativePointer in m_watchedSockets))
|
||||
if (!(socket.nativePointer in m_watchedSockets))
|
||||
{
|
||||
sfSelector_Add(m_ptr, socket.getNativePointer);
|
||||
m_watchedSockets[socket.getNativePointer] = socket;
|
||||
sfSelector_Add(m_ptr, socket.nativePointer);
|
||||
m_watchedSockets[socket.nativePointer] = socket;
|
||||
m_numSocketsWatched++;
|
||||
}
|
||||
}
|
||||
@ -80,10 +80,10 @@ class Selector(T) : DSFMLObject
|
||||
*/
|
||||
void remove(T socket)
|
||||
{
|
||||
if (socket.getNativePointer in m_watchedSockets)
|
||||
if (socket.nativePointer in m_watchedSockets)
|
||||
{
|
||||
sfSelector_Remove(m_ptr, socket.getNativePointer);
|
||||
m_watchedSockets.remove(socket.getNativePointer);
|
||||
sfSelector_Remove(m_ptr, socket.nativePointer);
|
||||
m_watchedSockets.remove(socket.nativePointer);
|
||||
m_numSocketsWatched--;
|
||||
}
|
||||
}
|
||||
@ -139,13 +139,13 @@ private:
|
||||
// External ====================================================================
|
||||
extern (C)
|
||||
{
|
||||
typedef void* function() pf_sfSelector_Create;
|
||||
typedef void function(void*) pf_sfSelector_Destroy;
|
||||
typedef void function(void*, void*) pf_sfSelector_Add;
|
||||
typedef void function(void*, void*) pf_sfSelector_Remove;
|
||||
typedef void function(void*) pf_sfSelector_Clear;
|
||||
typedef uint function(void*, float) pf_sfSelector_Wait;
|
||||
typedef void* function(void*, uint) pf_sfSelector_GetSocketReady;
|
||||
typedef SFMLClass function() pf_sfSelector_Create;
|
||||
typedef void function(SFMLClass) pf_sfSelector_Destroy;
|
||||
typedef void function(SFMLClass, SFMLClass) pf_sfSelector_Add;
|
||||
typedef void function(SFMLClass, SFMLClass) pf_sfSelector_Remove;
|
||||
typedef void function(SFMLClass) pf_sfSelector_Clear;
|
||||
typedef uint function(SFMLClass, float) pf_sfSelector_Wait;
|
||||
typedef SFMLClass function(SFMLClass, uint) pf_sfSelector_GetSocketReady;
|
||||
|
||||
static pf_sfSelector_Create sfSelector_Create;
|
||||
static pf_sfSelector_Destroy sfSelector_Destroy;
|
||||
@ -188,4 +188,3 @@ private:
|
||||
alias Selector!(SocketTCP) SelectorTCP;
|
||||
/// ditto
|
||||
alias Selector!(SocketUDP) SelectorUDP;
|
||||
|
||||
|
@ -93,7 +93,7 @@ class SocketTCP : DSFMLObject
|
||||
*/
|
||||
SocketStatus accept(SocketTCP connected)
|
||||
{
|
||||
void* temp = null;
|
||||
SFMLClass temp = null;
|
||||
SocketStatus ret = sfSocketTCP_Accept(m_ptr, &temp, null);
|
||||
connected.m_ptr = temp;
|
||||
return ret;
|
||||
@ -112,7 +112,7 @@ class SocketTCP : DSFMLObject
|
||||
*/
|
||||
SocketStatus accept(SocketTCP connected, out IPAddress address)
|
||||
{
|
||||
void* temp = null;
|
||||
SFMLClass temp = null;
|
||||
SocketStatus ret = sfSocketTCP_Accept(m_ptr, &temp, &address);
|
||||
connected.m_ptr = temp;
|
||||
return ret;
|
||||
@ -177,7 +177,7 @@ class SocketTCP : DSFMLObject
|
||||
{
|
||||
byte[] dataArray = packetToSend.onSend();
|
||||
m_intermediatePacket.append(dataArray);
|
||||
SocketStatus stat = cast(SocketStatus)sfSocketTCP_SendPacket(m_ptr, m_intermediatePacket.getNativePointer);
|
||||
SocketStatus stat = cast(SocketStatus)sfSocketTCP_SendPacket(m_ptr, m_intermediatePacket.nativePointer);
|
||||
m_intermediatePacket.clear();
|
||||
return stat;
|
||||
}
|
||||
@ -195,7 +195,7 @@ class SocketTCP : DSFMLObject
|
||||
*/
|
||||
SocketStatus receive(Packet packetToReceive)
|
||||
{
|
||||
SocketStatus stat = cast(SocketStatus)sfSocketTCP_ReceivePacket(m_ptr, m_intermediatePacket.getNativePointer);
|
||||
SocketStatus stat = cast(SocketStatus)sfSocketTCP_ReceivePacket(m_ptr, m_intermediatePacket.nativePointer);
|
||||
packetToReceive.onReceive(m_intermediatePacket.getData);
|
||||
m_intermediatePacket.clear();
|
||||
return stat;
|
||||
@ -214,16 +214,9 @@ class SocketTCP : DSFMLObject
|
||||
return cast(bool)sfSocketTCP_IsValid(m_ptr);
|
||||
}
|
||||
|
||||
///
|
||||
bool opEquals(SocketTCP other)
|
||||
{
|
||||
return (other.getNativePointer == this.getNativePointer);
|
||||
}
|
||||
|
||||
|
||||
package:
|
||||
|
||||
this (void* ptr)
|
||||
this (SFMLClass ptr)
|
||||
{
|
||||
super(ptr);
|
||||
m_intermediatePacket = new Packet();
|
||||
@ -236,16 +229,16 @@ private:
|
||||
// External ====================================================================
|
||||
extern (C)
|
||||
{
|
||||
typedef void* function() pf_sfSocketTCP_Create;
|
||||
typedef void function(void*) pf_sfSocketTCP_Destroy;
|
||||
typedef int function(void*, ushort, IPAddress, float) pf_sfSocketTCP_Connect;
|
||||
typedef int function(void*, ushort) pf_sfSocketTCP_Listen;
|
||||
typedef SocketStatus function(void*, void**, IPAddress*) pf_sfSocketTCP_Accept;
|
||||
typedef SocketStatus function(void*, byte*, size_t) pf_sfSocketTCP_Send;
|
||||
typedef SocketStatus function(void*, byte*, size_t, size_t*) pf_sfSocketTCP_Receive;
|
||||
typedef SocketStatus function(void*, void*) pf_sfSocketTCP_SendPacket;
|
||||
typedef SocketStatus function(void*, void*) pf_sfSocketTCP_ReceivePacket;
|
||||
typedef int function(void*) pf_sfSocketTCP_IsValid;
|
||||
typedef SFMLClass function() pf_sfSocketTCP_Create;
|
||||
typedef void function(SFMLClass) pf_sfSocketTCP_Destroy;
|
||||
typedef int function(SFMLClass, ushort, IPAddress, float) pf_sfSocketTCP_Connect;
|
||||
typedef int function(SFMLClass, ushort) pf_sfSocketTCP_Listen;
|
||||
typedef SocketStatus function(SFMLClass, SFMLClass*, IPAddress*) pf_sfSocketTCP_Accept;
|
||||
typedef SocketStatus function(SFMLClass, const(byte)*, size_t) pf_sfSocketTCP_Send;
|
||||
typedef SocketStatus function(SFMLClass, byte*, size_t, size_t*) pf_sfSocketTCP_Receive;
|
||||
typedef SocketStatus function(SFMLClass, SFMLClass) pf_sfSocketTCP_SendPacket;
|
||||
typedef SocketStatus function(SFMLClass, SFMLClass) pf_sfSocketTCP_ReceivePacket;
|
||||
typedef int function(SFMLClass) pf_sfSocketTCP_IsValid;
|
||||
|
||||
static pf_sfSocketTCP_Create sfSocketTCP_Create;
|
||||
static pf_sfSocketTCP_Destroy sfSocketTCP_Destroy;
|
||||
|
@ -33,14 +33,14 @@ import dsfml.network.socketstatus;
|
||||
import dsfml.system.common;
|
||||
|
||||
/**
|
||||
* SocketUDP wraps a socket using UDP protocol to
|
||||
* send data fastly (but with less safety)
|
||||
*/
|
||||
* SocketUDP wraps a socket using UDP protocol to
|
||||
* send data fastly (but with less safety)
|
||||
*/
|
||||
class SocketUDP : DSFMLObject
|
||||
{
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
* Default constructor
|
||||
*/
|
||||
this()
|
||||
{
|
||||
super(sfSocketUDP_Create());
|
||||
@ -135,7 +135,7 @@ class SocketUDP : DSFMLObject
|
||||
{
|
||||
byte[] dataArray = packetToSend.onSend();
|
||||
m_intermediatePacket.append(dataArray);
|
||||
SocketStatus stat = cast(SocketStatus)sfSocketUDP_SendPacket(m_ptr, m_intermediatePacket.getNativePointer, address, port);
|
||||
SocketStatus stat = cast(SocketStatus)sfSocketUDP_SendPacket(m_ptr, m_intermediatePacket.nativePointer, address, port);
|
||||
m_intermediatePacket.clear();
|
||||
return stat;
|
||||
}
|
||||
@ -154,7 +154,7 @@ class SocketUDP : DSFMLObject
|
||||
*/
|
||||
SocketStatus receive(Packet packetToReceive, out IPAddress address)
|
||||
{
|
||||
SocketStatus ret = sfSocketUDP_ReceivePacket(m_ptr, m_intermediatePacket.getNativePointer, &address);
|
||||
SocketStatus ret = sfSocketUDP_ReceivePacket(m_ptr, m_intermediatePacket.nativePointer, &address);
|
||||
packetToReceive.onReceive(m_intermediatePacket.getData);
|
||||
m_intermediatePacket.clear();
|
||||
return ret;
|
||||
@ -185,14 +185,8 @@ class SocketUDP : DSFMLObject
|
||||
return m_port;
|
||||
}
|
||||
|
||||
///
|
||||
bool opEquals(SocketUDP other)
|
||||
{
|
||||
return (other.getNativePointer == this.getNativePointer);
|
||||
}
|
||||
|
||||
package:
|
||||
this (void* ptr)
|
||||
this (SFMLClass ptr)
|
||||
{
|
||||
super(ptr);
|
||||
m_intermediatePacket = new Packet();
|
||||
@ -206,15 +200,15 @@ private:
|
||||
|
||||
extern (C)
|
||||
{
|
||||
typedef void* function() pf_sfSocketUDP_Create;
|
||||
typedef void function(void*) pf_sfSocketUDP_Destroy;
|
||||
typedef int function(void*, ushort) pf_sfSocketUDP_Bind;
|
||||
typedef int function(void*, ushort) pf_sfSocketUDP_Unbind;
|
||||
typedef SocketStatus function(void*, byte*, size_t, IPAddress, ushort) pf_sfSocketUDP_Send;
|
||||
typedef SocketStatus function(void*, byte*, size_t, size_t*, IPAddress*) pf_sfSocketUDP_Receive;
|
||||
typedef SocketStatus function(void*, void*, IPAddress, ushort) pf_sfSocketUDP_SendPacket;
|
||||
typedef SocketStatus function(void*, void*, IPAddress*) pf_sfSocketUDP_ReceivePacket;
|
||||
typedef int function(void*) pf_sfSocketUDP_IsValid;
|
||||
typedef SFMLClass function() pf_sfSocketUDP_Create;
|
||||
typedef void function(SFMLClass) pf_sfSocketUDP_Destroy;
|
||||
typedef int function(SFMLClass, ushort) pf_sfSocketUDP_Bind;
|
||||
typedef int function(SFMLClass, ushort) pf_sfSocketUDP_Unbind;
|
||||
typedef SocketStatus function(SFMLClass, byte*, size_t, IPAddress, ushort) pf_sfSocketUDP_Send;
|
||||
typedef SocketStatus function(SFMLClass, byte*, size_t, size_t*, IPAddress*) pf_sfSocketUDP_Receive;
|
||||
typedef SocketStatus function(SFMLClass, SFMLClass, IPAddress, ushort) pf_sfSocketUDP_SendPacket;
|
||||
typedef SocketStatus function(SFMLClass, SFMLClass, IPAddress*) pf_sfSocketUDP_ReceivePacket;
|
||||
typedef int function(SFMLClass) pf_sfSocketUDP_IsValid;
|
||||
|
||||
static pf_sfSocketUDP_Create sfSocketUDP_Create;
|
||||
static pf_sfSocketUDP_Destroy sfSocketUDP_Destroy;
|
||||
|
@ -38,6 +38,10 @@ package
|
||||
alias immutable(wchar) iwchar;
|
||||
alias immutable(dchar) idchar;
|
||||
alias const(char)[] cstring;
|
||||
|
||||
// alias immutable(void) ivoid;
|
||||
alias const(void) cvoid;
|
||||
typedef void* SFMLClass;
|
||||
}
|
||||
|
||||
// used to mixin code function
|
||||
@ -78,25 +82,34 @@ string loadDerivedFromSharedLib(S...)(string lib, string baseClass, string deriv
|
||||
|
||||
foreach(fname; fnames)
|
||||
{
|
||||
res ~= "\t" ~ baseClass ~ "_" ~ fname ~ " = " ~ "cast(typeof(" ~ baseClass ~ "_" ~ fname ~ ")) dll.getSymbol(\"" ~ derivedClass ~ "_" ~ fname ~ "\");";
|
||||
res ~= "\t" ~ baseClass ~ "_" ~ fname ~ " = " ~ "cast(typeof(" ~ baseClass ~ "_" ~ fname ~ ")) dll.getSymbol(\"" ~ derivedClass ~ "_" ~ fname ~ "\");\n";
|
||||
}
|
||||
return res ~ "}\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* Base class for all DSFML classes.
|
||||
*/
|
||||
* Base class for all DSFML classes.
|
||||
*/
|
||||
class DSFMLObject
|
||||
{
|
||||
private:
|
||||
bool m_preventDelete;
|
||||
|
||||
protected:
|
||||
void* m_ptr;
|
||||
SFMLClass m_ptr;
|
||||
|
||||
abstract void dispose();
|
||||
|
||||
public:
|
||||
/// get the underlying C pointer
|
||||
@property final SFMLClass nativePointer()
|
||||
{
|
||||
return m_ptr;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
this(void* ptr, bool preventDelete = false)
|
||||
this(SFMLClass ptr, bool preventDelete = false)
|
||||
{
|
||||
m_ptr = ptr;
|
||||
m_preventDelete = preventDelete;
|
||||
@ -110,18 +123,17 @@ public:
|
||||
m_ptr = m_ptr.init;
|
||||
}
|
||||
|
||||
abstract void dispose();
|
||||
|
||||
void* getNativePointer()
|
||||
{
|
||||
return m_ptr;
|
||||
}
|
||||
|
||||
void setHandled(bool handled)
|
||||
final void setHandled(bool handled)
|
||||
{
|
||||
m_preventDelete = handled;
|
||||
}
|
||||
|
||||
override bool opEquals(Object o)
|
||||
{
|
||||
return (m_ptr == (cast(DSFMLObject)o).nativePointer);
|
||||
}
|
||||
|
||||
protected invariant()
|
||||
{
|
||||
assert(m_ptr !is null, "Problem occurs with a null pointer in " ~ this.toString);
|
||||
|
@ -59,9 +59,9 @@ class Context : DSFMLObject
|
||||
private:
|
||||
static extern(C)
|
||||
{
|
||||
void* function() sfContext_Create;
|
||||
void function(void*) sfContext_Destroy;
|
||||
void function(void*, bool) sfContext_SetActive;
|
||||
SFMLClass function() sfContext_Create;
|
||||
void function(SFMLClass) sfContext_Destroy;
|
||||
void function(SFMLClass, bool) sfContext_SetActive;
|
||||
}
|
||||
|
||||
static this()
|
||||
|
@ -118,7 +118,7 @@ class Input : DSFMLObject
|
||||
return sfInput_GetJoystickAxis(m_ptr, joyId, axis);
|
||||
}
|
||||
|
||||
this(void* input)
|
||||
this(SFMLClass input)
|
||||
{
|
||||
super(input, true);
|
||||
}
|
||||
@ -134,12 +134,12 @@ private:
|
||||
|
||||
static extern (C)
|
||||
{
|
||||
int function(void*, KeyCode) sfInput_IsKeyDown;
|
||||
int function(void*, MouseButtons) sfInput_IsMouseButtonDown;
|
||||
int function(void*, uint, uint) sfInput_IsJoystickButtonDown;
|
||||
int function(void*) sfInput_GetMouseX;
|
||||
int function(void*) sfInput_GetMouseY;
|
||||
float function(void*, uint, JoyAxis) sfInput_GetJoystickAxis;
|
||||
int function(SFMLClass, KeyCode) sfInput_IsKeyDown;
|
||||
int function(SFMLClass, MouseButtons) sfInput_IsMouseButtonDown;
|
||||
int function(SFMLClass, uint, uint) sfInput_IsJoystickButtonDown;
|
||||
int function(SFMLClass) sfInput_GetMouseX;
|
||||
int function(SFMLClass) sfInput_GetMouseY;
|
||||
float function(SFMLClass, uint, JoyAxis) sfInput_GetJoystickAxis;
|
||||
}
|
||||
|
||||
static this()
|
||||
|
Loading…
Reference in New Issue
Block a user