forked from Programmer-nosleep/sawit-engine
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplatform_win32.h
More file actions
93 lines (87 loc) · 2.92 KB
/
Copy pathplatform_win32.h
File metadata and controls
93 lines (87 loc) · 2.92 KB
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
#ifndef PLATFORM_WIN32_H
#define PLATFORM_WIN32_H
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include "gpu_preferences.h"
#include "overlay_ui.h"
typedef struct PlatformInput
{
float look_x;
float look_y;
float move_forward;
float move_right;
int escape_pressed;
int toggle_cycle_pressed;
int reset_cycle_pressed;
int increase_cycle_speed_pressed;
int decrease_cycle_speed_pressed;
int scrub_backward_held;
int scrub_forward_held;
int scrub_fast_held;
int move_fast_held;
int crouch_held;
int jump_pressed;
int jump_held;
int move_down_held;
int toggle_player_mode_pressed;
int remove_block_pressed;
int place_block_pressed;
int selected_block_slot;
} PlatformInput;
typedef struct PlatformApp
{
HINSTANCE instance;
HWND window;
HDC device_context;
HGLRC gl_context;
LONG_PTR windowed_style;
LONG_PTR windowed_ex_style;
int fullscreen_enabled;
LARGE_INTEGER timer_frequency;
LARGE_INTEGER timer_start;
LONG mouse_dx;
LONG mouse_dy;
int width;
int height;
int running;
int resized;
int escape_requested;
int previous_toggle_cycle_down;
int previous_reset_cycle_down;
int previous_increase_speed_down;
int previous_decrease_speed_down;
int previous_jump_down;
int previous_player_mode_down;
int previous_alt_down;
int cursor_hidden;
int mouse_captured;
int cursor_mode_enabled;
int suppress_next_mouse_delta;
int previous_left_button_down;
int previous_world_left_button_down;
int previous_world_right_button_down;
int suppress_world_click_until_release;
int gpu_switch_requested;
int render_quality_change_requested;
GpuPreferenceMode requested_gpu_preference;
RendererQualityPreset requested_render_quality_preset;
OverlayState overlay;
} PlatformApp;
int platform_create(PlatformApp* app, const char* title, int width, int height);
void platform_destroy(PlatformApp* app);
void platform_pump_messages(PlatformApp* app, PlatformInput* input);
void platform_request_close(PlatformApp* app);
float platform_get_time_seconds(const PlatformApp* app);
void platform_swap_buffers(const PlatformApp* app);
void platform_set_window_title(const PlatformApp* app, const char* title);
void platform_get_scene_settings(const PlatformApp* app, SceneSettings* out_settings);
void platform_set_scene_settings(PlatformApp* app, const SceneSettings* settings);
int platform_get_god_mode_enabled(const PlatformApp* app);
void platform_set_god_mode_enabled(PlatformApp* app, int enabled);
void platform_update_overlay_metrics(PlatformApp* app, const OverlayMetrics* metrics);
int platform_consume_gpu_switch_request(PlatformApp* app, GpuPreferenceMode* out_mode);
int platform_consume_render_quality_request(PlatformApp* app, RendererQualityPreset* out_preset);
void platform_set_render_quality_preset(PlatformApp* app, RendererQualityPreset preset);
void platform_refresh_gpu_info(PlatformApp* app);
void platform_show_error_message(const char* title, const char* message);
#endif