summaryrefslogtreecommitdiff
path: root/base/callbacks.c
diff options
context:
space:
mode:
Diffstat (limited to 'base/callbacks.c')
-rw-r--r--base/callbacks.c72
1 files changed, 0 insertions, 72 deletions
diff --git a/base/callbacks.c b/base/callbacks.c
deleted file mode 100644
index c5397e9..0000000
--- a/base/callbacks.c
+++ /dev/null
@@ -1,72 +0,0 @@
-
-
-/* [=]===^=[ framebuffer_callback ]=================================================================^===[=] */
-static void framebuffer_callback(int32_t width, int32_t height) {
- state.screen_width = width;
- state.screen_height = height;
- state.viewport.x = 0;
- state.viewport.y = 0;
- state.viewport.w = width;
- state.viewport.h = height;
-
- float current_aspect = (float)width / (float)height;
-
- if(current_aspect > aspect_ratio) { // Window is wider than the desired aspect ratio
- float new_width = height * aspect_ratio; // Compute new width based on the height and the desired aspect ratio
- state.viewport.x = (width - new_width) / 2;
- state.viewport.w = new_width;
- } else if(current_aspect < aspect_ratio) { // Window is taller than the desired aspect ratio
- float new_height = width / aspect_ratio; // Compute new height based on the width and the desired aspect ratio
- state.viewport.y = (height - new_height) / 2;
- state.viewport.h = new_height;
- }
-}
-
-/* [=]===^=[ key_callback ]=================================================================^===[=] */
-static void key_callback(uint32_t key, uint32_t action, uint32_t mods) {
-
- if(key == MKS_KEY_ESCAPE) {
- if(action == MKS_PRESSED) {
- mkfw_set_should_close(true);
- }
- }
-
- if(action == MKS_RELEASED) {
- switch(key) {
- // Handle shader CRT emulation toggle
- case MKS_KEY_F12: {
- state.toggle_crt_emulation = !state.toggle_crt_emulation;
- } break;
-
- // Handle fullscreen toggle
- case MKS_KEY_F11: {
- if(!keyboard_state[MKS_KEY_SHIFT]) {
- if(state.fullscreen) {
- mkfw_fullscreen(false);
- state.fullscreen = false;
- } else {
- mkfw_fullscreen(true);
- state.fullscreen = true;
- }
- } else if(keyboard_state[MKS_KEY_SHIFT]) {
-#ifdef PROFILER
- state.overlay = !state.overlay;
-#endif
- }
- } break;
-
- default: break;
- }
- }
-}
-
-/* [=]===^=[ mouse_move_callback ]=================================================================^===[=] */
-static void mouse_move_callback(int32_t x, int32_t y) {
- state.mouse_dx += x;
- state.mouse_dy += y;
-}
-
-/* [=]===^=[ mouse_button_callback ]=================================================================^===[=] */
-static void mouse_button_callback(uint8_t button, int action) {
- // printf("mouse_button\n");
-}