Update coding style

This commit is contained in:
Rob Loach
2022-08-05 10:44:22 -04:00
parent 7323fb3122
commit 27e31eeb2a
7 changed files with 31 additions and 28 deletions

View File

@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.11)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
project (raylib_cpp
VERSION 4.2.3
VERSION 4.2.4
DESCRIPTION "raylib-cpp C++ Object Oriented Wrapper for raylib"
HOMEPAGE_URL "https://github.com/robloach/raylib-cpp"
LANGUAGES C CXX)

View File

@@ -9,19 +9,19 @@ namespace raylib {
* Bounding box type
*/
class BoundingBox : public ::BoundingBox {
public:
public:
/*
* Set the bounding box to default: min (0, 0, 0) and max (0, 0, 0).
*/
BoundingBox() {
set(::Vector3{ 0, 0, 0 }, ::Vector3{ 0, 0, 0 });
BoundingBox() : ::BoundingBox{::Vector3{0, 0, 0}, ::Vector3{ 0, 0, 0 }} {
// Nothing.
}
/*
* Copy a bounding box from another bounding box.
*/
BoundingBox(const ::BoundingBox& box) {
set(box);
BoundingBox(const ::BoundingBox& box) : ::BoundingBox{box.min, box.max} {
// Nothing.
}
/**
@@ -78,7 +78,7 @@ public:
return GetRayCollisionBox(ray, *this);
}
private:
private:
void set(const ::BoundingBox& box) {
min = box.min;
max = box.max;

View File

@@ -18,8 +18,8 @@ class Image : public ::Image {
Image(void* data = nullptr,
int width = 0,
int height = 0,
int mipmaps = 0,
int format = 0) : ::Image{data, width, height, mipmaps, format} {
int mipmaps = 1,
int format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8) : ::Image{data, width, height, mipmaps, format} {
// Nothing.
}

View File

@@ -13,8 +13,9 @@ namespace raylib {
* Model type
*/
class Model : public ::Model {
public:
public:
Model() {
// Nothing.
}
/*
@@ -47,12 +48,12 @@ public:
Model(Model&& other) {
set(other);
other.bones = nullptr;
other.boneCount = 0;
other.materials = nullptr;
other.materialCount = 0;
other.meshes = nullptr;
other.meshCount = 0;
other.bones = nullptr;
other.boneCount = 0;
other.bindPose = nullptr;
}
@@ -234,7 +235,7 @@ public:
return IsReady();
}
private:
private:
void set(const ::Model& model) {
transform = model.transform;

View File

@@ -14,19 +14,21 @@ namespace raylib {
* Texture type
*/
class Texture : public ::Texture {
public:
public:
/**
* Default texture constructor.
*/
Texture() {
set(::Texture{0, 0, 0, 0, 0});
Texture() : ::Texture{0, 0, 0, 0, 0} {
// Nothing.
}
/**
/**
* Move/Create a texture structure manually.
*/
Texture(unsigned int id, int width, int height, int mipmaps, int format) {
set(::Texture{id, width, height, mipmaps, format});
Texture(unsigned int id, int width, int height,
int mipmaps = 1, int format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8)
: ::Texture{id, width, height, mipmaps, format} {
// Nothing.
}
/**
@@ -309,7 +311,7 @@ public:
return id != 0;
}
private:
private:
void set(const ::Texture& texture) {
id = texture.id;
width = texture.width;

View File

@@ -11,11 +11,11 @@ namespace raylib {
* Window and Graphics Device Functions.
*/
class Window {
public:
Window() {
// need to create it manually with Init().
}
public:
Window() {
// need to create it manually with Init().
}
/**
* Initialize window and OpenGL context.
*/
@@ -38,7 +38,7 @@ public:
*/
void Init(int width = 800, int height = 450, const std::string& title = "raylib") {
::InitWindow(width, height, title.c_str());
if (!IsWindowReady()) {
if (!IsWindowReady()) {
throw RaylibException("Failed to create Window");
}
}

View File

@@ -12,7 +12,7 @@ extern "C" {
#define RAYMATH_STATIC_INLINE
#endif
#ifdef __GNUC__
#pragma GCC diagnostic push // these throw a warning on visual studio, need to check if __GNUC__ is defined to use it.
#pragma GCC diagnostic push // These throw a warnings on visual studio, need to check if __GNUC__ is defined to use it.
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#endif
#include "raymath.h" // NOLINT