Prepare for event system

Moved stuff around.
Create an entry point for RSE.
Created base for events module

Signed-off-by: Piotr Krygier <piotrkrygier@everyonecancode@xyz>
This commit is contained in:
Piotr Krygier
2026-03-03 11:26:43 +01:00
parent 7d6156be01
commit bbbe69d73c
13 changed files with 245 additions and 53 deletions
+5 -21
View File
@@ -106,32 +106,20 @@ static rse_err_t render_static_mesh(struct graphics_context_t* context, uint32_t
return RSE_ERROR_NO_ERROR;
}
rse_err_t rse_graphics_init(struct rse_graphics_context_t** context)
rse_err_t rse_graphics_init(struct graphics_context_t* context)
{
rse_err_t status = RSE_ERROR_NO_ERROR;
struct rse_graphics_context_t* ctx_ptr = NULL;
if (*context != NULL) {
SDL_LogCritical(SDL_LOG_CATEGORY_GPU, "Graphics already initialized!");
return RSE_ERROR_ALREADY_INITIALIZED;
}
rse_malloc(*context, sizeof(struct rse_graphics_context_t));
ctx_ptr = *context;
rse_malloc(ctx_ptr->context, sizeof(struct graphics_context_t));
rse_memset(ctx_ptr->context, 0, sizeof(struct graphics_context_t));
STATUS_CHECK(window_init(&ctx_ptr->context->window_handle, &ctx_ptr->context->is_framebuffer_resized));
STATUS_CHECK(vulkan_init(ctx_ptr->context));
STATUS_CHECK(window_init(&context->window_handle, &context->is_framebuffer_resized));
STATUS_CHECK(vulkan_init(context));
return status;
}
#define TEXTURES_COUNT (2U)
rse_err_t rse_graphics_test_function(struct rse_graphics_context_t* rse_context)
rse_err_t rse_graphics_test_function(struct graphics_context_t* context)
{
rse_err_t status = RSE_ERROR_NO_ERROR;
struct graphics_context_t* context = rse_context->context;
rse_id_t textures[TEXTURES_COUNT] = {0};
struct pipeline_t pipeline;
rse_id_t descriptor_set_handle = 0;
@@ -257,11 +245,9 @@ rse_err_t rse_graphics_test_function(struct rse_graphics_context_t* rse_context)
return RSE_ERROR_NO_ERROR;
}
int rse_graphics_run(void* arg)
rse_err_t rse_graphics_main_loop(struct graphics_context_t* context)
{
rse_err_t status = RSE_ERROR_NO_ERROR;
struct rse_graphics_context_t* rse_context = (struct rse_graphics_context_t*)arg;
struct graphics_context_t* context = rse_context->context;
STATUS_CHECK(vulkan_run(context));
STATUS_CHECK(window_loop(context));
@@ -270,8 +256,6 @@ int rse_graphics_run(void* arg)
window_terminate(context->window_handle);
rse_free(context->debug_overlay.pixels);
rse_free(context);
rse_free(rse_context);
return status;
}