From f865785fee2cb18da6ad6a9012a2993a73f2a2b1 Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Mon, 22 Jan 2024 01:21:22 -0500 Subject: [PATCH] v5.0.1 --- CMakeLists.txt | 2 +- clib.json | 2 +- examples/CMakeLists.txt | 1 + package.json | 2 +- projects/CMake/CMakeLists.txt | 3 ++- tests/raylib-assert.h | 38 +++++++++++++++++++++++++++++++++++ tests/raylib_cpp_test.cpp | 4 +++- 7 files changed, 47 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cf98ca2..619e3bc 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 5.0.0 + VERSION 5.0.1 DESCRIPTION "raylib-cpp C++ Object Oriented Wrapper for raylib" HOMEPAGE_URL "https://github.com/robloach/raylib-cpp" LANGUAGES C CXX diff --git a/clib.json b/clib.json index 8ca55f1..5a5fafb 100644 --- a/clib.json +++ b/clib.json @@ -1,6 +1,6 @@ { "name": "raylib-cpp", - "version": "5.0.0-alpha1", + "version": "5.0.1", "repo": "RobLoach/raylib-cpp", "description": "raylib-cpp: C++ Object-Oriented Wrapper for raylib", "homepage": "https://github.com/robloach/raylib-cpp", diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 5987a06..b409356 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -16,6 +16,7 @@ if (NOT raylib_FOUND) raylib GIT_REPOSITORY https://github.com/raysan5/raylib.git GIT_TAG ae50bfa2cc569c0f8d5bc4315d39db64005b1b08 + GIT_SHALLOW 1 ) FetchContent_GetProperties(raylib) if (NOT raylib_POPULATED) # Have we downloaded raylib yet? diff --git a/package.json b/package.json index a53c6d3..c58eedf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "raylib-cpp", - "version": "5.0.0-alpha1", + "version": "5.0.1", "description": "raylib-cpp: C++ Object-Oriented Wrapper for raylib", "main": "index.js", "private": true, diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index 5ff7538..6a53037 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -9,6 +9,7 @@ if (NOT raylib_FOUND) raylib GIT_REPOSITORY https://github.com/raysan5/raylib.git GIT_TAG 5.0 + GIT_SHALLOW 1 ) FetchContent_MakeAvailable(raylib) endif() @@ -20,7 +21,7 @@ if (NOT raylib_cpp_FOUND) FetchContent_Declare( raylib_cpp GIT_REPOSITORY https://github.com/RobLoach/raylib-cpp.git - GIT_TAG v5.0.0 + GIT_TAG v5.0.1 ) FetchContent_MakeAvailable(raylib_cpp) endif() diff --git a/tests/raylib-assert.h b/tests/raylib-assert.h index 004bdd0..7745804 100644 --- a/tests/raylib-assert.h +++ b/tests/raylib-assert.h @@ -188,6 +188,19 @@ extern "C" { */ #define AssertColorSame(...) RAYLIB_ASSERT_VA_SELECT(AssertColorSame, __VA_ARGS__) +/** + * Assert whether two Vector2s are the same. + * + * @param vector1 The first Vector2 to check. + * @param vector2 The second Vector2 to check. + * @param message (Optional) The message to provide on failed assertions. + * @param p1 (Optional) The first parameter in the message. + * @param p2 (Optional) The second parameter in the message. + * @param p3 (Optional) The third parameter in the message. + * @param p4 (Optional) The fourth parameter in the message. + */ +#define AssertVector2Same(...) RAYLIB_ASSERT_VA_SELECT(AssertVector2Same, __VA_ARGS__) + // Assert() #ifdef RAYLIB_ASSERT_NDEBUG #define Assert_0() @@ -345,6 +358,31 @@ extern "C" { #define AssertColorSame_7(color1, color2, message, p1, p2, p3, p4) AssertColorSame_3(color1, color2, RAYLIB_ASSERT_TEXTFORMAT(message, p1, p2, p3, p4)) #endif +// AssertVector2Same() +#ifdef RAYLIB_ASSERT_NDEBUG +#define AssertVector2Same_0() +#define AssertVector2Same_1(vector) +#define AssertVector2Same_2(vector1, vector2) +#define AssertVector2Same_3(vector1, vector2, message) +#define AssertVector2Same_4(vector1, vector2, message, p1) +#define AssertVector2Same_5(vector1, vector2, message, p1, p2) +#define AssertVector2Same_6(vector1, vector2, message, p1, p2, p3) +#define AssertVector2Same_7(vector1, vector2, message, p1, p2, p3, p4) +#else +#define AssertVector2Same_0() AssertFail_1("Vectors not provided to AssertVector2Same()") +#define AssertVector2Same_1(vector) AssertFail_1("Expected two vectors for AssertVector2Same()") +#define AssertVector2Same_2(vector1, vector2) AssertVector2Same_5(vector1, vector2, "AssertVector2Same(%s, %s) - vectors do not match", #vector1, #vector2) +#define AssertVector2Same_3(vector1, vector2, message) do { \ + if (vector1.x != vector2.x || vector1.y != vector2.y) { \ + AssertFail_1(message); \ + }\ +} while (0) +#define AssertVector2Same_4(vector1, vector2, message, p1) AssertVector2Same_3(vector1, vector2, RAYLIB_ASSERT_TEXTFORMAT(message, p1)) +#define AssertVector2Same_5(vector1, vector2, message, p1, p2) AssertVector2Same_3(vector1, vector2, RAYLIB_ASSERT_TEXTFORMAT(message, p1, p2)) +#define AssertVector2Same_6(vector1, vector2, message, p1, p2, p3) AssertVector2Same_3(vector1, vector2, RAYLIB_ASSERT_TEXTFORMAT(message, p1, p2, p3)) +#define AssertVector2Same_7(vector1, vector2, message, p1, p2, p3, p4) AssertVector2Same_3(vector1, vector2, RAYLIB_ASSERT_TEXTFORMAT(message, p1, p2, p3, p4)) +#endif + #ifdef __cplusplus } #endif diff --git a/tests/raylib_cpp_test.cpp b/tests/raylib_cpp_test.cpp index 8b67f7a..6d188c6 100644 --- a/tests/raylib_cpp_test.cpp +++ b/tests/raylib_cpp_test.cpp @@ -27,11 +27,13 @@ int main(int argc, char *argv[]) { AssertEqual(position.x, 310); AssertEqual(raylib::Window::IsReady(), false); - raylib::Vector2 size{50,50}; + raylib::Vector2 size{50, 100}; raylib::Vector2 halfsize = size / 2.0f; AssertEqual(size.x, 50); + AssertEqual(size.y, 100); AssertEqual(halfsize.x, 25); + AssertEqual(halfsize.y, 50); raylib::Vector2 doublesize = size * 2.0f; AssertEqual(size.x, 50);