Fix render component.super as Entity*
Nothing uses this super pointer tho
This commit is contained in:
parent
bb46e2515f
commit
73fd594ad1
@ -135,7 +135,7 @@ static void _app_LevelCommand(App *app, char *cmd) {
|
|||||||
Entity *e = entity_Create(app->entity, cmd);
|
Entity *e = entity_Create(app->entity, cmd);
|
||||||
char *bundle = TOKEN;
|
char *bundle = TOKEN;
|
||||||
if (bundle != NULL)
|
if (bundle != NULL)
|
||||||
e->render = render_NewComponent(app, bundle);
|
e->render = render_NewComponent(e, bundle);
|
||||||
|
|
||||||
// We need to compute a position element
|
// We need to compute a position element
|
||||||
Vec2 position = {
|
Vec2 position = {
|
||||||
|
@ -149,7 +149,7 @@ void misc_InstantiateTextbox(App *app, Entity *e, const char *text, Box2 trigger
|
|||||||
e->misc->textbox->offset = offset;
|
e->misc->textbox->offset = offset;
|
||||||
|
|
||||||
if (!e->render)
|
if (!e->render)
|
||||||
e->render = render_NewComponentFunc(app, &misc_render_Textbox, NULL);
|
e->render = render_NewComponentFunc(e, &misc_render_Textbox, NULL);
|
||||||
else
|
else
|
||||||
e->render->custom = &misc_render_Textbox;
|
e->render->custom = &misc_render_Textbox;
|
||||||
e->thinker = &misc_thinker_Textbox;
|
e->thinker = &misc_thinker_Textbox;
|
||||||
|
@ -5,20 +5,20 @@
|
|||||||
#include "types.h"
|
#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);
|
render_Bundle *b = render_FindBundle(bundle_name);
|
||||||
if (b == NULL) // Not found
|
if (b == NULL) // Not found
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
Component_Render *r = zero_malloc(sizeof(Component_Render));
|
Component_Render *r = zero_malloc(sizeof(Component_Render));
|
||||||
r->super = app;
|
r->super = super;
|
||||||
r->bundle = b;
|
r->bundle = b;
|
||||||
return r;
|
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));
|
Component_Render *r = zero_malloc(sizeof(Component_Render));
|
||||||
r->super = app;
|
r->super = super;
|
||||||
r->custom = func;
|
r->custom = func;
|
||||||
r->custom_data = data;
|
r->custom_data = data;
|
||||||
return r;
|
return r;
|
||||||
|
@ -27,9 +27,9 @@ typedef struct {
|
|||||||
|
|
||||||
|
|
||||||
// Creates a new component with a static render bundle
|
// 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
|
// 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);
|
void render_DeleteComponent(Component_Render *r);
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user