summaryrefslogtreecommitdiff
path: root/app.hpp
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2024-12-19 19:20:50 +1100
committerquou <quou@disroot.org>2024-12-19 19:22:20 +1100
commitbec7a1c90f7cda0a9e7d2e2628ac69b645108dc4 (patch)
tree830660aab41d90c24302d2c64e096292b62a4394 /app.hpp
parent73744341846d4e76d6910dc5a15dff6d74586e39 (diff)
basic vulkan setup
Diffstat (limited to 'app.hpp')
-rw-r--r--app.hpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/app.hpp b/app.hpp
index 80d6cb0..95bdec7 100644
--- a/app.hpp
+++ b/app.hpp
@@ -1,7 +1,9 @@
#ifndef app_hpp
#define app_hpp
-#define app_memory_size (4096 * 16)
+#define app_memory_size (1024 * 1024 * 32)
+
+#include <new>
struct Arena;
@@ -96,6 +98,8 @@ enum Key_State {
key_state_just_released = 1 << 2
};
+struct App_Internal;
+
struct App {
Arena* arena;
int running, w, h;
@@ -103,8 +107,20 @@ struct App {
int scrollx, scrolly;
unsigned char key_states[key_count];
unsigned char mbtn_states[mbtn_count];
+ App_Internal* internal;
- static App* create(const char* name);
+ template <typename T>
+ static T* create(const char* name) {
+ Arena* arena;
+ T* app = (T*)alloc(sizeof(T), arena);
+ app = new(app) T();
+ app->arena = arena;
+ app->running = 0;
+ app->init(name);
+ return app;
+ }
+ static void* alloc(int size, Arena*& arena);
+ void init(const char* name);
void destroy();
void begin();
@@ -118,6 +134,10 @@ struct App {
bool mp(Mbtn k);
bool mjp(Mbtn k);
bool mjr(Mbtn k);
+
+ void get_vk_exts(const char** exts, int& count);
+
+ virtual void on_resize() = 0;
};
#endif