RenderTexture.hpp
1 //
3 // SFML - Simple and Fast Multimedia Library
4 // Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
5 //
6 // This software is provided 'as-is', without any express or implied warranty.
7 // In no event will the authors be held liable for any damages arising from the use of this software.
8 //
9 // Permission is granted to anyone to use this software for any purpose,
10 // including commercial applications, and to alter it and redistribute it freely,
11 // subject to the following restrictions:
12 //
13 // 1. The origin of this software must not be misrepresented;
14 // you must not claim that you wrote the original software.
15 // If you use this software in a product, an acknowledgment
16 // in the product documentation would be appreciated but is not required.
17 //
18 // 2. Altered source versions must be plainly marked as such,
19 // and must not be misrepresented as being the original software.
20 //
21 // 3. This notice may not be removed or altered from any source distribution.
22 //
24 
25 #ifndef CPP3DS_RENDERTEXTURE_HPP
26 #define CPP3DS_RENDERTEXTURE_HPP
27 
29 // Headers
31 #include <cpp3ds/Window/Context.hpp>
32 #include <cpp3ds/Graphics/Texture.hpp>
33 #include <cpp3ds/Graphics/RenderTarget.hpp>
34 
35 
36 namespace cpp3ds
37 {
38 
44 {
45 public :
46 
56  RenderTexture();
57 
62  virtual ~RenderTexture();
63 
82  bool create(unsigned int width, unsigned int height, bool depthBuffer = false);
83 
95  void setSmooth(bool smooth);
96 
105  bool isSmooth() const;
106 
118  void setRepeated(bool repeated);
119 
128  bool isRepeated() const;
129 
145  bool setActive(bool active = true);
146 
156  void display();
157 
167  virtual Vector2u getSize() const;
168 
183  const Texture& getTexture() const;
184 
185 private :
186 
198  virtual bool activate(bool active);
199 
201  // Member data
203  Texture m_texture;
204  unsigned int m_width;
205  unsigned int m_height;
206 
207  Context* m_context;
208  unsigned int m_frameBuffer;
209  unsigned int m_depthBuffer;
210 };
211 
212 }
213 
214 
215 #endif
216 
217 
RenderTexture()
Default constructor.
virtual Vector2u getSize() const
Return the size of the rendering region of the texture.
void setSmooth(bool smooth)
Enable or disable texture smoothing.
bool create(unsigned int width, unsigned int height, bool depthBuffer=false)
Create the render-texture.
bool isSmooth() const
Tell whether the smooth filtering is enabled or not.
const Texture & getTexture() const
Get a read-only reference to the target texture.
void display()
Update the contents of the target texture.
bool setActive(bool active=true)
Activate of deactivate the render-texture for rendering.
bool isRepeated() const
Tell whether the texture is repeated or not.
Base class for all render targets (window, texture, ...)
void setRepeated(bool repeated)
Enable or disable texture repeating.
virtual ~RenderTexture()
Destructor.
Class holding a valid drawing context.
Definition: Context.hpp:47
Target for off-screen 2D rendering into a texture.
some things could easily be broken///////
Definition: Texture.hpp:47