diff --git a/CMakeLists.txt b/CMakeLists.txt index 0162cb06..cf98ca2a 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.5.2 + VERSION 5.0.0 DESCRIPTION "raylib-cpp C++ Object Oriented Wrapper for raylib" HOMEPAGE_URL "https://github.com/robloach/raylib-cpp" LANGUAGES C CXX diff --git a/README.md b/README.md index a2b41f6f..70566007 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![raylib-cpp Logo](projects/Doxygen/raylib-cpp_256x256.png) -# raylib-cpp [![Targeting raylib 4.5](https://img.shields.io/badge/for_raylib-4.5-blue)](https://raylib.com) [![Tests](https://github.com/RobLoach/raylib-cpp/workflows/Tests/badge.svg)](https://github.com/RobLoach/raylib-cpp/actions?query=workflow%3ATests+branch%3Amaster) [![License](https://img.shields.io/badge/license-zlib%2Flibpng-blue.svg)](LICENSE) +# raylib-cpp ![Targeting raylib 5.0](https://img.shields.io/badge/for_raylib-5.0-blue) [![Tests](https://github.com/RobLoach/raylib-cpp/workflows/Tests/badge.svg)](https://github.com/RobLoach/raylib-cpp/actions?query=workflow%3ATests+branch%3Amaster) [![License](https://img.shields.io/badge/license-zlib%2Flibpng-blue.svg)](LICENSE) [raylib-cpp](https://github.com/robloach/raylib-cpp) is a C++ wrapper library for [raylib](https://www.raylib.com), a simple and easy-to-use library to enjoy videogames programming. This C++ header provides object-oriented wrappers around *raylib*'s struct interfaces. *raylib-cpp* is not required to use *raylib* in C++, but the classes do bring using the raylib API more inline with C++'s language paradigm. diff --git a/clib.json b/clib.json index 436d7b7e..0668aa7d 100644 --- a/clib.json +++ b/clib.json @@ -1,6 +1,6 @@ { "name": "raylib-cpp", - "version": "4.5.2", + "version": "5.0.0-alpha1", "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 3497a52a..5987a06c 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -15,7 +15,7 @@ if (NOT raylib_FOUND) FetchContent_Declare( raylib GIT_REPOSITORY https://github.com/raysan5/raylib.git - GIT_TAG 4.5.0 + GIT_TAG ae50bfa2cc569c0f8d5bc4315d39db64005b1b08 ) FetchContent_GetProperties(raylib) if (NOT raylib_POPULATED) # Have we downloaded raylib yet? diff --git a/include/Color.hpp b/include/Color.hpp index 90057e90..09668357 100644 --- a/include/Color.hpp +++ b/include/Color.hpp @@ -203,6 +203,27 @@ class Color : public ::Color { ::DrawRectangleLinesEx(rec, lineThick, *this); } + /** + * Get color multiplied with another color + */ + inline Color Tint(::Color tint) { + return ::ColorTint(*this, tint); + } + + /** + * Get color with brightness correction, brightness factor goes from -1.0f to 1.0f + */ + inline Color Brightness(float factor) { + return ::ColorBrightness(*this, factor); + } + + /** + * Get color with contrast correction, contrast values between -1.0f and 1.0f + */ + inline Color Contrast(float contrast) { + return ::ColorContrast(*this, contrast); + } + /** * Returns color with alpha applied, alpha goes from 0.0f to 1.0f */ diff --git a/include/Image.hpp b/include/Image.hpp index ac20769b..0fc4002a 100644 --- a/include/Image.hpp +++ b/include/Image.hpp @@ -131,17 +131,10 @@ class Image : public ::Image { } /** - * Generate image: vertical gradient + * Generate image: linear gradient */ - static ::Image GradientV(int width, int height, ::Color top, ::Color bottom) { - return ::GenImageGradientV(width, height, top, bottom); - } - - /** - * Generate image: horizontal gradient - */ - static ::Image GradientH(int width, int height, ::Color left, ::Color right) { - return ::GenImageGradientH(width, height, left, right); + static ::Image GradientLinear(int width, int height, int direction, ::Color start, ::Color end) { + return ::GenImageGradientLinear(width, height, direction, start, end); } /** @@ -305,6 +298,13 @@ class Image : public ::Image { } } + /** + * Export image to memory buffer + */ + inline unsigned char* ExportToMemory(const char *fileType, int *fileSize) { + return ::ExportImageToMemory(*this, fileType, fileSize); + } + /** * Export image as code file defining an array of bytes, returns true on success * @@ -484,6 +484,14 @@ class Image : public ::Image { return *this; } + /** + * Rotate image by input angle in degrees (-359 to 359) + */ + inline Image& Rotate(int degrees) { + ::ImageRotate(this, degrees); + return *this; + } + /** * Rotate image clockwise 90deg */ diff --git a/include/ModelAnimation.hpp b/include/ModelAnimation.hpp index d90b6d6e..ccc5a052 100644 --- a/include/ModelAnimation.hpp +++ b/include/ModelAnimation.hpp @@ -37,7 +37,7 @@ class ModelAnimation : public ::ModelAnimation { * Load model animations from file */ static std::vector Load(const std::string& fileName) { - unsigned int count = 0; + int count = 0; ::ModelAnimation* modelAnimations = ::LoadModelAnimations(fileName.c_str(), &count); std::vector mats(modelAnimations, modelAnimations + count); diff --git a/include/Vector2.hpp b/include/Vector2.hpp index 3085caf5..182014b9 100644 --- a/include/Vector2.hpp +++ b/include/Vector2.hpp @@ -354,17 +354,6 @@ class Vector2 : public ::Vector2 { ::DrawLineBezier(*this, endPos, thick, color); } - /** - * Draw line using quadratic bezier curves with a control point. - */ - inline void DrawLineBezierQuad( - ::Vector2 endPos, - ::Vector2 controlPos, - float thick, - ::Color color = {0, 0, 0, 255}) const { - ::DrawLineBezierQuad(*this, endPos, controlPos, thick, color); - } - /** * Draw a color-filled circle (Vector version) */ diff --git a/include/Window.hpp b/include/Window.hpp index 2693de63..dc00759e 100644 --- a/include/Window.hpp +++ b/include/Window.hpp @@ -190,6 +190,14 @@ class Window { return *this; } + /** + * Toggle window state: borderless/windowed + */ + inline Window& ToggleBorderless() { + ::ToggleBorderlessWindowed(); + return *this; + } + /** * Set window state: maximized, if resizable (only PLATFORM_DESKTOP) */ @@ -222,6 +230,14 @@ class Window { return *this; } + /** + * Set icon for window (multiple images, RGBA 32bit, only PLATFORM_DESKTOP) + */ + inline Window& SetIcons(Image* images, int count) { + ::SetWindowIcons(images, count); + return *this; + } + /** * Set title for window */ @@ -285,6 +301,14 @@ class Window { return *this; } + /** + * Set window focused (only PLATFORM_DESKTOP) + */ + inline Window& SetFocused() { + ::SetWindowFocused(); + return *this; + } + /** * Set window dimensions */ diff --git a/include/raylib.hpp b/include/raylib.hpp index 38b38ff1..1fd071ca 100644 --- a/include/raylib.hpp +++ b/include/raylib.hpp @@ -14,12 +14,14 @@ extern "C" { #include RAYLIB_H_FILE // NOLINT -#if !defined(RAYLIB_VERSION_MAJOR) || !defined(RAYLIB_VERSION_MINOR) || RAYLIB_VERSION_MAJOR < 4 || RAYLIB_VERSION_MINOR < 5 -#error "raylib-cpp requires at least raylib 4.5.0" +#if !defined(RAYLIB_VERSION_MAJOR) || !defined(RAYLIB_VERSION_MINOR) +#if RAYLIB_VERSION_MAJOR < 5 +#error "raylib-cpp requires at least raylib 5.0.0" +#endif #endif -#if RAYLIB_VERSION_MINOR > 5 -#error "raylib-cpp targets raylib 4.5. Use the `next` branch for the next version of raylib." +#if RAYLIB_VERSION_MAJOR > 5 +#error "raylib-cpp targets raylib 5. Use the `next` branch for the next version of raylib." #endif #ifdef __cplusplus diff --git a/package.json b/package.json index 63eb2d95..a53c6d35 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "raylib-cpp", - "version": "4.5.2", + "version": "5.0.0-alpha1", "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 03db0b70..5ff75385 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -8,7 +8,7 @@ if (NOT raylib_FOUND) FetchContent_Declare( raylib GIT_REPOSITORY https://github.com/raysan5/raylib.git - GIT_TAG 4.5.0 + GIT_TAG 5.0 ) FetchContent_MakeAvailable(raylib) endif() @@ -20,7 +20,7 @@ if (NOT raylib_cpp_FOUND) FetchContent_Declare( raylib_cpp GIT_REPOSITORY https://github.com/RobLoach/raylib-cpp.git - GIT_TAG v4.5.1 + GIT_TAG v5.0.0 ) FetchContent_MakeAvailable(raylib_cpp) endif()