From bec7a1c90f7cda0a9e7d2e2628ac69b645108dc4 Mon Sep 17 00:00:00 2001 From: quou Date: Thu, 19 Dec 2024 19:20:50 +1100 Subject: basic vulkan setup --- app.hpp | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'app.hpp') 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 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 + 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 -- cgit v1.2.3-54-g00ecf