summaryrefslogtreecommitdiff
path: root/src/screen.h
diff options
context:
space:
mode:
authorTyler Murphy <tylerm@tylerm.dev>2023-04-24 15:19:45 -0400
committerTyler Murphy <tylerm@tylerm.dev>2023-04-24 15:19:45 -0400
commit0aa6e65ea6ef044cf877ed6df8f3bf00141e0b23 (patch)
treedd1f9aa154fe0955274e2900f368b8f7e43634a3 /src/screen.h
parentwindow title (diff)
downloadraycaster-0aa6e65ea6ef044cf877ed6df8f3bf00141e0b23.tar.gz
raycaster-0aa6e65ea6ef044cf877ed6df8f3bf00141e0b23.tar.bz2
raycaster-0aa6e65ea6ef044cf877ed6df8f3bf00141e0b23.zip
i made a swapchain
Diffstat (limited to 'src/screen.h')
-rw-r--r--src/screen.h21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/screen.h b/src/screen.h
index e1d80d1..423af7e 100644
--- a/src/screen.h
+++ b/src/screen.h
@@ -1,13 +1,28 @@
#pragma once
-#define _POSIX_C_SOURCE 200809L
+#define _XOPEN_SOURCE 600
+#define _POSIX_C_SOURCE 200112L
+// #define _POSIX_C_SOURCE 200809L
#include <stdint.h>
#include <stdbool.h>
+#include <pthread.h>
-struct Screen {
+typedef struct {
uint16_t width;
uint16_t height;
- uint32_t* pixels;
+ uint8_t image_count; // amount of frames in flight
+ uint8_t image_front; // image being drawn to screen
+ uint8_t image_recent; // last image that finished drawing
+ uint8_t image_current; // current image being drawn
+ pthread_mutex_t lock;
+ uint32_t** images;
+} Swapchain;
+
+void swapchain_next(Swapchain* swapchain);
+void swapchain_submit(Swapchain* swapchain);
+
+struct Screen {
+ Swapchain swapchain;
float delta;
void* internal;
};