From 872556df9426350a418366fb3ca02a14b5d073ff Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Wed, 18 Dec 2024 02:31:48 -0500 Subject: [PATCH] Fix some example C++ Warnings --- examples/core/core_drop_files.cpp | 2 +- examples/core/core_loading_thread.cpp | 2 +- examples/core/core_window_letterbox.cpp | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/examples/core/core_drop_files.cpp b/examples/core/core_drop_files.cpp index 219b84be..fd4806ee 100644 --- a/examples/core/core_drop_files.cpp +++ b/examples/core/core_drop_files.cpp @@ -48,7 +48,7 @@ int main() { raylib::DrawText("Dropped files:", 100, 40, 20, DARKGRAY); // Iterate through all the dropped files. - for (int i = 0; i < droppedFiles.size(); i++) { + for (int i = 0; i < (int)droppedFiles.size(); i++) { if (i % 2 == 0) DrawRectangle(0, 85 + 40*i, screenWidth, 40, Fade(LIGHTGRAY, 0.5f)); else diff --git a/examples/core/core_loading_thread.cpp b/examples/core/core_loading_thread.cpp index 1d01e76a..c0e7fef6 100644 --- a/examples/core/core_loading_thread.cpp +++ b/examples/core/core_loading_thread.cpp @@ -55,7 +55,7 @@ int main(void) threadId = std::thread(LoadDataThread); TraceLog(LOG_INFO, "Loading thread initialized successfully"); - } catch (std::system_error e) { + } catch (std::system_error& e) { TraceLog(LOG_ERROR, "Error: %s", e.what()); } diff --git a/examples/core/core_window_letterbox.cpp b/examples/core/core_window_letterbox.cpp index aeb166fe..d5a15bc8 100644 --- a/examples/core/core_window_letterbox.cpp +++ b/examples/core/core_window_letterbox.cpp @@ -41,7 +41,7 @@ int main(void) raylib::RenderTexture2D target(gameScreenWidth, gameScreenHeight); target.GetTexture().SetFilter(TEXTURE_FILTER_BILINEAR); // Texture scale filter to use - raylib::Color colors[10] = { 0 }; + raylib::Color colors[10]; for (int i = 0; i < 10; i++) { colors[i] = raylib::Color((unsigned char)GetRandomValue(100, 250), (unsigned char)GetRandomValue(50, 150), (unsigned char)GetRandomValue(10, 100), 255); } @@ -60,7 +60,9 @@ int main(void) if (IsKeyPressed(KEY_SPACE)) { // Recalculate random colors for the bars - for (int i = 0; i < 10; i++) colors[i] = (Color){ (unsigned char)GetRandomValue(100, 250), (unsigned char)GetRandomValue(50, 150), (unsigned char)GetRandomValue(10, 100), 255 }; + for (int i = 0; i < 10; i++) { + colors[i] = raylib::Color((unsigned char)GetRandomValue(100, 250), (unsigned char)GetRandomValue(50, 150), (unsigned char)GetRandomValue(10, 100), 255); + } } // Update virtual mouse (clamped mouse value behind game screen)