Skip to content

Commit

Permalink
Fix -Wdeprecated-literal-operator
Browse files Browse the repository at this point in the history
  • Loading branch information
jhasse committed Jan 3, 2025
1 parent 274ad07 commit 407fd0d
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/jngl/Pixels.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2021-2022 Jan Niklas Hasse <jhasse@bixense.com>
// Copyright 2021-2025 Jan Niklas Hasse <jhasse@bixense.com>
// For conditions of distribution and use, see copyright notice in LICENSE.txt
/// Contains jngl::Pixels class
/// @file
Expand Down Expand Up @@ -37,4 +37,4 @@ Pixels operator/(Pixels, float);

} // namespace jngl

jngl::Pixels operator"" _px(unsigned long long);
jngl::Pixels operator""_px(unsigned long long);
4 changes: 2 additions & 2 deletions src/jngl/Rgb.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 Jan Niklas Hasse <jhasse@bixense.com>
// Copyright 2024-2025 Jan Niklas Hasse <jhasse@bixense.com>
// For conditions of distribution and use, see copyright notice in LICENSE.txt
#include "Rgb.hpp"

Expand Down Expand Up @@ -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<unsigned char>((hex >> 16) % 256),
static_cast<unsigned char>((hex >> 8) % 256),
static_cast<unsigned char>(hex % 256));
Expand Down
4 changes: 2 additions & 2 deletions src/jngl/Rgb.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 Jan Niklas Hasse <jhasse@bixense.com>
// Copyright 2024-2025 Jan Niklas Hasse <jhasse@bixense.com>
// For conditions of distribution and use, see copyright notice in LICENSE.txt
/// Contains jngl::Rgb class
/// @file
Expand Down Expand Up @@ -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);
4 changes: 2 additions & 2 deletions src/jngl/Rgba.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 Jan Niklas Hasse <jhasse@bixense.com>
// Copyright 2024-2025 Jan Niklas Hasse <jhasse@bixense.com>
// For conditions of distribution and use, see copyright notice in LICENSE.txt
#include "Rgba.hpp"

Expand Down Expand Up @@ -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);
}
4 changes: 2 additions & 2 deletions src/jngl/Rgba.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 Jan Niklas Hasse <jhasse@bixense.com>
// Copyright 2024-2025 Jan Niklas Hasse <jhasse@bixense.com>
// For conditions of distribution and use, see copyright notice in LICENSE.txt
/// Contains jngl::Rgba class
/// @file
Expand Down Expand Up @@ -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);
6 changes: 3 additions & 3 deletions src/jngl/ScaleablePixels.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2021-2022 Jan Niklas Hasse <jhasse@bixense.com>
// Copyright 2021-2025 Jan Niklas Hasse <jhasse@bixense.com>
// For conditions of distribution and use, see copyright notice in LICENSE.txt
#include "ScaleablePixels.hpp"

Expand All @@ -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<double>(value));
}
6 changes: 3 additions & 3 deletions src/jngl/ScaleablePixels.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2021-2022 Jan Niklas Hasse <jhasse@bixense.com>
// Copyright 2021-2025 Jan Niklas Hasse <jhasse@bixense.com>
// For conditions of distribution and use, see copyright notice in LICENSE.txt
/// Contains jngl::ScaleablePixels class
/// @file
Expand Down Expand Up @@ -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);
8 changes: 4 additions & 4 deletions src/sdl/window.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2011-2024 Jan Niklas Hasse <jhasse@bixense.com>
// Copyright 2011-2025 Jan Niklas Hasse <jhasse@bixense.com>
// For conditions of distribution and use, see copyright notice in LICENSE.txt

#include "../App.hpp"
Expand Down Expand Up @@ -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<float>(canvasHeight) / impl->actualCanvasHeight));
return std::lround((mousey_ * impl->hidpiScaleFactor -
(impl->actualHeight - static_cast<float>(impl->actualCanvasHeight)) / 2) *
(static_cast<float>(canvasHeight) / impl->actualCanvasHeight));
}

void setCursor(Cursor type) {
Expand Down

0 comments on commit 407fd0d

Please sign in to comment.