Updated raylib-cpp header files

This commit is contained in:
2025-09-08 22:06:21 -04:00
parent a0a658ca8a
commit fff611cc72
45 changed files with 2533 additions and 2382 deletions

View File

@@ -1,41 +1,40 @@
#ifndef RAYLIB_CPP_INCLUDE_RENDERTEXTURE_HPP_
#define RAYLIB_CPP_INCLUDE_RENDERTEXTURE_HPP_
#include "./raylib.hpp"
#include "./raylib-cpp-utils.hpp"
#include "./RaylibException.hpp"
#include "./TextureUnmanaged.hpp"
#include "./raylib-cpp-utils.hpp"
namespace raylib {
/**
* RenderTexture type, for texture rendering
*/
class RenderTexture : public ::RenderTexture {
public:
public:
/**
* Default constructor to build an empty RenderTexture.
*/
RenderTexture() {
id = 0;
RenderTexture() = default;
RenderTexture(const ::RenderTexture& renderTexture)
: ::RenderTexture(renderTexture) {
// Nothing.
}
RenderTexture(const ::RenderTexture& renderTexture) {
set(renderTexture);
}
RenderTexture(unsigned int id, const ::Texture& texture, const ::Texture& depth) :
::RenderTexture{id, texture, depth} {}
RenderTexture(unsigned int id, const ::Texture& texture, const ::Texture& depth)
: ::RenderTexture{id, texture, depth} {}
/**
* Load texture for rendering (framebuffer)
*/
RenderTexture(int width, int height) {
set(::LoadRenderTexture(width, height));
RenderTexture(int width, int height)
: ::RenderTexture(::LoadRenderTexture(width, height)) {
// Nothing.
}
RenderTexture(const RenderTexture&) = delete;
RenderTexture(RenderTexture&& other) {
RenderTexture(RenderTexture&& other) noexcept
{
set(other);
other.id = 0;
@@ -43,29 +42,21 @@ class RenderTexture : public ::RenderTexture {
other.depth = {};
}
GETTERSETTER(unsigned int, Id, id)
GETTER(unsigned int, Id, id)
/**
* Get the color buffer attachment texture.
*/
inline TextureUnmanaged GetTexture() {
return texture;
}
TextureUnmanaged GetTexture() { return texture; }
inline void SetTexture(const ::Texture& newTexture) {
texture = newTexture;
}
void SetTexture(const ::Texture& newTexture) { texture = newTexture; }
/**
* Depth buffer attachment texture
*/
inline TextureUnmanaged GetDepth() {
return depth;
}
TextureUnmanaged GetDepth() { return depth; }
inline void SetDepth(const ::Texture& newDepth) {
depth = newDepth;
}
void SetDepth(const ::Texture& newDepth) { depth = newDepth; }
RenderTexture& operator=(const ::RenderTexture& texture) {
set(texture);
@@ -89,18 +80,14 @@ class RenderTexture : public ::RenderTexture {
return *this;
}
~RenderTexture() {
Unload();
}
~RenderTexture() { Unload(); }
inline void Unload() {
UnloadRenderTexture(*this);
}
void Unload() { UnloadRenderTexture(*this); }
/**
* Initializes render texture for drawing
*/
inline RenderTexture& BeginMode() {
RenderTexture& BeginMode() {
::BeginTextureMode(*this);
return *this;
}
@@ -108,7 +95,7 @@ class RenderTexture : public ::RenderTexture {
/**
* Ends drawing to render texture
*/
inline RenderTexture& EndMode() {
RenderTexture& EndMode() {
::EndTextureMode();
return *this;
}
@@ -116,28 +103,25 @@ class RenderTexture : public ::RenderTexture {
/**
* Load texture for rendering (framebuffer)
*/
static RenderTexture Load(int width, int height) {
return ::LoadRenderTexture(width, height);
}
static RenderTexture Load(int width, int height) { return ::LoadRenderTexture(width, height); }
/**
* Retrieves whether or not the render texture is ready.
*/
inline bool IsReady() const {
return ::IsRenderTextureReady(*this);
}
protected:
[[nodiscard]] bool IsValid() const { return ::IsRenderTextureValid(*this); }
protected:
void set(const ::RenderTexture& renderTexture) {
id = renderTexture.id;
texture = renderTexture.texture;
depth = renderTexture.depth;
}
};
typedef RenderTexture RenderTexture2D;
} // namespace raylib
using RenderTexture2D = RenderTexture;
} // namespace raylib
using RRenderTexture = raylib::RenderTexture;
using RRenderTexture2D = raylib::RenderTexture2D;
#endif // RAYLIB_CPP_INCLUDE_RENDERTEXTURE_HPP_
#endif // RAYLIB_CPP_INCLUDE_RENDERTEXTURE_HPP_