From 09aa8de52cb962f1ceebfb1fd44f2c54a924fc5c Mon Sep 17 00:00:00 2001 From: Franklin Wei Date: Mon, 22 Jul 2024 21:43:25 -0400 Subject: 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 --- apps/plugins/puzzles/src/drawing.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'apps/plugins/puzzles/src/drawing.c') 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 @@ #include #include #include -#include +#ifdef NO_TGMATH_H +# include +#else +# include +#endif #include "puzzles.h" @@ -90,8 +94,8 @@ void draw_line(drawing *dr, int x1, int y1, int x2, int y2, int colour) void draw_thick_line(drawing *dr, float thickness, float x1, float y1, float x2, float y2, int colour) { - if (thickness < 1.0) - thickness = 1.0; + if (thickness < 1.0F) + thickness = 1.0F; if (dr->api->draw_thick_line) { dr->api->draw_thick_line(dr->handle, thickness, x1, y1, x2, y2, colour); @@ -101,8 +105,8 @@ void draw_thick_line(drawing *dr, float thickness, * polygon rendering uses integer coordinates. */ float len = sqrt((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1)); - float tvhatx = (x2 - x1)/len * (thickness/2 - 0.2); - float tvhaty = (y2 - y1)/len * (thickness/2 - 0.2); + float tvhatx = (x2 - x1)/len * (thickness/2 - 0.2F); + float tvhaty = (y2 - y1)/len * (thickness/2 - 0.2F); int p[8]; p[0] = x1 - tvhaty; @@ -117,7 +121,7 @@ void draw_thick_line(drawing *dr, float thickness, } } -void draw_polygon(drawing *dr, int *coords, int npoints, +void draw_polygon(drawing *dr, const int *coords, int npoints, int fillcolour, int outlinecolour) { dr->api->draw_polygon(dr->handle, coords, npoints, fillcolour, -- cgit v1.2.3