summaryrefslogtreecommitdiff
path: root/plat.h
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2024-06-01 12:19:16 +1000
committerquou <quou@disroot.org>2024-06-01 12:20:17 +1000
commitea7cd94f7aeb177618db3907a6c86b7252e018f0 (patch)
treee972f9cf590ef756c2e41f3eac5b03e16db08300 /plat.h
Initial commit.
Diffstat (limited to 'plat.h')
-rw-r--r--plat.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/plat.h b/plat.h
new file mode 100644
index 0000000..8b23eea
--- /dev/null
+++ b/plat.h
@@ -0,0 +1,45 @@
+#ifndef plat_h
+
+#include "render.h"
+#include "error.h"
+
+int get_mouse_x();
+int get_mouse_y();
+
+typedef enum {
+ mbtn_left,
+ mbtn_middle,
+ mbtn_right,
+ mbtn_count
+} MBtn;
+int mbtn_pressed(MBtn btn);
+int mbtn_just_pressed(MBtn btn);
+int mbtn_just_released(MBtn btn);
+int get_mscroll_x(void);
+int get_mscroll_y(void);
+int get_mouse_x(void);
+int get_mouse_y(void);
+
+const char* get_text_input(int* len);
+
+void print(const char* fmt, ...);
+void print_err(const char* fmt, ...);
+void print_war(const char* fmt, ...);
+void pbreak(Error code);
+
+Colour* get_fb(void);
+
+unsigned long get_current_time();
+void sleep_ns(unsigned long ns);
+
+void plat_present(int x, int y, int w, int h);
+int get_render_w(void);
+int get_render_h(void);
+
+unsigned char* load_binary(const char* n, int* size);
+void free_file(void* p);
+
+typedef void (*Dir_Iter)(void* uptr, const char* path);
+void iter_dir(const char* path, Dir_Iter fn, void* u);
+
+#endif