dsfml.graphics

2D graphics module: sprites, text, shapes, etc.

Modules

blendmode
module dsfml.graphics.blendmode

$(U BlendMode) is a structure that represents a blend mode. A blend mode determines how the colors of an object you draw are mixed with the colors that are already in the buffer.

circleshape
module dsfml.graphics.circleshape

This class inherits all the functions of $(TRANSFORMABLE_LINK) (position, rotation, scale, bounds, ...) as well as the functions of $(SHAPE_LINK) (outline, color, texture, ...).

color
module dsfml.graphics.color

$(U Color) is a simple color structure composed of 4 components:

  • Red
  • Green
  • Blue
  • Alpha (opacity)
convexshape
module dsfml.graphics.convexshape

This class inherits all the functions of $(TRANSFORMABLE_LINK) (position, rotation, scale, bounds, ...) as well as the functions of $(SHAPE_LINK) (outline, color, texture, ...).

drawable
module dsfml.graphics.drawable

$(U Drawable) is a very simple base interface that allows objects of derived classes to be drawn to a RenderTarget.

font
module dsfml.graphics.font

Fonts can be loaded from a file, from memory or from a custom stream, and supports the most common types of fonts. See the loadFromFile function for the complete list of supported formats.

glsl
module dsfml.graphics.glsl

* The glsl module contains types that match their equivalents in GLSL, the * OpenGL shading language. These types are exclusively used by the * $(SHADER_LINK) class. * * Types that already exist in DSFML, such as $(VECTOR2_LINK) and * $(VECTOR3_LINK), are reused as aliases, so you can use the types in this * module as well as the original ones. * Others are newly defined, such as Vec4 or Mat3. Their actual type is an * implementation detail and should not be used. * * All vector types support a default constructor that initializes every * component to zero, in addition to a constructor with one parameter for each * component. * The components are stored in member variables called x, y, z, and w. * * All matrix types support a constructor with a float[] parameter of the * appropriate size (that is, 9 in a 3x3 matrix, 16 in a 4x4 matrix). * Furthermore, they can be converted from $(TRANSFORM_LINK) objects.

glyph
module dsfml.graphics.glyph

A glyph is the visual representation of a character.

image
module dsfml.graphics.image

$(U Image) is an abstraction to manipulate images as bidimensional arrays of pixels. The class provides functions to load, read, write and save pixels, as well as many other useful functions.

primitivetype
module dsfml.graphics.primitivetype

The module containing the list of usable primitives for drawing.

rect
module dsfml.graphics.rect

A rectangle is defined by its top-left corner and its size. It is a very simple structure defined for convenience, so its member variables (left, top, width, and height) are public and can be accessed directly, just like the vector structures ($(VECTOR2_LINK) and $(VECTOR3_LINK)).

rectangleshape
module dsfml.graphics.rectangleshape

This class inherits all the functions of $(TRANSFORMABLE_LINK) (position, rotation, scale, bounds, ...) as well as the functions of $(SHAPE_LINK) (outline, color, texture, ...).

renderstates
module dsfml.graphics.renderstates

There are four global states that can be applied to the drawn objects:

  • the blend mode: how pixels of the object are blended with the background
  • the transform: how the object is positioned/rotated/scaled
  • the texture: what image is mapped to the object
  • the shader: what custom effect is applied to the object
rendertarget
module dsfml.graphics.rendertarget

$(U RenderTarget) defines the common behaviour of all the 2D render targets usable in the graphics module. It makes it possible to draw 2D entities like sprites, shapes, text without using any OpenGL command directly.

rendertexture
module dsfml.graphics.rendertexture

$(U RenderTexture) is the little brother of $(RENDERWINDOW_LINK). It implements the same 2D drawing and OpenGL-related functions (see their base class $(RENDERTARGET_LINK) for more details), the difference is that the result is stored in an off-screen texture rather than being show in a window.

renderwindow
module dsfml.graphics.renderwindow

$(U RenderWindow) is the main class of the Graphics package. It defines an OS window that can be painted using the other classes of the graphics module.

shader
module dsfml.graphics.shader

Shaders are programs written using a specific language, executed directly by the graphics card and allowing one to apply real-time operations to the rendered entities.

shape
module dsfml.graphics.shape

$(U Shape) is a drawable class that allows to define and display a custom convex shape on a render target.

sprite
module dsfml.graphics.sprite

$(U Sprite) is a drawable class that allows to easily display a texture (or a part of it) on a render target.

text
module dsfml.graphics.text

$(U Text) is a drawable class that allows one to easily display some text with a custom style and color on a render target.

texture
module dsfml.graphics.texture

$(U Texture) stores pixels that can be drawn, with a sprite for example. A texture lives in the graphics card memory, therefore it is very fast to draw a texture to a render target, or copy a render target to a texture (the graphics card can access both directly).

transform
module dsfml.graphics.transform

A $(U Transform) specifies how to translate, rotate, scale, shear, project, whatever things. In mathematical terms, it defines how to transform a coordinate system into another.

transformable
module dsfml.graphics.transformable

The interface and template are provided for convenience, on top of $(TRANSFORM_LINK).

vertex
module dsfml.graphics.vertex

A vertex is an improved point. It has a position and other extra attributes that will be used for drawing: in DSFML, vertices also have a color and a pair of texture coordinates.

vertexarray
module dsfml.graphics.vertexarray

$(U VertexArray) is a very simple wrapper around a dynamic array of vertices and a primitives type.

view
module dsfml.graphics.view

$(U View) defines a camera in the 2D scene. This is a very powerful concept: you can scroll, rotate or zoom the entire scene without altering the way that your drawable objects are drawn.

Public Imports

dsfml.window
public import dsfml.window;
dsfml.graphics.blendmode
public import dsfml.graphics.blendmode;
dsfml.graphics.circleshape
public import dsfml.graphics.circleshape;
dsfml.graphics.color
public import dsfml.graphics.color;
dsfml.graphics.convexshape
public import dsfml.graphics.convexshape;
dsfml.graphics.drawable
public import dsfml.graphics.drawable;
dsfml.graphics.font
public import dsfml.graphics.font;
dsfml.graphics.glyph
public import dsfml.graphics.glyph;
dsfml.graphics.image
public import dsfml.graphics.image;
dsfml.graphics.primitivetype
public import dsfml.graphics.primitivetype;
dsfml.graphics.rect
public import dsfml.graphics.rect;
dsfml.graphics.rectangleshape
public import dsfml.graphics.rectangleshape;
dsfml.graphics.renderstates
public import dsfml.graphics.renderstates;
dsfml.graphics.rendertarget
public import dsfml.graphics.rendertarget;
dsfml.graphics.rendertexture
public import dsfml.graphics.rendertexture;
dsfml.graphics.renderwindow
public import dsfml.graphics.renderwindow;
dsfml.graphics.shader
public import dsfml.graphics.shader;
dsfml.graphics.shape
public import dsfml.graphics.shape;
dsfml.graphics.sprite
public import dsfml.graphics.sprite;
dsfml.graphics.text
public import dsfml.graphics.text;
dsfml.graphics.texture
public import dsfml.graphics.texture;
dsfml.graphics.transform
public import dsfml.graphics.transform;
dsfml.graphics.transformable
public import dsfml.graphics.transformable;
dsfml.graphics.vertex
public import dsfml.graphics.vertex;
dsfml.graphics.vertexarray
public import dsfml.graphics.vertexarray;
dsfml.graphics.view
public import dsfml.graphics.view;

Meta