-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsprite.h
44 lines (36 loc) · 884 Bytes
/
sprite.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#pragma once
#include <stdbool.h>
#include <stddef.h>
#include <gui/canvas.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct Sprite Sprite;
/** Sprite allocator
* @return Sprite* Sprite instance or NULL, if failed
*/
Sprite* sprite_alloc(const char* path);
/** Sprite deallocator
* @param sprite Sprite instance
*/
void sprite_free(Sprite* sprite);
/** Get sprite width
* @param sprite Sprite instance
* @return size_t sprite width
*/
size_t sprite_get_width(Sprite* sprite);
/** Get sprite height
* @param sprite Sprite instance
* @return size_t sprite height
*/
size_t sprite_get_height(Sprite* sprite);
/** Draw sprite on canvas
* @param canvas Canvas instance
* @param sprite Sprite instance
* @param x x coordinate
* @param y y coordinate
*/
void canvas_draw_sprite(Canvas* canvas, Sprite* sprite, int32_t x, int32_t y);
#ifdef __cplusplus
}
#endif