diff options
author | Franklin Wei <franklin@rockbox.org> | 2024-07-22 21:43:25 -0400 |
---|---|---|
committer | Franklin Wei <franklin@rockbox.org> | 2024-07-22 21:44:08 -0400 |
commit | 09aa8de52cb962f1ceebfb1fd44f2c54a924fc5c (patch) | |
tree | 182bd4efb2dc8ca4fcb369d8cccab0c0f290d054 /apps/plugins/puzzles/src/drawing.c | |
parent | c72030f98c953a82ed6f5c7132ad000c3d5f4a16 (diff) | |
download | rockbox-09aa8de52cb962f1ceebfb1fd44f2c54a924fc5c.tar.gz rockbox-09aa8de52cb962f1ceebfb1fd44f2c54a924fc5c.zip |
puzzles: resync with upstream
This brings the puzzles source in sync with Simon's branch, commit fd304c5
(from March 2024), with some added Rockbox-specific compatibility changes:
https://www.franklinwei.com/git/puzzles/commit/?h=rockbox-devel&id=516830d9d76bdfe64fe5ccf2a9b59c33f5c7c078
There are quite a lot of backend changes, including a new "Mosaic" puzzle.
In addition, some new frontend changes were necessary:
- New "Preferences" menu to access the user preferences system.
- Enabled spacebar input for several games.
Change-Id: I94c7df674089c92f32d5f07025f6a1059068af1e
Diffstat (limited to 'apps/plugins/puzzles/src/drawing.c')
-rw-r--r-- | apps/plugins/puzzles/src/drawing.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/apps/plugins/puzzles/src/drawing.c b/apps/plugins/puzzles/src/drawing.c index a8eb8cfd5f..2c8816c31a 100644 --- a/apps/plugins/puzzles/src/drawing.c +++ b/apps/plugins/puzzles/src/drawing.c | |||
@@ -27,7 +27,11 @@ | |||
27 | #include <stdlib.h> | 27 | #include <stdlib.h> |
28 | #include <string.h> | 28 | #include <string.h> |
29 | #include <assert.h> | 29 | #include <assert.h> |
30 | #include <math.h> | 30 | #ifdef NO_TGMATH_H |
31 | # include <math.h> | ||
32 | #else | ||
33 | # include <tgmath.h> | ||
34 | #endif | ||
31 | 35 | ||
32 | #include "puzzles.h" | 36 | #include "puzzles.h" |
33 | 37 | ||
@@ -90,8 +94,8 @@ void draw_line(drawing *dr, int x1, int y1, int x2, int y2, int colour) | |||
90 | void draw_thick_line(drawing *dr, float thickness, | 94 | void draw_thick_line(drawing *dr, float thickness, |
91 | float x1, float y1, float x2, float y2, int colour) | 95 | float x1, float y1, float x2, float y2, int colour) |
92 | { | 96 | { |
93 | if (thickness < 1.0) | 97 | if (thickness < 1.0F) |
94 | thickness = 1.0; | 98 | thickness = 1.0F; |
95 | if (dr->api->draw_thick_line) { | 99 | if (dr->api->draw_thick_line) { |
96 | dr->api->draw_thick_line(dr->handle, thickness, | 100 | dr->api->draw_thick_line(dr->handle, thickness, |
97 | x1, y1, x2, y2, colour); | 101 | x1, y1, x2, y2, colour); |
@@ -101,8 +105,8 @@ void draw_thick_line(drawing *dr, float thickness, | |||
101 | * polygon rendering uses integer coordinates. | 105 | * polygon rendering uses integer coordinates. |
102 | */ | 106 | */ |
103 | float len = sqrt((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1)); | 107 | float len = sqrt((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1)); |
104 | float tvhatx = (x2 - x1)/len * (thickness/2 - 0.2); | 108 | float tvhatx = (x2 - x1)/len * (thickness/2 - 0.2F); |
105 | float tvhaty = (y2 - y1)/len * (thickness/2 - 0.2); | 109 | float tvhaty = (y2 - y1)/len * (thickness/2 - 0.2F); |
106 | int p[8]; | 110 | int p[8]; |
107 | 111 | ||
108 | p[0] = x1 - tvhaty; | 112 | p[0] = x1 - tvhaty; |
@@ -117,7 +121,7 @@ void draw_thick_line(drawing *dr, float thickness, | |||
117 | } | 121 | } |
118 | } | 122 | } |
119 | 123 | ||
120 | void draw_polygon(drawing *dr, int *coords, int npoints, | 124 | void draw_polygon(drawing *dr, const int *coords, int npoints, |
121 | int fillcolour, int outlinecolour) | 125 | int fillcolour, int outlinecolour) |
122 | { | 126 | { |
123 | dr->api->draw_polygon(dr->handle, coords, npoints, fillcolour, | 127 | dr->api->draw_polygon(dr->handle, coords, npoints, fillcolour, |