Mercurial > molko
changeset 483:6c06c82d276a
misc: objects can no longer be transformed to action/drawable
It is not convenient if the user wants to provide its own variant of a function
as it will be unable to use its own data and the underlying data as well.
author | David Demelier <markand@malikania.fr> |
---|---|
date | Mon, 27 Feb 2023 18:19:38 +0100 |
parents | f78455f45bf6 |
children | f14b8290b3ce |
files | libmlk-core/mlk/core/animation.c libmlk-core/mlk/core/animation.h libmlk-rpg/mlk/rpg/message.c libmlk-rpg/mlk/rpg/message.h |
diffstat | 4 files changed, 0 insertions(+), 79 deletions(-) [+] |
line wrap: on
line diff
--- a/libmlk-core/mlk/core/animation.c Mon Feb 27 18:03:16 2023 +0100 +++ b/libmlk-core/mlk/core/animation.c Mon Feb 27 18:19:38 2023 +0100 @@ -19,22 +19,9 @@ #include <assert.h> #include <string.h> -#include "drawable.h" #include "animation.h" #include "sprite.h" -static int -update(struct mlk_drawable *dw, unsigned int ticks) -{ - return mlk_animation_update(dw->data, ticks); -} - -static void -draw(struct mlk_drawable *dw) -{ - mlk_animation_draw(dw->data, dw->x, dw->y); -} - void mlk_animation_init(struct mlk_animation *an, const struct mlk_sprite *sprite, unsigned int delay) { @@ -101,20 +88,3 @@ return mlk_sprite_draw(an->sprite, an->row, an->column, x, y); } - -void -mlk_animation_drawable(struct mlk_animation *an, struct mlk_drawable *dw, int x, int y) -{ - assert(an); - assert(dw); - - memset(dw, 0, sizeof (*dw)); - - dw->data = an; - dw->x = x - (an->sprite->cellw / 2); - dw->y = y - (an->sprite->cellh / 2); - dw->update = update; - dw->draw = draw; - - mlk_animation_start(an); -}
--- a/libmlk-core/mlk/core/animation.h Mon Feb 27 18:03:16 2023 +0100 +++ b/libmlk-core/mlk/core/animation.h Mon Feb 27 18:19:38 2023 +0100 @@ -21,7 +21,6 @@ #include "core.h" -struct mlk_drawable; struct mlk_sprite; struct mlk_animation { @@ -49,9 +48,6 @@ int mlk_animation_draw(const struct mlk_animation *, int, int); -void -mlk_animation_drawable(struct mlk_animation *, struct mlk_drawable *, int, int); - MLK_CORE_END_DECLS #endif /* !MLK_CORE_ANIMATION_H */
--- a/libmlk-rpg/mlk/rpg/message.c Mon Feb 27 18:03:16 2023 +0100 +++ b/libmlk-rpg/mlk/rpg/message.c Mon Feb 27 18:19:38 2023 +0100 @@ -20,7 +20,6 @@ #include <stdlib.h> #include <string.h> -#include <mlk/core/action.h> #include <mlk/core/event.h> #include <mlk/core/font.h> #include <mlk/core/maths.h> @@ -40,31 +39,6 @@ #define THEME(msg) (msg->theme ? msg->theme : theme_default()) static void -handle(struct mlk_action *action, const union mlk_event *ev) -{ - assert(action); - assert(ev); - - message_handle(action->data, ev); -} - -static int -update(struct mlk_action *action, unsigned int ticks) -{ - assert(action); - - return message_update(action->data, ticks); -} - -static void -draw(struct mlk_action *action) -{ - assert(action); - - message_draw(action->data); -} - -static void draw_frame(const struct message *msg) { assert(msg); @@ -299,18 +273,3 @@ msg->state = MESSAGE_STATE_HIDING; msg->elapsed = 0; } - -void -message_action(struct message *msg, struct mlk_action *action) -{ - assert(msg); - assert(action); - - memset(action, 0, sizeof (struct mlk_action)); - action->data = msg; - action->handle = handle; - action->update = update; - action->draw = draw; - - message_start(msg); -}
--- a/libmlk-rpg/mlk/rpg/message.h Mon Feb 27 18:03:16 2023 +0100 +++ b/libmlk-rpg/mlk/rpg/message.h Mon Feb 27 18:19:38 2023 +0100 @@ -22,7 +22,6 @@ #include <mlk/core/core.h> #include <mlk/core/texture.h> -struct mlk_action; struct mlk_font; struct theme; @@ -83,9 +82,6 @@ void message_hide(struct message *msg); -void -message_action(struct message *msg, struct mlk_action *act); - MLK_CORE_END_DECLS #endif /* !MLK_RPG_MESSAGE_H */