Merge pull request #24 from RobLoach/fixtests

Update Mesh, Image, Rectangle, and Texture operators
This commit is contained in:
Rob Loach
2020-04-07 12:35:15 -04:00
committed by GitHub
4 changed files with 19 additions and 3 deletions

View File

@@ -34,7 +34,7 @@ namespace raylib {
Image(::Texture2D texture) {
set(::GetTextureData(texture));
}
Image(int width, int height, Color color) {
Image(int width, int height, Color color = raylib::Color::RayWhite) {
set(::GenImageColor(width, height, color));
}

View File

@@ -12,6 +12,7 @@ extern "C"{
#include "utils.hpp"
#include "BoundingBox.hpp"
#include "Model.hpp"
namespace raylib {
class Mesh : public ::Mesh {
@@ -60,17 +61,21 @@ namespace raylib {
Unload();
}
inline void Export(const std::string& fileName) {
inline Mesh& Export(const std::string& fileName) {
ExportMesh(*this, fileName.c_str());
return *this;
}
inline void Unload() {
::UnloadMesh(*this);
}
inline BoundingBox BoundingBox() {
inline raylib::BoundingBox BoundingBox() {
return ::MeshBoundingBox(*this);
}
operator raylib::BoundingBox() {
return BoundingBox();
}
inline Mesh& Tangents() {
::MeshTangents(this);
@@ -81,6 +86,13 @@ namespace raylib {
::MeshBinormals(this);
return *this;
}
inline raylib::Model LoadModelFrom() {
return ::LoadModelFromMesh(*this);
}
operator raylib::Model() {
return LoadModelFrom();
}
};
}

View File

@@ -10,6 +10,7 @@ extern "C"{
#endif
#include "utils.hpp"
#include "Vector2.hpp"
namespace raylib {
class Rectangle : public ::Rectangle {

View File

@@ -81,6 +81,9 @@ namespace raylib {
inline Image GetTextureData() {
return ::GetTextureData(*this);
}
inline operator raylib::Image() {
return GetTextureData();
}
inline Texture2D& GenMipmaps() {
::GenTextureMipmaps(this);