From 27e31eeb2a8e6cd99d100f10e47accc91618449b Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Fri, 5 Aug 2022 10:44:22 -0400 Subject: [PATCH] Update coding style --- CMakeLists.txt | 2 +- include/BoundingBox.hpp | 12 ++++++------ include/Image.hpp | 4 ++-- include/Model.hpp | 9 +++++---- include/Texture.hpp | 18 ++++++++++-------- include/Window.hpp | 12 ++++++------ include/raymath.hpp | 2 +- 7 files changed, 31 insertions(+), 28 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 100c60d..2850a64 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/include/BoundingBox.hpp b/include/BoundingBox.hpp index f43ecbc..2021443 100644 --- a/include/BoundingBox.hpp +++ b/include/BoundingBox.hpp @@ -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; diff --git a/include/Image.hpp b/include/Image.hpp index 380d3b5..ab9770a 100644 --- a/include/Image.hpp +++ b/include/Image.hpp @@ -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. } diff --git a/include/Model.hpp b/include/Model.hpp index a68fe6d..67f80f1 100644 --- a/include/Model.hpp +++ b/include/Model.hpp @@ -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; diff --git a/include/Texture.hpp b/include/Texture.hpp index 8f561b2..383b854 100644 --- a/include/Texture.hpp +++ b/include/Texture.hpp @@ -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; diff --git a/include/Window.hpp b/include/Window.hpp index e630efc..fe2998a 100644 --- a/include/Window.hpp +++ b/include/Window.hpp @@ -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"); } } diff --git a/include/raymath.hpp b/include/raymath.hpp index d712745..4d8048e 100644 --- a/include/raymath.hpp +++ b/include/raymath.hpp @@ -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