blob: 4ec8c5d975a2ddb5e7d99c8c84d1f416bf662137 (
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
|
// Headless platform - time simulation without window
// Workspace: demo (shared across all workspaces)
#if defined(DEMO_HEADLESS)
#include "platform.h"
#include "stub_types.h"
#include <stdio.h>
static double g_virtual_time = 0.0;
static bool g_should_close = false;
static const double FRAME_TIME = 1.0 / 60.0;
PlatformState platform_init(bool fullscreen, int width, int height) {
(void)fullscreen;
g_virtual_time = 0.0;
g_should_close = false;
printf("[headless] Platform initialized (simulated %dx%d)\n", width, height);
PlatformState state = {};
state.width = width;
state.height = height;
state.aspect_ratio = (float)width / (float)height;
state.window = nullptr;
state.time = 0.0;
state.is_fullscreen = false;
return state;
}
void platform_shutdown(PlatformState* state) {
(void)state;
printf("[headless] Platform shutdown\n");
}
void platform_poll(PlatformState* state) {
(void)state;
g_virtual_time += FRAME_TIME;
}
bool platform_should_close(PlatformState* state) {
(void)state;
return g_should_close;
}
void platform_toggle_fullscreen(PlatformState* state) {
(void)state;
}
WGPUSurface platform_create_wgpu_surface(WGPUInstance instance,
PlatformState* state) {
(void)instance;
(void)state;
return nullptr;
}
double platform_get_time() {
return g_virtual_time;
}
#endif // DEMO_HEADLESS
|