summaryrefslogtreecommitdiffhomepage
path: root/include/rodeo_types.h
blob: 18c36910663a74f5a39b4b33b61b672de6fdb820 (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
101
102
103
104
105
106
107
108
109
110
#pragma once

// system
#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>

typedef struct irodeo_texture_internal_t irodeo_texture_internal_t;
typedef irodeo_texture_internal_t *rodeo_texture_internal_p;

typedef union
{
	struct {
		float red;
		float green;
		float blue;
		float alpha;
	};
	float array[4];
}
rodeo_color_RGBAFloat_t;

typedef union
{
	struct
	{
		uint8_t red;
		uint8_t green;
		uint8_t blue;
		uint8_t alpha;
	};
	uint32_t rgba;
	uint8_t array[4];
}
rodeo_color_RGBA8_t;


typedef struct
{
	float x;
	float y;
	float z;
	rodeo_color_RGBAFloat_t color;
	//float red;
	//float green;
	//float blue;
	//float alpha;
	float texture_x;
	float texture_y;
	float texture_id;
}
rodeo_vertex_t;

typedef
void
(*rodeo_mainLoop_function)(void);

typedef struct
{
	float x;
	float y;
	float width;
	float height;
}
rodeo_rectangle_t;

typedef struct
{
	rodeo_texture_internal_p internal_texture;
	uint32_t width;
	uint32_t height;
}
rodeo_texture_2d_t;

/*
typedef struct
{
	rodeo_texture_2d_t texture;
	rodeo_frameBuffer_internal_p internal_frame_buffer;
}
rodeo_frameBuffer_2d_t;
*/

/// --- String ---

// taken from STC library
// must match their layout exactly as it will be cast to it.
// (TODO should write test cases for the string funcs)
typedef char rodeo_string_value_t;
typedef struct { rodeo_string_value_t* data; intptr_t size, cap; } rodeo_string_buffer_t;
typedef union {
    struct { rodeo_string_value_t data[sizeof(rodeo_string_buffer_t) - 1]; unsigned char size; } sml;
    struct { rodeo_string_value_t* data; size_t size, ncap; } lon;
} rodeo_string_t;

/// --- Log ---

typedef enum
{
	rodeo_logLevel_info,
	rodeo_logLevel_warning,
	rodeo_logLevel_error
}
rodeo_logLevel_t;

typedef
void
(*rodeo_log_function)(rodeo_string_t text);