Mercurial > molko
changeset 455:c4f31658104d
core: maths -> mlk_maths
author | David Demelier <markand@malikania.fr> |
---|---|
date | Sat, 18 Feb 2023 20:59:48 +0100 |
parents | 3e92d8309933 |
children | a6933cd252b7 |
files | libmlk-core/mlk/core/maths.c libmlk-core/mlk/core/maths.h libmlk-ui/mlk/ui/button.c libmlk-ui/mlk/ui/checkbox.c libmlk-ui/mlk/ui/gridmenu.c |
diffstat | 5 files changed, 7 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/libmlk-core/mlk/core/maths.c Sat Feb 18 20:58:16 2023 +0100 +++ b/libmlk-core/mlk/core/maths.c Sat Feb 18 20:59:48 2023 +0100 @@ -19,7 +19,7 @@ #include "maths.h" int -maths_is_boxed(int x, int y, unsigned int w, unsigned int h, int px, int py) +mlk_maths_is_boxed(int x, int y, unsigned int w, unsigned int h, int px, int py) { return px > x && py > y && @@ -28,7 +28,7 @@ } float -maths_scale(float in, float old_min, float old_max, float new_min, float new_max) +mlk_maths_scale(float in, float old_min, float old_max, float new_min, float new_max) { return (in / ((old_max - old_min) / (new_max - new_min))) + new_min; }
--- a/libmlk-core/mlk/core/maths.h Sat Feb 18 20:58:16 2023 +0100 +++ b/libmlk-core/mlk/core/maths.h Sat Feb 18 20:59:48 2023 +0100 @@ -24,10 +24,10 @@ CORE_BEGIN_DECLS int -maths_is_boxed(int, int, unsigned int, unsigned int, int, int); +mlk_maths_is_boxed(int, int, unsigned int, unsigned int, int, int); float -maths_scale(float, float, float, float, float); +mlk_maths_scale(float, float, float, float, float); CORE_END_DECLS
--- a/libmlk-ui/mlk/ui/button.c Sat Feb 18 20:58:16 2023 +0100 +++ b/libmlk-ui/mlk/ui/button.c Sat Feb 18 20:59:48 2023 +0100 @@ -36,7 +36,7 @@ assert(click); assert(click->type == MLK_EVENT_CLICKDOWN || click->type == MLK_EVENT_CLICKUP); - return maths_is_boxed(button->x, button->y, button->w, button->h, + return mlk_maths_is_boxed(button->x, button->y, button->w, button->h, click->x, click->y); }
--- a/libmlk-ui/mlk/ui/checkbox.c Sat Feb 18 20:58:16 2023 +0100 +++ b/libmlk-ui/mlk/ui/checkbox.c Sat Feb 18 20:59:48 2023 +0100 @@ -33,7 +33,7 @@ assert(cb); assert(click && click->type == MLK_EVENT_CLICKDOWN); - return maths_is_boxed(cb->x, cb->y, cb->w, cb->h, click->x, click->y); + return mlk_maths_is_boxed(cb->x, cb->y, cb->w, cb->h, click->x, click->y); } void
--- a/libmlk-ui/mlk/ui/gridmenu.c Sat Feb 18 20:58:16 2023 +0100 +++ b/libmlk-ui/mlk/ui/gridmenu.c Sat Feb 18 20:59:48 2023 +0100 @@ -206,7 +206,7 @@ x = menu->x + theme->padding + (c * menu->eltw) + (c * menu->spacew); y = menu->y + theme->padding + (r * menu->elth) + (r * menu->spaceh); - if (maths_is_boxed(x, y, menu->eltw, menu->elth, click->x, click->y)) { + if (mlk_maths_is_boxed(x, y, menu->eltw, menu->elth, click->x, click->y)) { selected = c + r * menu->ncols; selected += pagesz * pagenr;