summaryrefslogtreecommitdiffhomepage
path: root/include/rodeo/gfx.h
blob: 151bdda33f148dc4c9796ba7b14ef963a5afd779 (plain)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#pragma once

// -- internal --
// public
#include "rodeo/gfx_t.h"

// -- external --
#include "stc/cstr.h"

void
rodeo_gfx_init(float width, float height);

void
rodeo_gfx_deinit(void);

void
rodeo_gfx_frame_begin(void);

void
rodeo_gfx_frame_end(void);

cstr
rodeo_gfx_renderer_name_get(void);

void
rodeo_gfx_renderer_flush(void);

rodeo_gfx_texture_2d_t
rodeo_gfx_texture_2d_default_get(void);

rodeo_gfx_texture_2d_t
rodeo_gfx_texture_2d_create_from_RGBA8(
	const uint16_t width,
	const uint16_t height,
	const uint8_t memory[]
);

rodeo_gfx_texture_2d_t
rodeo_gfx_texture_2d_create_from_path(cstr path);

void
rodeo_gfx_texture_2d_destroy(rodeo_gfx_texture_2d_t texture);

void
rodeo_gfx_rectangle_draw(
	const rodeo_rectangle_t rectangle,
	const rodeo_color_RGBAFloat_t color
);

void
rodeo_gfx_texture_2d_draw(
	const rodeo_rectangle_t destination,
	const rodeo_rectangle_t source,
	const rodeo_color_RGBAFloat_t color,
	const rodeo_gfx_texture_2d_t texture
);

void
rodeo_gfx_renderer_flush(void);

uint32_t
rodeo_gfx_frame_limit_get(void);

cstr
rodeo_gfx_renderer_name_get(void);

uint64_t
rodeo_gfx_frame_count_get(void);

float
rodeo_gfx_frame_time_get(void);

float
rodeo_gfx_frame_perSecond_get(void);

void
rodeo_gfx_frame_limit_set(uint32_t limit);

uint32_t
rodeo_gfx_frame_limit_get(void);

#define									\
mrodeo_gfx_do(							\
	width,								\
	height								\
)										\
	mrodeo_defer_do(					\
		rodeo_gfx_init(width, height),	\
		rodeo_gfx_deinit()				\
	)


#define								\
mrodeo_gfx_frame_do(				\
)									\
	mrodeo_defer_do(				\
		rodeo_gfx_frame_begin(),	\
		rodeo_gfx_frame_end()		\
	)