Update confic

This commit is contained in:
Rob Loach
2019-08-10 16:55:34 -04:00
parent da3fa800b4
commit 45a0a2a6c1
19 changed files with 182 additions and 38 deletions

View File

@@ -13,8 +13,6 @@
#include "raylib/raylib.hpp"
#include <iostream>
int main(void)
{
// Initialization

View File

@@ -18,6 +18,22 @@ namespace raylib {
Camera3D() {}
GETTERSETTER(Vector3,Position,position)
GETTERSETTER(Vector3,Target,target)
GETTERSETTER(Vector3,Up,up)
GETTERSETTER(float,Fovy,fovy)
GETTERSETTER(int,Type,type)
Camera3D& operator=(const ::Camera3D& camera) {
set(camera);
return *this;
}
Camera3D& operator=(const Camera3D& camera) {
set(camera);
return *this;
}
inline void set(const ::Camera3D& camera) {
position = camera.position;
target = camera.target;
@@ -57,22 +73,13 @@ namespace raylib {
::UpdateVrTracking(this);
}
GETTERSETTER(Vector3,Position,position)
GETTERSETTER(Vector3,Target,target)
GETTERSETTER(Vector3,Up,up)
GETTERSETTER(float,Fovy,fovy)
GETTERSETTER(int,Type,type)
Camera3D& operator=(const ::Camera3D& camera) {
set(camera);
return *this;
}
Camera3D& operator=(const Camera3D& camera) {
set(camera);
return *this;
}
Ray GetMouseRay(::Vector2 mousePosition) {
return ::GetMouseRay(mousePosition, *this);
}
Vector2 GetWorldToScreen(::Vector3 position) {
return ::GetWorldToScreen(position, *this);
}
};
typedef Camera3D Camera;

View File

@@ -2,7 +2,6 @@
#define RAYLIB_CPP_FONT_HPP_
#include <string>
#include <iostream>
#include "raylib.h"
#include "utils.hpp"
@@ -15,9 +14,7 @@ namespace raylib {
}
Font(const std::string& fileName) {
std::cout << "std" << fileName << std::endl;
set(LoadFont(fileName.c_str()));
std::cout << "asdsadds()" << std::endl;
}
Font(const std::string& fileName, int fontSize, int* fontChars, int charCount) {
@@ -33,7 +30,6 @@ namespace raylib {
}
void Unload() {
std::cout << "UnloadFont()" << std::endl;
UnloadFont(*this);
}
@@ -46,7 +42,6 @@ namespace raylib {
}
void set(const Font& font) {
std::cout << "set()" << std::endl;
baseSize = font.baseSize;
charsCount = font.charsCount;
texture = font.texture;
@@ -79,6 +74,14 @@ namespace raylib {
void DrawText(const std::string& text, ::Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint, int selectStart, int selectLength, ::Color selectText, Color selectBack) {
DrawTextRecEx(*this, text.c_str(), rec, fontSize, spacing, wordWrap, tint, selectStart, selectLength, selectText, selectBack);
}
Vector2 MeasureText(const std::string& text, float fontSize, float spacing) {
return ::MeasureTextEx(*this, text.c_str(), fontSize, spacing);
}
int GetGlyphIndex(int character) {
return ::GetGlyphIndex(*this, character);
}
};
}

View File

@@ -4,7 +4,6 @@
#include <string>
#include "raylib.h"
#include "utils.hpp"
#include <iostream>
namespace raylib {
class Image : public ::Image {
@@ -65,7 +64,6 @@ namespace raylib {
}
void Unload() {
std::cout << "UnloadImage()" << std::endl;
UnloadImage(*this);
};
@@ -134,6 +132,9 @@ namespace raylib {
ImageColorReplace(this, color, replace);
}
::Color* GetData() {
return ::GetImageData(*this);
}
};
}

View File

@@ -37,7 +37,6 @@ namespace raylib {
return *this;
}
void Unload() {
UnloadMaterial(*this);
}

View File

@@ -39,6 +39,16 @@ namespace raylib {
GETTERSETTER(float,VertexCount,vertexCount)
GETTERSETTER(float,TriangleCount,triangleCount)
Mesh& operator=(const ::Mesh& mesh) {
set(mesh);
return *this;
}
Mesh& operator=(const Mesh& mesh) {
set(mesh);
return *this;
}
~Mesh() {
Unload();
}

View File

@@ -42,6 +42,16 @@ namespace raylib {
GETTERSETTER(int,MeshCount,meshCount)
GETTERSETTER(int,MaterialCount,materialCount)
Model& operator=(const ::Model& model) {
set(model);
return *this;
}
Model& operator=(const Model& model) {
set(model);
return *this;
}
void Unload() {
UnloadModel(*this);
}

View File

@@ -27,6 +27,16 @@ namespace raylib {
direction = ray.direction;
}
Ray& operator=(const ::Ray& ray) {
set(ray);
return *this;
}
Ray& operator=(const Ray& ray) {
set(ray);
return *this;
}
GETTERSETTER(::Vector3,Position,position)
GETTERSETTER(::Vector3,Direction,direction)

View File

@@ -18,6 +18,16 @@ namespace raylib {
normal = Normal;
};
RayHitInfo& operator=(const ::RayHitInfo& ray) {
set(ray);
return *this;
}
RayHitInfo& operator=(const RayHitInfo& ray) {
set(ray);
return *this;
}
inline void set(::RayHitInfo ray) {
hit = ray.hit;
distance = ray.distance;

View File

@@ -17,6 +17,7 @@ namespace raylib {
width = Width;
height = Height;
};
inline void set(::Rectangle rect) {
x = rect.x;
y = rect.y;
@@ -68,6 +69,15 @@ namespace raylib {
::DrawRectangleRoundedLines(*this, roundness, segments, lineThick, color);
}
bool CheckCollision(::Rectangle rec2) {
return ::CheckCollisionRecs(*this, rec2);
}
Rectangle GetCollisionRec(::Rectangle rec2) {
return ::GetCollisionRec(*this, rec2);
}
bool CheckCollisionPointRec(::Vector2 point) {
return ::CheckCollisionPointRec(point, *this);
}
};
}

View File

@@ -29,6 +29,16 @@ namespace raylib {
GETTERSETTER(Texture2D,Depth,depth)
GETTERSETTER(bool,DepthTexture,depthTexture)
RenderTexture2D& operator=(const ::RenderTexture2D& texture) {
set(texture);
return *this;
}
RenderTexture2D& operator=(const RenderTexture2D& texture) {
set(texture);
return *this;
}
~RenderTexture2D() {
Unload();
};
@@ -41,6 +51,7 @@ namespace raylib {
::BeginTextureMode(*this);
}
};
typedef RenderTexture2D RenderTexture;
}
#endif

View File

@@ -27,6 +27,16 @@ namespace raylib {
GETTERSETTER(unsigned int,Id,i)
Shader& operator=(const ::Shader& shader) {
set(shader);
return *this;
}
Shader& operator=(const Shader& shader) {
set(shader);
return *this;
}
~Shader() {
Unload();
}

View File

@@ -33,6 +33,16 @@ namespace raylib {
GETTERSETTER(unsigned int,SampleCount,sampleCount)
GETTERSETTER(::AudioStream,Stream,stream)
Sound& operator=(const ::Sound& sound) {
set(sound);
return *this;
}
Sound& operator=(const Sound& sound) {
set(sound);
return *this;
}
void Update(const void *data, int sampleCount) {
UpdateSound(*this, data, sampleCount);
}

View File

@@ -5,7 +5,6 @@
#include "raylib.h"
#include "utils.hpp"
#include "Vector2.hpp"
#include <iostream>
namespace raylib {
class Texture2D : public ::Texture2D {
@@ -32,6 +31,22 @@ namespace raylib {
format = texture.format;
}
GETTERSETTER(unsigned int,Id,id)
GETTERSETTER(int,Width,width)
GETTERSETTER(int,Height,height)
GETTERSETTER(int,Mipmaps,mipmaps)
GETTERSETTER(int,Format,format)
Texture2D& operator=(const ::Texture2D& texture) {
set(texture);
return *this;
}
Texture2D& operator=(const Texture2D& texture) {
set(texture);
return *this;
}
bool LoadFromImage(::Image& image) {
set(LoadTextureFromImage(image));
}
@@ -64,15 +79,8 @@ namespace raylib {
}
void Unload() {
std::cout << "UnloadTexture()" << std::endl;
UnloadTexture(*this);
};
GETTERSETTER(unsigned int,Id,id)
GETTERSETTER(int,Width,width)
GETTERSETTER(int,Height,height)
GETTERSETTER(int,Mipmaps,mipmaps)
GETTERSETTER(int,Format,format)
};
typedef Texture2D Texture;
}

View File

@@ -22,24 +22,38 @@ namespace raylib {
GETTERSETTER(float,X,x)
GETTERSETTER(float,Y,y)
Vector2& operator=(const ::Vector2& vector2) {
set(vector2);
return *this;
}
Vector2& operator=(const Vector2& vector2) {
set(vector2);
return *this;
}
void DrawPixel(::Color color) {
DrawPixelV(*this, color);
::DrawPixelV(*this, color);
}
void DrawLine(::Vector2 endPos, ::Color color) {
DrawLineV(*this, endPos, color);
::DrawLineV(*this, endPos, color);
}
void DrawLine(::Vector2 endPos, float thick, ::Color color) {
DrawLineEx(*this, endPos, thick, color);
::DrawLineEx(*this, endPos, thick, color);
}
void DrawLineBezier(::Vector2 endPos, float thick, ::Color color) {
::DrawLineBezier(*this, endPos, thick, color);
}
void DrawCircle(float radius, ::Color color) {
DrawCircleV(*this, radius, color);
::DrawCircleV(*this, radius, color);
}
void DrawRectangle(::Vector2 size, ::Color color) {
DrawRectangleV(*this, size, color);
::DrawRectangleV(*this, size, color);
}
void DrawPoly(int sides, float radius, float rotation, ::Color color) {

View File

@@ -29,6 +29,16 @@ namespace raylib {
GETTERSETTER(float,Y,y)
GETTERSETTER(float,Z,z)
Vector3& operator=(const ::Vector3& vector3) {
set(vector3);
return *this;
}
Vector3& operator=(const Vector3& vector3) {
set(vector3);
return *this;
}
void DrawGizmo() {
::DrawGizmo(*this);
}

View File

@@ -33,6 +33,16 @@ namespace raylib {
GETTERSETTER(float,Y,y)
GETTERSETTER(float,Z,z)
GETTERSETTER(float,W,w)
Vector4& operator=(const ::Vector4& vector4) {
set(vector4);
return *this;
}
Vector4& operator=(const Vector4& vector4) {
set(vector4);
return *this;
}
};
}

View File

@@ -40,6 +40,16 @@ namespace raylib {
GETTERSETTER(unsigned int,W,channels)
GETTERSETTER(void*,Data,data)
Wave& operator=(const ::Wave& wave) {
set(wave);
return *this;
}
Wave& operator=(const Wave& wave) {
set(wave);
return *this;
}
void Format(int SampleRate = 0, int SampleSize = 0, int Channels = 2) {
WaveFormat(this, SampleRate, SampleSize, Channels);
}

View File

@@ -17,5 +17,8 @@ TEST_CASE("raylib_test", "[raylib_test]" ) {
SECTION("Color") {
raylib::Color c(RED);
CHECK(c.ToInt() == ColorToInt(RED));
c = RAYWHITE;
CHECK(c.r == RAYWHITE.r);
}
}