From 73fd594ad1b93a202e1b4b4868e5266245b05ed2 Mon Sep 17 00:00:00 2001 From: Edgaru089 Date: Tue, 16 Apr 2024 10:30:37 +0800 Subject: [PATCH] Fix render component.super as Entity* Nothing uses this super pointer tho --- app_file.c | 2 +- mapper_misc.c | 2 +- render_component.c | 8 ++++---- render_component.h | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app_file.c b/app_file.c index 5f31213..e427469 100644 --- a/app_file.c +++ b/app_file.c @@ -135,7 +135,7 @@ static void _app_LevelCommand(App *app, char *cmd) { Entity *e = entity_Create(app->entity, cmd); char *bundle = TOKEN; if (bundle != NULL) - e->render = render_NewComponent(app, bundle); + e->render = render_NewComponent(e, bundle); // We need to compute a position element Vec2 position = { diff --git a/mapper_misc.c b/mapper_misc.c index 89c82b9..0d11a4c 100644 --- a/mapper_misc.c +++ b/mapper_misc.c @@ -149,7 +149,7 @@ void misc_InstantiateTextbox(App *app, Entity *e, const char *text, Box2 trigger e->misc->textbox->offset = offset; if (!e->render) - e->render = render_NewComponentFunc(app, &misc_render_Textbox, NULL); + e->render = render_NewComponentFunc(e, &misc_render_Textbox, NULL); else e->render->custom = &misc_render_Textbox; e->thinker = &misc_thinker_Textbox; diff --git a/render_component.c b/render_component.c index b512cce..8d97d3c 100644 --- a/render_component.c +++ b/render_component.c @@ -5,20 +5,20 @@ #include "types.h" -Component_Render *render_NewComponent(App *app, const char *bundle_name) { +Component_Render *render_NewComponent(Entity *super, const char *bundle_name) { render_Bundle *b = render_FindBundle(bundle_name); if (b == NULL) // Not found return NULL; Component_Render *r = zero_malloc(sizeof(Component_Render)); - r->super = app; + r->super = super; r->bundle = b; return r; } -Component_Render *render_NewComponentFunc(App *app, render_CustomFunc func, void *data) { +Component_Render *render_NewComponentFunc(Entity *super, render_CustomFunc func, void *data) { Component_Render *r = zero_malloc(sizeof(Component_Render)); - r->super = app; + r->super = super; r->custom = func; r->custom_data = data; return r; diff --git a/render_component.h b/render_component.h index 7004f70..0a452df 100644 --- a/render_component.h +++ b/render_component.h @@ -27,9 +27,9 @@ typedef struct { // Creates a new component with a static render bundle -Component_Render *render_NewComponent(App *app, const char *bundle_name); +Component_Render *render_NewComponent(Entity *super, const char *bundle_name); // Creates a new component with a callback for rendering -Component_Render *render_NewComponentFunc(App *app, render_CustomFunc func, void *data); +Component_Render *render_NewComponentFunc(Entity *super, render_CustomFunc func, void *data); void render_DeleteComponent(Component_Render *r);