Skip to content

Commit 5356019

Browse files
authored
Merge pull request #21 from w0lek/mingw
replace M_PI with std::numbers::pi, bump c++ standart to c++20
2 parents 99cb084 + 2883cb3 commit 5356019

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ target_link_libraries(
7171

7272
# add_compile_options does not seem to be working on the UG machines,
7373
# and we cannot set target properties in version 3.0.2
74-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
74+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++20")
7575

7676
if(EZGL_BUILD_EXAMPLES)
7777
add_subdirectory(examples)

src/graphics.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
#include <cassert>
2222
#include <glib.h>
23+
#include <numbers>
2324

2425
namespace ezgl {
2526

@@ -295,7 +296,7 @@ void renderer::set_text_rotation(double degrees)
295296
// Check for them before changing the angle.
296297
if (degrees >= -360. && degrees <= 360.) {
297298
// convert the given angle to rad
298-
rotation_angle = -degrees * M_PI / 180;
299+
rotation_angle = -degrees * std::numbers::pi / 180;
299300
}
300301
else {
301302
g_warning("set_text_rotation: bad rotation angle of %f. Ignored!", degrees);
@@ -697,12 +698,12 @@ void renderer::draw_arc_path(point2d center,
697698
// draw the arc in counter clock-wise direction if the extent angle is positive
698699
if(extent_angle >= 0) {
699700
cairo_arc_negative(
700-
m_cairo, center.x, center.y, radius, -start_angle * M_PI / 180, -end_angle * M_PI / 180);
701+
m_cairo, center.x, center.y, radius, -start_angle * std::numbers::pi / 180, -end_angle * std::numbers::pi / 180);
701702
}
702703
// draw the arc in clock-wise direction if the extent angle is negative
703704
else {
704705
cairo_arc(
705-
m_cairo, center.x, center.y, radius, -start_angle * M_PI / 180, -end_angle * M_PI / 180);
706+
m_cairo, center.x, center.y, radius, -start_angle * std::numbers::pi / 180, -end_angle * std::numbers::pi / 180);
706707
}
707708

708709
// if the arc will be filled in, return back to the center of the arc

0 commit comments

Comments
 (0)