1 #ifndef INCLUDED_JUMPNRUN_ITEMS_H
2 #define INCLUDED_JUMPNRUN_ITEMS_H
4 #include "../ui/sprite.h"
5 #include "../util/rectangle.h"
7 struct jumpnrun_game_state
;
12 JUMPNRUN_ITEM_COLLECTED
= 1
15 typedef struct jumpnrun_item_type
{
17 void (*on_collect
)(struct jumpnrun_item
*item
,
18 struct jumpnrun_game_state
*state
,
19 struct jumpnrun_level
*lv
);
22 typedef struct jumpnrun_item
{
25 jumpnrun_item_type
const *type
;
28 static inline rectangle
rect_from_item(jumpnrun_item
const *item
) {
29 rectangle r
= { item
->pos
, { FIXED_POINT(item
->type
->sprite
.width
, 0), FIXED_POINT(item
->type
->sprite
.height
, 0) } };
33 /************************************/
36 JUMPNRUN_ITEM_TYPE_DOCUMENT
,
37 JUMPNRUN_ITEM_TYPE_CHECKPOINT
,
38 JUMPNRUN_ITEM_TYPE_KEY
,
39 JUMPNRUN_ITEM_TYPE_ENCRYPTED_DOCUMENT
,
41 JUMPNRUN_ITEM_TYPE_COUNT
44 extern jumpnrun_item_type
const jumpnrun_item_type_data
[JUMPNRUN_ITEM_TYPE_COUNT
];