$(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.
This class inherits all the functions of $(TRANSFORMABLE_LINK) (position, rotation, scale, bounds, ...) as well as the functions of $(SHAPE_LINK) (outline, color, texture, ...).
$(U Color) is a simple color class composed of 4 components:
This class inherits all the functions of $(TRANSFORMABLE_LINK) (position, rotation, scale, bounds, ...) as well as the functions of $(SHAPE_LINK) (outline, color, texture, ...).
$(U Drawable) is a very simple base interface that allows objects of derived classes to be drawn to a RenderTarget.
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.
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.
A glyph is the visual representation of a character.
$(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.
The module containing the list of usable primitives for drawing.
A rectangle is defined by its top-left corner and its size. It is a very simple class defined for convenience, so its member variables (left, top, width, and height) are public and can be accessed directly, just like the vector classes ($(VECTOR2_LINK) and $(VECTOR3_LINK)).
This class inherits all the functions of $(TRANSFORMABLE_LINK) (position, rotation, scale, bounds, ...) as well as the functions of $(SHAPE_LINK) (outline, color, texture, ...).
There are four global states that can be applied to the drawn objects:
$(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.
$(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.
$(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.
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.
$(U Shape) is a drawable class that allows to define and display a custom convex shape on a render target.
$(U Sprite) is a drawable class that allows to easily display a texture (or a part of it) on a render target.
$(U Text) is a drawable class that allows one to easily display some text with a custom style and color on a render target.
$(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). * Being stored in the graphics card memory has some drawbacks. A texture cannot be manipulated as freely as a $(IMAGE_LINK), you need to prepare the pixels first and then upload them to the texture in a single operation (see Texture.update). * $(U Texture) makes it easy to convert from/to Image, but keep in mind that these calls require transfers between the graphics card and the central memory, therefore they are slow operations. * A texture can be loaded from an image, but also directly from a file/memory/stream. The necessary shortcuts are defined so that you don't need an image first for the most common cases. However, if you want to perform some modifications on the pixels before creating the final texture, you can load your file to a $(IMAGE_LINK), do whatever you need with the pixels, and then call Texture.loadFromImage. * Since they live in the graphics card memory, the pixels of a texture cannot be accessed without a slow copy first. And they cannot be accessed individually. Therefore, if you need to read the texture's pixels (like for pixel-perfect collisions), it is recommended to store the collision information separately, for example in an array of booleans. * Like $(IMAGE_LINK), $(U Texture) can handle a unique internal representation of pixels, which is RGBA 32 bits. This means that a pixel must be composed of 8 bits red, green, blue and alpha channels – just like a $(COLOR_LINK). *
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.
The interface and template are provided for convenience, on top of $(TRANSFORM_LINK).
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.
$(U VertexArray) is a very simple wrapper around a dynamic array of vertices *and a primitives type.
$(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.
2D graphics module: sprites, text, shapes, etc.