From 407fd0d57a526e0ab2ffa7e0ba2765038960b351 Mon Sep 17 00:00:00 2001 From: Jan Niklas Hasse Date: Fri, 3 Jan 2025 18:08:56 +0100 Subject: [PATCH] Fix -Wdeprecated-literal-operator --- src/jngl/Pixels.hpp | 4 ++-- src/jngl/Rgb.cpp | 4 ++-- src/jngl/Rgb.hpp | 4 ++-- src/jngl/Rgba.cpp | 4 ++-- src/jngl/Rgba.hpp | 4 ++-- src/jngl/ScaleablePixels.cpp | 6 +++--- src/jngl/ScaleablePixels.hpp | 6 +++--- src/sdl/window.cpp | 8 ++++---- 8 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/jngl/Pixels.hpp b/src/jngl/Pixels.hpp index 864d6545a..e9467b6ab 100644 --- a/src/jngl/Pixels.hpp +++ b/src/jngl/Pixels.hpp @@ -1,4 +1,4 @@ -// Copyright 2021-2022 Jan Niklas Hasse +// Copyright 2021-2025 Jan Niklas Hasse // For conditions of distribution and use, see copyright notice in LICENSE.txt /// Contains jngl::Pixels class /// @file @@ -37,4 +37,4 @@ Pixels operator/(Pixels, float); } // namespace jngl -jngl::Pixels operator"" _px(unsigned long long); +jngl::Pixels operator""_px(unsigned long long); diff --git a/src/jngl/Rgb.cpp b/src/jngl/Rgb.cpp index d4a898504..b62fb1840 100644 --- a/src/jngl/Rgb.cpp +++ b/src/jngl/Rgb.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 Jan Niklas Hasse +// Copyright 2024-2025 Jan Niklas Hasse // For conditions of distribution and use, see copyright notice in LICENSE.txt #include "Rgb.hpp" @@ -56,7 +56,7 @@ Rgb interpolate(Rgb a, Rgb b, float t) { } // namespace jngl -jngl::Rgb operator"" _rgb(const unsigned long long hex) { +jngl::Rgb operator""_rgb(const unsigned long long hex) { return jngl::Rgb::u8(static_cast((hex >> 16) % 256), static_cast((hex >> 8) % 256), static_cast(hex % 256)); diff --git a/src/jngl/Rgb.hpp b/src/jngl/Rgb.hpp index 87e52b2e0..c622d9fdd 100644 --- a/src/jngl/Rgb.hpp +++ b/src/jngl/Rgb.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 Jan Niklas Hasse +// Copyright 2024-2025 Jan Niklas Hasse // For conditions of distribution and use, see copyright notice in LICENSE.txt /// Contains jngl::Rgb class /// @file @@ -56,4 +56,4 @@ Rgb interpolate(Rgb a, Rgb b, float t); } // namespace jngl /// Create a jngl::Rgb object from a literal. E.g. `0x00ff00_rgb` for green. -jngl::Rgb operator"" _rgb(unsigned long long); +jngl::Rgb operator""_rgb(unsigned long long); diff --git a/src/jngl/Rgba.cpp b/src/jngl/Rgba.cpp index c998c9e1f..c7a6742af 100644 --- a/src/jngl/Rgba.cpp +++ b/src/jngl/Rgba.cpp @@ -1,4 +1,4 @@ -// Copyright 2024 Jan Niklas Hasse +// Copyright 2024-2025 Jan Niklas Hasse // For conditions of distribution and use, see copyright notice in LICENSE.txt #include "Rgba.hpp" @@ -77,6 +77,6 @@ Rgba interpolate(Rgba a, Rgba b, float t) { } // namespace jngl -jngl::Rgba operator"" _rgba(const unsigned long long hex) { +jngl::Rgba operator""_rgba(const unsigned long long hex) { return jngl::Rgba::u8((hex >> 24) % 256, (hex >> 16) % 256, (hex >> 8) % 256, hex % 256); } diff --git a/src/jngl/Rgba.hpp b/src/jngl/Rgba.hpp index 21bc48518..817393270 100644 --- a/src/jngl/Rgba.hpp +++ b/src/jngl/Rgba.hpp @@ -1,4 +1,4 @@ -// Copyright 2024 Jan Niklas Hasse +// Copyright 2024-2025 Jan Niklas Hasse // For conditions of distribution and use, see copyright notice in LICENSE.txt /// Contains jngl::Rgba class /// @file @@ -73,4 +73,4 @@ Rgba interpolate(Rgba a, Rgba b, float t); } // namespace jngl /// Create a jngl::Rgba object from a literal. E.g. `0x00ff00_rgb` for green. -jngl::Rgba operator"" _rgba(unsigned long long); +jngl::Rgba operator""_rgba(unsigned long long); diff --git a/src/jngl/ScaleablePixels.cpp b/src/jngl/ScaleablePixels.cpp index bb9c730ad..191a2ecf3 100644 --- a/src/jngl/ScaleablePixels.cpp +++ b/src/jngl/ScaleablePixels.cpp @@ -1,4 +1,4 @@ -// Copyright 2021-2022 Jan Niklas Hasse +// Copyright 2021-2025 Jan Niklas Hasse // For conditions of distribution and use, see copyright notice in LICENSE.txt #include "ScaleablePixels.hpp" @@ -20,10 +20,10 @@ ScaleablePixels::operator Pixels() const { } // namespace jngl -jngl::ScaleablePixels operator "" _sp(const long double value) { +jngl::ScaleablePixels operator ""_sp(const long double value) { return jngl::ScaleablePixels(value); } -jngl::ScaleablePixels operator "" _sp(const unsigned long long value) { +jngl::ScaleablePixels operator ""_sp(const unsigned long long value) { return jngl::ScaleablePixels(static_cast(value)); } diff --git a/src/jngl/ScaleablePixels.hpp b/src/jngl/ScaleablePixels.hpp index 9e444fe90..51a1977cf 100644 --- a/src/jngl/ScaleablePixels.hpp +++ b/src/jngl/ScaleablePixels.hpp @@ -1,4 +1,4 @@ -// Copyright 2021-2022 Jan Niklas Hasse +// Copyright 2021-2025 Jan Niklas Hasse // For conditions of distribution and use, see copyright notice in LICENSE.txt /// Contains jngl::ScaleablePixels class /// @file @@ -28,5 +28,5 @@ class ScaleablePixels { } // namespace jngl -jngl::ScaleablePixels operator"" _sp(long double); -jngl::ScaleablePixels operator"" _sp(unsigned long long); +jngl::ScaleablePixels operator""_sp(long double); +jngl::ScaleablePixels operator""_sp(unsigned long long); diff --git a/src/sdl/window.cpp b/src/sdl/window.cpp index 354b69517..3903f3f30 100644 --- a/src/sdl/window.cpp +++ b/src/sdl/window.cpp @@ -1,4 +1,4 @@ -// Copyright 2011-2024 Jan Niklas Hasse +// Copyright 2011-2025 Jan Niklas Hasse // For conditions of distribution and use, see copyright notice in LICENSE.txt #include "../App.hpp" @@ -531,9 +531,9 @@ int Window::getMouseY() const { if (relativeMouseMode) { return mousey_ * impl->hidpiScaleFactor; } - return std::lround( - (mousey_ * impl->hidpiScaleFactor - (impl->actualHeight - impl->actualCanvasHeight) / 2) * - (static_cast(canvasHeight) / impl->actualCanvasHeight)); + return std::lround((mousey_ * impl->hidpiScaleFactor - + (impl->actualHeight - static_cast(impl->actualCanvasHeight)) / 2) * + (static_cast(canvasHeight) / impl->actualCanvasHeight)); } void setCursor(Cursor type) {