comparison src/libmlk-core/core/action.h @ 369:1e06f871dc63

core: split action and action_stack
author David Demelier <markand@malikania.fr>
date Sun, 24 Oct 2021 17:33:12 +0200
parents 19782ea1cf4a
children 460c78706989
comparison
equal deleted inserted replaced
368:15bdac29ba4b 369:1e06f871dc63
19 #ifndef MLK_CORE_ACTION_H 19 #ifndef MLK_CORE_ACTION_H
20 #define MLK_CORE_ACTION_H 20 #define MLK_CORE_ACTION_H
21 21
22 #include "core.h" 22 #include "core.h"
23 23
24 #define ACTION_STACK_MAX (128)
25
26 union event; 24 union event;
27 25
28 struct action { 26 struct action {
29 void *data; 27 void *data;
30 void (*handle)(struct action *, const union event *); 28 void (*handle)(struct action *, const union event *);
31 int (*update)(struct action *, unsigned int); 29 int (*update)(struct action *, unsigned int);
32 void (*draw)(struct action *); 30 void (*draw)(struct action *);
33 void (*end)(struct action *); 31 void (*end)(struct action *);
34 void (*finish)(struct action *); 32 void (*finish)(struct action *);
35 };
36
37 struct action_stack {
38 struct action *actions[ACTION_STACK_MAX];
39 }; 33 };
40 34
41 CORE_BEGIN_DECLS 35 CORE_BEGIN_DECLS
42 36
43 void 37 void
53 action_end(struct action *); 47 action_end(struct action *);
54 48
55 void 49 void
56 action_finish(struct action *); 50 action_finish(struct action *);
57 51
58 void
59 action_stack_init(struct action_stack *);
60
61 int
62 action_stack_add(struct action_stack *, struct action *);
63
64 void
65 action_stack_handle(struct action_stack *, const union event *);
66
67 int
68 action_stack_update(struct action_stack *, unsigned int);
69
70 void
71 action_stack_draw(const struct action_stack *);
72
73 int
74 action_stack_completed(const struct action_stack *);
75
76 void
77 action_stack_finish(struct action_stack *);
78
79 CORE_END_DECLS 52 CORE_END_DECLS
80 53
81 #endif /* !MLK_CORE_ACTION_H */ 54 #endif /* !MLK_CORE_ACTION_H */