raylib-cpp
C++ object-oriented wrapper library for raylib.
RenderTexture.hpp
1 /*
2 * LICENSE: zlib/libpng
3 *
4 * raylib-cpp is licensed under an unmodified zlib/libpng license, which is an OSI-certified,
5 * BSD-like license that allows static linking with closed source software:
6 *
7 * Copyright (c) 2020 Rob Loach (@RobLoach)
8 *
9 * This software is provided "as-is", without any express or implied warranty. In no event
10 * will the authors be held liable for any damages arising from the use of this software.
11 *
12 * Permission is granted to anyone to use this software for any purpose, including commercial
13 * applications, and to alter it and redistribute it freely, subject to the following restrictions:
14 *
15 * 1. The origin of this software must not be misrepresented; you must not claim that you
16 * wrote the original software. If you use this software in a product, an acknowledgment
17 * in the product documentation would be appreciated but is not required.
18 *
19 * 2. Altered source versions must be plainly marked as such, and must not be misrepresented
20 * as being the original software.
21 *
22 * 3. This notice may not be removed or altered from any source distribution.
23 */
24 
25 #ifndef RAYLIB_CPP_INCLUDE_RENDERTEXTURE_HPP_
26 #define RAYLIB_CPP_INCLUDE_RENDERTEXTURE_HPP_
27 
28 #include "./raylib.hpp"
29 #include "./raylib-cpp-utils.hpp"
30 
31 namespace raylib {
33  public:
34  RenderTexture(const ::RenderTexture& renderTexture) {
35  set(renderTexture);
36  }
37 
38  RenderTexture(unsigned int Id) {
39  id = Id;
40  }
41 
42  RenderTexture(int width, int height) {
43  set(LoadRenderTexture(width, height));
44  }
45 
46  GETTERSETTER(unsigned int, Id, id)
47  GETTERSETTER(::Texture2D, Texture, texture)
48  GETTERSETTER(::Texture2D, Depth, depth)
49 
50  RenderTexture& operator=(const ::RenderTexture& texture) {
51  set(texture);
52  return *this;
53  }
54 
56  set(texture);
57  return *this;
58  }
59 
61  Unload();
62  }
63 
64  inline void Unload() {
65  UnloadRenderTexture(*this);
66  }
67 
72  ::BeginTextureMode(*this);
73  return *this;
74  }
75 
79  inline RenderTexture& EndMode() {
80  ::EndTextureMode();
81  return *this;
82  }
83 
84  protected:
85  inline void set(const ::RenderTexture& renderTexture) {
86  id = renderTexture.id;
87  texture = renderTexture.texture;
88  depth = renderTexture.depth;
89  }
90 };
92 } // namespace raylib
93 
94 #endif // RAYLIB_CPP_INCLUDE_RENDERTEXTURE_HPP_
raylib
Provides all the classes associated with raylib-cpp.
Definition: AudioDevice.hpp:31
raylib::RenderTexture::~RenderTexture
~RenderTexture()
Definition: RenderTexture.hpp:60
raylib::RenderTexture::RenderTexture
RenderTexture(int width, int height)
Definition: RenderTexture.hpp:42
raylib::RenderTexture::operator=
RenderTexture & operator=(const RenderTexture &texture)
Definition: RenderTexture.hpp:55
raylib::RenderTexture::RenderTexture
RenderTexture(unsigned int Id)
Definition: RenderTexture.hpp:38
raylib::RenderTexture::Unload
void Unload()
Definition: RenderTexture.hpp:64
raylib::RenderTexture2D
RenderTexture RenderTexture2D
Definition: RenderTexture.hpp:91
raylib::RenderTexture
Definition: RenderTexture.hpp:32
raylib::RenderTexture::EndMode
RenderTexture & EndMode()
Ends drawing to render texture.
Definition: RenderTexture.hpp:79
raylib::RenderTexture::BeginMode
RenderTexture & BeginMode()
Initializes render texture for drawing.
Definition: RenderTexture.hpp:71
raylib::RenderTexture::set
void set(const ::RenderTexture &renderTexture)
Definition: RenderTexture.hpp:85
raylib::Texture
Definition: Texture.hpp:36
raylib::RenderTexture::RenderTexture
RenderTexture(const ::RenderTexture &renderTexture)
Definition: RenderTexture.hpp:34