Game Development Reference
In-Depth Information
We have talked about the RenderTarget::draw() method in previous chapters, but
we haven't yet mentioned the second (optional parameter) - an instance of
sf::RenderStates . The class holds four values, which can be defined for each draw
call— sf::BlendMode , sf::Transform , Texture* , and Shader* . We can set
those before passing the render states to the RenderTarget::draw() method, but
some Drawable objects set them automatically (for example, the Sprite class com-
bines its transform with the one given and sets its own texture). The class also has implicit
constructors for each of its fields, so passing just one of those types works, without having
to create the RenderState object explicitly. For example, the following code works
just fine:
Knowing the basics of the RenderTarget class allows us to start talking about a differ-
ent implementation of it, in the form of sf::RenderTexture .
Search WWH ::




Custom Search