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
|
#ifndef VGLTF_PLATFORM_H
#define VGLTF_PLATFORM_H
#include "log.h"
#include <stdint.h>
#include <stdlib.h>
#define VGLTF_PANIC(...) \
do { \
VGLTF_LOG_ERR("panic: " __VA_ARGS__); \
exit(1); \
} while (0)
enum vgltf_event_type {
VGLTF_EVENT_QUIT,
VGLTF_EVENT_KEY_DOWN,
VGLTF_EVENT_UNKNOWN,
};
enum vgltf_key {
VGLTF_KEY_A,
VGLTF_KEY_B,
VGLTF_KEY_C,
VGLTF_KEY_D,
VGLTF_KEY_E,
VGLTF_KEY_F,
VGLTF_KEY_G,
VGLTF_KEY_H,
VGLTF_KEY_I,
VGLTF_KEY_J,
VGLTF_KEY_K,
VGLTF_KEY_L,
VGLTF_KEY_M,
VGLTF_KEY_N,
VGLTF_KEY_O,
VGLTF_KEY_P,
VGLTF_KEY_Q,
VGLTF_KEY_R,
VGLTF_KEY_S,
VGLTF_KEY_T,
VGLTF_KEY_U,
VGLTF_KEY_V,
VGLTF_KEY_W,
VGLTF_KEY_X,
VGLTF_KEY_Y,
VGLTF_KEY_Z,
VGLTF_KEY_ESCAPE,
VGLTF_KEY_UNKNOWN
};
struct vgltf_key_event {
enum vgltf_key key;
};
struct vgltf_event {
enum vgltf_event_type type;
union {
struct vgltf_key_event key;
};
};
struct vgltf_window_size {
int width;
int height;
};
struct vgltf_platform;
bool vgltf_platform_init(struct vgltf_platform *platform);
void vgltf_platform_deinit(struct vgltf_platform *platform);
bool vgltf_platform_poll_event(struct vgltf_platform *platform,
struct vgltf_event *event);
bool vgltf_platform_get_window_size(struct vgltf_platform *platform,
struct vgltf_window_size *window_size);
// Vulkan specifics
#include "vulkan/vulkan_core.h"
char const *const *
vgltf_platform_get_vulkan_instance_extensions(struct vgltf_platform *platform,
uint32_t *count);
bool vgltf_platform_create_vulkan_surface(struct vgltf_platform *platform,
VkInstance instance,
VkSurfaceKHR *surface);
#include "platform_sdl.h"
#endif // VGLTF_PLATFORM_H
|