mirror of
https://github.com/SFML/SFML.git
synced 2024-11-29 06:41:05 +08:00
+ toString for Color
* IDrawable.render now correctly takes an IRenderTarget git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1446 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
parent
ef216acc5f
commit
64fb9a139a
@ -26,38 +26,21 @@
|
|||||||
|
|
||||||
module dsfml.graphics.color;
|
module dsfml.graphics.color;
|
||||||
|
|
||||||
|
import std.string;
|
||||||
|
|
||||||
|
alias RGBA Color; // standard Color is RGBA
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Color is an utility structure for manipulating colors
|
* Color is an utility structure for manipulating colors
|
||||||
*/
|
*/
|
||||||
struct Color
|
struct RGBA
|
||||||
{
|
{
|
||||||
ubyte r; /// Red component
|
align(1):
|
||||||
ubyte g; /// Green component
|
ubyte r; /// Red component
|
||||||
ubyte b; /// Blue component
|
ubyte g; /// Green component
|
||||||
ubyte a = 255; /// Alpha (transparency) component
|
ubyte b; /// Blue component
|
||||||
|
ubyte a = 255; /// Alpha (transparency) component, 255 = opaque
|
||||||
|
|
||||||
/**
|
|
||||||
* Construct the color from its 4 RGBA components
|
|
||||||
*
|
|
||||||
* Params:
|
|
||||||
* r = Red component (0 .. 255)
|
|
||||||
* g = Green component (0 .. 255)
|
|
||||||
* b = Blue component (0 .. 255)
|
|
||||||
* a = Alpha component (0 .. 255) (255 by default)
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
static Color opCall(ubyte r, ubyte g, ubyte b, ubyte a = 255)
|
|
||||||
{
|
|
||||||
Color c;
|
|
||||||
c.r = r;
|
|
||||||
c.g = g;
|
|
||||||
c.b = b;
|
|
||||||
c.a = a;
|
|
||||||
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
/**
|
/**
|
||||||
* Operator == and != overload to compare two colors
|
* Operator == and != overload to compare two colors
|
||||||
*/
|
*/
|
||||||
@ -70,8 +53,8 @@ struct Color
|
|||||||
&& (a == color2.a);
|
&& (a == color2.a);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Operator + overload to add two colors
|
* Operator + overload to add two colors
|
||||||
*/
|
*/
|
||||||
Color opAdd(Color color2)
|
Color opAdd(Color color2)
|
||||||
{
|
{
|
||||||
ubyte r = this.r + color2.r > 255 ? 255 : cast(ubyte) (this.r + color2.r);
|
ubyte r = this.r + color2.r > 255 ? 255 : cast(ubyte) (this.r + color2.r);
|
||||||
@ -83,8 +66,8 @@ struct Color
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Operator += overload
|
* Operator += overload
|
||||||
*/
|
*/
|
||||||
Color opAddAssign(Color color2)
|
Color opAddAssign(Color color2)
|
||||||
{
|
{
|
||||||
this.r = this.r + color2.r > 255 ? 255 : cast(ubyte) (this.r + color2.r);
|
this.r = this.r + color2.r > 255 ? 255 : cast(ubyte) (this.r + color2.r);
|
||||||
@ -96,8 +79,8 @@ struct Color
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Operator * overload to modulate colors
|
* Operator * overload to modulate colors
|
||||||
*/
|
*/
|
||||||
Color opMul(Color color2)
|
Color opMul(Color color2)
|
||||||
{
|
{
|
||||||
ubyte r = cast(ubyte) (this.r * color2.r / 255);
|
ubyte r = cast(ubyte) (this.r * color2.r / 255);
|
||||||
@ -109,8 +92,8 @@ struct Color
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Operator *= overload
|
* Operator *= overload
|
||||||
*/
|
*/
|
||||||
Color opMulAssign(Color color2)
|
Color opMulAssign(Color color2)
|
||||||
{
|
{
|
||||||
this.r = cast(ubyte) (this.r * color2.r / 255);
|
this.r = cast(ubyte) (this.r * color2.r / 255);
|
||||||
@ -121,12 +104,20 @@ struct Color
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const Color BLACK = {0, 0, 0}; /// Black predefined color
|
string toString()
|
||||||
static const Color WHITE = {255, 255, 255}; /// White predefined color
|
{
|
||||||
static const Color RED = {255, 0, 0}; /// Red predefined color
|
return std.string.format("(%d,%d,%d,%d)", r,g,b,a);
|
||||||
static const Color GREEN = {0, 255, 0}; /// Green predefined color
|
}
|
||||||
static const Color BLUE = {0, 0, 255}; /// Blue predefined color
|
|
||||||
static const Color YELLOW = {255, 0, 255}; /// Yellow predefined color
|
static immutable
|
||||||
static const Color MAGENTA = {255, 0, 255}; /// Magenta predefined color
|
{
|
||||||
static const Color CYAN = {0, 255, 255}; /// Cyan predefined color
|
Color BLACK = Color(0, 0, 0); /// Black predefined color
|
||||||
|
Color WHITE = Color(255, 255, 255); /// White predefined color
|
||||||
|
Color RED = Color(255, 0, 0); /// Red predefined color
|
||||||
|
Color GREEN = Color(0, 255, 0); /// Green predefined color
|
||||||
|
Color BLUE = Color(0, 0, 255); /// Blue predefined color
|
||||||
|
Color YELLOW = Color(255, 0, 255); /// Yellow predefined color
|
||||||
|
Color MAGENTA = Color(255, 0, 255); /// Magenta predefined color
|
||||||
|
Color CYAN = Color(0, 255, 255); /// Cyan predefined color
|
||||||
|
}
|
||||||
}
|
}
|
@ -29,6 +29,7 @@ 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.irendertarget;
|
||||||
import dsfml.graphics.idrawable,
|
import dsfml.graphics.idrawable,
|
||||||
dsfml.graphics.color,
|
dsfml.graphics.color,
|
||||||
dsfml.graphics.blendmode,
|
dsfml.graphics.blendmode,
|
||||||
@ -195,24 +196,14 @@ public:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void render(RenderWindow window)
|
void render(IRenderTarget window)
|
||||||
{
|
{
|
||||||
sfRenderWindow_DrawThis(window.getNativePointer(), m_ptr);
|
sfRenderWindow_DrawThis((cast(DSFMLObject)window).getNativePointer(), m_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void renderWithShader(RenderWindow window, Shader shader)
|
void renderWithShader(IRenderTarget window, Shader shader)
|
||||||
{
|
{
|
||||||
sfRenderWindow_DrawThisWithShader(window.getNativePointer, m_ptr, shader.getNativePointer);
|
sfRenderWindow_DrawThisWithShader((cast(DSFMLObject)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()
|
||||||
|
@ -1,33 +1,34 @@
|
|||||||
/*
|
/*
|
||||||
* DSFML - SFML Library wrapper for the D programming language.
|
* DSFML - SFML Library wrapper for the D programming language.
|
||||||
* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com)
|
* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com)
|
||||||
* Copyright (C) 2010 Andreas Hollandt
|
* Copyright (C) 2010 Andreas Hollandt
|
||||||
*
|
*
|
||||||
* This software is provided 'as-is', without any express or
|
* This software is provided 'as-is', without any express or
|
||||||
* implied warranty. In no event will the authors be held
|
* implied warranty. In no event will the authors be held
|
||||||
* liable for any damages arising from the use of this software.
|
* liable for any damages arising from the use of this software.
|
||||||
*
|
*
|
||||||
* Permission is granted to anyone to use this software for any purpose,
|
* Permission is granted to anyone to use this software for any purpose,
|
||||||
* including commercial applications, and to alter it and redistribute
|
* including commercial applications, and to alter it and redistribute
|
||||||
* it freely, subject to the following restrictions:
|
* it freely, subject to the following restrictions:
|
||||||
*
|
*
|
||||||
* 1. The origin of this software must not be misrepresented;
|
* 1. The origin of this software must not be misrepresented;
|
||||||
* you must not claim that you wrote the original software.
|
* you must not claim that you wrote the original software.
|
||||||
* If you use this software in a product, an acknowledgment
|
* If you use this software in a product, an acknowledgment
|
||||||
* in the product documentation would be appreciated but
|
* in the product documentation would be appreciated but
|
||||||
* is not required.
|
* is not required.
|
||||||
*
|
*
|
||||||
* 2. Altered source versions must be plainly marked as such,
|
* 2. Altered source versions must be plainly marked as such,
|
||||||
* and must not be misrepresented as being the original software.
|
* and must not be misrepresented as being the original software.
|
||||||
*
|
*
|
||||||
* 3. This notice may not be removed or altered from any
|
* 3. This notice may not be removed or altered from any
|
||||||
* source distribution.
|
* source distribution.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
module dsfml.graphics.idrawable;
|
module dsfml.graphics.idrawable;
|
||||||
|
|
||||||
import dsfml.system.vector2;
|
import dsfml.system.vector2;
|
||||||
|
|
||||||
|
import dsfml.graphics.irendertarget;
|
||||||
import dsfml.graphics.color,
|
import dsfml.graphics.color,
|
||||||
dsfml.graphics.blendmode,
|
dsfml.graphics.blendmode,
|
||||||
dsfml.graphics.renderwindow,
|
dsfml.graphics.renderwindow,
|
||||||
@ -36,276 +37,259 @@ import dsfml.graphics.color,
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for drawable object
|
* Interface for drawable object
|
||||||
*
|
*
|
||||||
* Shape, Text and Sprite implement IDrawable
|
* Shape, Text and Sprite implement IDrawable
|
||||||
*/
|
*/
|
||||||
interface IDrawable
|
interface IDrawable
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Set the left position of the object
|
* Set the left position of the object
|
||||||
*
|
*
|
||||||
* Params:
|
* Params:
|
||||||
* x = New left coordinate
|
* x = New left coordinate
|
||||||
*/
|
*/
|
||||||
void setX(float x);
|
void setX(float x);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the top position of the object
|
* Set the top position of the object
|
||||||
*
|
*
|
||||||
* Params:
|
* Params:
|
||||||
* y = New top coordinate
|
* y = New top coordinate
|
||||||
*/
|
*/
|
||||||
void setY(float y);
|
void setY(float y);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the position of the object
|
* Set the position of the object
|
||||||
*
|
*
|
||||||
* Params:
|
* Params:
|
||||||
* x = New left coordinate
|
* x = New left coordinate
|
||||||
* y = New top coordinate
|
* y = New top coordinate
|
||||||
*/
|
*/
|
||||||
void setPosition(float x, float y);
|
void setPosition(float x, float y);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the position of the object
|
* Set the position of the object
|
||||||
*
|
*
|
||||||
* Params:
|
* Params:
|
||||||
* vec = new position
|
* vec = new position
|
||||||
*/
|
*/
|
||||||
void setPosition(Vector2f vec);
|
void setPosition(Vector2f vec);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the horizontal scale of the object
|
* Set the horizontal scale of the object
|
||||||
*
|
*
|
||||||
* Params:
|
* Params:
|
||||||
* scale = New horizontal scale (Strictly positive)
|
* scale = New horizontal scale (Strictly positive)
|
||||||
*/
|
*/
|
||||||
void setScaleX(float scale);
|
void setScaleX(float scale);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the vertical scale of the object
|
* Set the vertical scale of the object
|
||||||
*
|
*
|
||||||
* Params:
|
* Params:
|
||||||
* scale = New vertical scale (Strictly positive)
|
* scale = New vertical scale (Strictly positive)
|
||||||
*/
|
*/
|
||||||
void setScaleY(float scale);
|
void setScaleY(float scale);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the scale of the object
|
* Set the scale of the object
|
||||||
*
|
*
|
||||||
* Params:
|
* Params:
|
||||||
* scaleX = New horizontal scale
|
* scaleX = New horizontal scale
|
||||||
* scaleY = New vertical scale
|
* scaleY = New vertical scale
|
||||||
*/
|
*/
|
||||||
void setScale(float scaleX, float scaleY);
|
void setScale(float scaleX, float scaleY);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the scale of the object
|
* Set the scale of the object
|
||||||
*
|
*
|
||||||
* Params:
|
* Params:
|
||||||
* scale = new scale
|
* scale = new scale
|
||||||
*/
|
*/
|
||||||
void setScale(Vector2f scale);
|
void setScale(Vector2f scale);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the origin of the object, in coordinates relative to the
|
* Set the origin of the object, in coordinates relative to the
|
||||||
* top-left of the object (take 2 values).
|
* top-left of the object (take 2 values).
|
||||||
* The default origin is (0, 0)
|
* The default origin is (0, 0)
|
||||||
*
|
*
|
||||||
* Params:
|
* Params:
|
||||||
* originX : X coordinate of the origin
|
* originX : X coordinate of the origin
|
||||||
* originY : Y coordinate of the origin
|
* originY : Y coordinate of the origin
|
||||||
*/
|
*/
|
||||||
void setOrigin(float originX, float originY);
|
void setOrigin(float originX, float originY);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the origin of the object, in coordinates relative to the
|
* Set the origin of the object, in coordinates relative to the
|
||||||
* top-left of the object (take a 2D vector).
|
* top-left of the object (take a 2D vector).
|
||||||
* The default origin is (0, 0)
|
* The default origin is (0, 0)
|
||||||
*
|
*
|
||||||
* Params:
|
* Params:
|
||||||
* origin : New origin
|
* origin : New origin
|
||||||
*/
|
*/
|
||||||
void setOrigin(Vector2f origin);
|
void setOrigin(Vector2f origin);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the rotation of the object
|
* Set the rotation of the object
|
||||||
*
|
*
|
||||||
* Params:
|
* Params:
|
||||||
* angle = Angle of rotation, in degree
|
* angle = Angle of rotation, in degree
|
||||||
*/
|
*/
|
||||||
void setRotation(float angle);
|
void setRotation(float angle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the color
|
* Set the color
|
||||||
*
|
*
|
||||||
* Params:
|
* Params:
|
||||||
* c = New color
|
* c = New color
|
||||||
*/
|
*/
|
||||||
void setColor(Color c);
|
void setColor(Color c);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the blending mode for the object.
|
* Set the blending mode for the object.
|
||||||
* The default blend mode is Blend.Alpha
|
* The default blend mode is Blend.Alpha
|
||||||
*
|
*
|
||||||
* Params:
|
* Params:
|
||||||
* mode = New blending mode
|
* mode = New blending mode
|
||||||
*/
|
*/
|
||||||
void setBlendMode(BlendMode mode);
|
void setBlendMode(BlendMode mode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the position of the object
|
* Get the position of the object
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* Current position
|
* Current position
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Vector2f getPosition();
|
Vector2f getPosition();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current scale of the object
|
* Get the current scale of the object
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* Current scale
|
* Current scale
|
||||||
*/
|
*/
|
||||||
Vector2f getScale();
|
Vector2f getScale();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the origin of the object
|
* Get the origin of the object
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* Current position of the origin
|
* Current position of the origin
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Vector2f getOrigin();
|
Vector2f getOrigin();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the rotation angle of the object
|
* Get the rotation angle of the object
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* Angle of rotation, in degree
|
* Angle of rotation, in degree
|
||||||
*/
|
*/
|
||||||
float getRotation();
|
float getRotation();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the color of the string
|
* Get the color of the string
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* Current color
|
* Current color
|
||||||
*/
|
*/
|
||||||
Color getColor();
|
Color getColor();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current blending mode
|
* Get the current blending mode
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* Current blending mode
|
* Current blending mode
|
||||||
*/
|
*/
|
||||||
BlendMode getBlendMode();
|
BlendMode getBlendMode();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rotate the object
|
* Rotate the object
|
||||||
* Angle is added to the current orientation of the objet
|
* Angle is added to the current orientation of the objet
|
||||||
*
|
*
|
||||||
* Params:
|
* Params:
|
||||||
* angle = Angle of rotation in degree
|
* angle = Angle of rotation in degree
|
||||||
*/
|
*/
|
||||||
void rotate(float angle);
|
void rotate(float angle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Move the object
|
* Move the object
|
||||||
* New offset is added to object current position
|
* New offset is added to object current position
|
||||||
*
|
*
|
||||||
* Params:
|
* Params:
|
||||||
* offsetX = Offset on the X axis
|
* offsetX = Offset on the X axis
|
||||||
* offsetY = Offset on the Y axis
|
* offsetY = Offset on the Y axis
|
||||||
*/
|
*/
|
||||||
void move(float offsetX, float offsetY);
|
void move(float offsetX, float offsetY);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Move the object
|
* Move the object
|
||||||
* New offset is added to object current position
|
* New offset is added to object current position
|
||||||
*
|
*
|
||||||
* Params:
|
* Params:
|
||||||
* offset = Amount of units to move the object of
|
* offset = Amount of units to move the object of
|
||||||
*/
|
*/
|
||||||
void move(Vector2f offset);
|
void move(Vector2f offset);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the scale of the object
|
* Set the scale of the object
|
||||||
*
|
*
|
||||||
* Params:
|
* Params:
|
||||||
* scaleX = New horizontal scale (Strictly positive)
|
* scaleX = New horizontal scale (Strictly positive)
|
||||||
* scaleY = New vertical scale (Strictly positive)
|
* scaleY = New vertical scale (Strictly positive)
|
||||||
*/
|
*/
|
||||||
void scale(float scaleX, float scaleY);
|
void scale(float scaleX, float scaleY);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scale the object (take a 2D vector)
|
* Scale the object (take a 2D vector)
|
||||||
*
|
*
|
||||||
* Params:
|
* Params:
|
||||||
* factor = Scaling factors (both values must be strictly positive)
|
* factor = Scaling factors (both values must be strictly positive)
|
||||||
*/
|
*/
|
||||||
void scale(Vector2f factor);
|
void scale(Vector2f factor);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transform a point from global coordinates into local coordinates
|
* Transform a point from global coordinates into local coordinates
|
||||||
* (ie it applies the inverse of object's origin, translation, rotation and scale to the point)
|
* (ie it applies the inverse of object's origin, translation, rotation and scale to the point)
|
||||||
*
|
*
|
||||||
* Params:
|
* Params:
|
||||||
* point = Point to transform
|
* point = Point to transform
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* Transformed point
|
* Transformed point
|
||||||
*/
|
*/
|
||||||
Vector2f tranformToLocal(Vector2f point);
|
Vector2f tranformToLocal(Vector2f point);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transform a point from local coordinates into global coordinates
|
* Transform a point from local coordinates into global coordinates
|
||||||
* (ie it applies the inverse of object's origin, translation, rotation and scale to the point)
|
* (ie it applies the inverse of object's origin, translation, rotation and scale to the point)
|
||||||
*
|
*
|
||||||
* Params:
|
* Params:
|
||||||
* point = Point to transform
|
* point = Point to transform
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* Transformed point
|
* Transformed point
|
||||||
*/
|
*/
|
||||||
Vector2f tranformToGlobal(Vector2f point);
|
Vector2f tranformToGlobal(Vector2f point);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render the specific geometry of the object
|
* Render the specific geometry of the object
|
||||||
*
|
|
||||||
* Params:
|
|
||||||
* window = Target into which render the object
|
|
||||||
*/
|
|
||||||
void render(RenderWindow window);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Render the specific geometry of the object with a shader
|
|
||||||
*
|
*
|
||||||
* Params:
|
* Params:
|
||||||
* window = Render target
|
* window = Target into which render the object
|
||||||
* shader = Shader to use
|
|
||||||
*/
|
*/
|
||||||
void renderWithShader(RenderWindow window, Shader shader);
|
void render(IRenderTarget window);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render the specific geometry of the object
|
* Render the specific geometry of the object with a shader
|
||||||
*
|
|
||||||
* Params:
|
|
||||||
* image = Target into which render the object
|
|
||||||
*/
|
|
||||||
void render(RenderImage image);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Render the specific geometry of the object with a shader
|
|
||||||
*
|
*
|
||||||
* Params:
|
* Params:
|
||||||
* image = Render target
|
* window = Render target
|
||||||
* shader = Shader to use
|
* shader = Shader to use
|
||||||
*/
|
*/
|
||||||
void renderWithShader(RenderImage image, Shader shader);
|
void renderWithShader(IRenderTarget window, Shader shader);
|
||||||
}
|
}
|
@ -98,7 +98,7 @@ public:
|
|||||||
this(ubyte[] data)
|
this(ubyte[] data)
|
||||||
{
|
{
|
||||||
if (data is null || data.length == 0)
|
if (data is null || data.length == 0)
|
||||||
throw new LoadingException("LoadingException : Memory stream is invalid.");
|
throw new LoadingException("Memory stream is invalid.");
|
||||||
|
|
||||||
super(sfImage_CreateFromMemory(data.ptr, data.length));
|
super(sfImage_CreateFromMemory(data.ptr, data.length));
|
||||||
}
|
}
|
||||||
@ -117,7 +117,7 @@ public:
|
|||||||
this(uint width, uint height, ubyte[] data)
|
this(uint width, uint height, ubyte[] data)
|
||||||
{
|
{
|
||||||
if (width * height * 4 != data.length)
|
if (width * height * 4 != data.length)
|
||||||
throw new LoadingException("LoadingException : Pixels array length doesn't match the specified size.");
|
throw new LoadingException("Pixels array length doesn't match the specified size.");
|
||||||
|
|
||||||
super(sfImage_CreateFromPixels(width, height, data.ptr));
|
super(sfImage_CreateFromPixels(width, height, data.ptr));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user