aboutsummaryrefslogtreecommitdiff
path: root/src/input.h
diff options
context:
space:
mode:
authorNicholas Rodrigues Lordello <[email protected]>2026-10-29 11:30:06 +0100
committerNicholas Rodrigues Lordello <[email protected]>2026-10-29 11:30:06 +0100
commit668594a0bedec468e976a38bbf9eac871e1353de (patch)
tree6c2cef3aac24ce34e3b04a40341f972ec6968149 /src/input.h
parentec6ed6404cdc29fc204eb93fdeb5025deb42f49d (diff)
Add Clipboard Support
Diffstat (limited to 'src/input.h')
-rw-r--r--src/input.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/input.h b/src/input.h
index d3b996a..9ce95b0 100644
--- a/src/input.h
+++ b/src/input.h
@@ -97,6 +97,14 @@ struct pw_mouse {
};
/**
+ * The PICO-8 cliboard buffer state.
+ */
+struct pw_clipboard {
+ char *buffer;
+ size_t size;
+};
+
+/**
* A PICO-8 input event.
*
* This is only a subset of SDL events that the PICO-8 engine uses.
@@ -134,6 +142,7 @@ struct pw_input {
enum pw_button players[PW_PLAYERS_MAX];
struct pw_keyboard keyboard;
struct pw_mouse mouse;
+ struct pw_clipboard clipboard;
};
/**
@@ -202,6 +211,21 @@ enum pw_mouse_button pw_input_mouse(struct pw_input *input,
void pw_input_wheel(struct pw_input *input, int32_t *dx, int32_t *dy);
/**
+ * Gets a writable pointer to the clipboard buffer.
+ */
+char *pw_input_clipboard(struct pw_input *input, size_t size);
+
+/**
+ * Commits the clipboard buffer to the system clipboard.
+ */
+bool pw_input_clipboard_commit(struct pw_input *input);
+
+/**
+ * Fetches the system clipboard into our clipboard buffer.
+ */
+bool pw_input_clipboard_fetch(struct pw_input *input, size_t *len);
+
+/**
* Polls for the next input event for the PICO-8 engine.
*/
bool pw_input_poll(struct pw_input *input, union pw_input_event *event);