-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy patheneida.c
75 lines (61 loc) · 1.65 KB
/
eneida.c
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
#include "mz_fwd.h"
#define MZ_TINYWIN_IMPLEMENTATION
#include "mz_tinywin.h"
#define MZ_LIBRARY_IMPLEMENTATION
#include "mz_library.h"
#define MZ_D3D12_IMPLEMENTATION
#include "mz_d3d12.h"
#define MZ_GRAPHICS_IMPLEMENTATION
#include "mz_graphics.h"
#define MZ_MATH_IMPLEMENTATION
#include "mz_math.h"
#define STBDS_ASSERT(x) MZ_ASSERT(x)
static inline f64 fabs(f64 x) { return x >= 0.0 ? x : -x; }
#define STB_DS_IMPLEMENTATION
#define STB_PERLIN_IMPLEMENTATION
#include "stb_ds.h"
#include "stb_perlin.h"
#undef STB_PERLIN_IMPLEMENTATION
#undef STB_DS_IMPLEMENTATION
typedef struct test_api {
void *context;
i32 (*init)(void *context, void *window);
void (*deinit)(void *context);
void (*update)(void *context, f64 time, f32 delta_time);
} test_api_t;
#include "tests/test0.c"
int _fltused;
void start(void) {
mztinywin_load_api();
mzd3d12_load_api();
mzl_load_api();
SetProcessDPIAware();
test_api_t tests[] = {
get_test0(),
};
mzm_unit_tests();
{
f32 x = mzm_f32_sqrt(100.0f);
MZ_ASSERT(x == 10.0f);
}
test_api_t *test = &tests[0];
void *window = mzl_create_window("eneida", 1920, 1080);
if (window && test->init(test->context, window)) {
for (;;) {
MSG message = {0};
if (PeekMessage(&message, 0, 0, 0, PM_REMOVE)) {
DispatchMessage(&message);
if (message.message == WM_QUIT) {
break;
}
} else {
f64 frame_time;
f32 frame_delta_time;
mzl_update_frame_stats(window, "eneida", &frame_time, &frame_delta_time);
test->update(test->context, frame_time, frame_delta_time);
}
}
test->deinit(test->context);
}
ExitProcess(0);
}