raylib-cpp
C++ object-oriented wrapper library for raylib.
Texture.hpp
1 #ifndef RAYLIB_CPP_INCLUDE_TEXTURE_HPP_
2 #define RAYLIB_CPP_INCLUDE_TEXTURE_HPP_
3 
4 #include "./TextureUnmanaged.hpp"
5 
6 namespace raylib {
14 class Texture : public TextureUnmanaged {
15  public:
17 
21  Texture(const Texture&) = delete;
22 
26  Texture& operator=(const Texture&) = delete;
27 
31  Texture(Texture&& other) {
32  set(other);
33 
34  other.id = 0;
35  other.width = 0;
36  other.height = 0;
37  other.mipmaps = 0;
38  other.format = 0;
39  }
40 
45  Unload();
46  }
47 
51  Texture& operator=(Texture&& other) noexcept {
52  if (this == &other) {
53  return *this;
54  }
55 
56  Unload();
57  set(other);
58 
59  other.id = 0;
60  other.width = 0;
61  other.height = 0;
62  other.mipmaps = 0;
63  other.format = 0;
64 
65  return *this;
66  }
67 };
68 
69 // Create the Texture aliases.
70 typedef Texture Texture2D;
71 typedef Texture TextureCubemap;
72 
73 } // namespace raylib
74 
78 
79 #endif // RAYLIB_CPP_INCLUDE_TEXTURE_HPP_
Texture type.
Definition: Texture.hpp:14
Texture(const Texture &)=delete
Explicitly forbid the copy constructor.
Texture(Texture &&other)
Move constructor.
Definition: Texture.hpp:31
Texture & operator=(const Texture &)=delete
Explicitly forbid copy assignment.
Texture & operator=(Texture &&other) noexcept
Move assignment.
Definition: Texture.hpp:51
~Texture()
On destruction, unload the Texture.
Definition: Texture.hpp:44
A Texture that is not managed by the C++ garbage collector.
TextureUnmanaged()
Default texture constructor.
void Unload()
Unload texture from GPU memory (VRAM)
All raylib-cpp classes and functions appear in the raylib namespace.
Definition: AudioDevice.hpp:8