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
;
9 typedef struct jumpnrun_item_type
{
11 void (*on_collect
)(struct jumpnrun_game_state
*state
);
14 typedef struct jumpnrun_item
{
16 jumpnrun_item_type
const *type
;
19 static inline rectangle
rect_from_item(jumpnrun_item
const *item
) {
20 rectangle r
= { item
->pos
, { FIXED_POINT(item
->type
->sprite
.width
, 0), FIXED_POINT(item
->type
->sprite
.height
, 0) } };
24 /************************************/
27 JUMPNRUN_ITEM_TYPE_DOCUMENT
,
29 JUMPNRUN_ITEM_TYPE_COUNT
32 extern jumpnrun_item_type
const jumpnrun_item_type_data
[JUMPNRUN_ITEM_TYPE_COUNT
];