packed and aligned structures, might be the error for entities assignement

This commit is contained in:
Ulysse Cura 2025-08-24 14:22:43 +02:00
parent cbe4595fb8
commit 0605d4dbc3
4 changed files with 6 additions and 6 deletions

View File

@ -11,6 +11,6 @@ typedef struct animation_system_data_t {
bool play;
bool loop;
bool reverse;
} animation_system_data_t;
} __attribute__((packed, aligned(4))) animation_system_data_t;
#endif // SPRITE_COMPONENT_H

View File

@ -19,12 +19,12 @@ typedef struct component_t {
sprite_component_data_t *sprite_component_data;
animation_system_data_t *animation_system_data;
} component_data;
} component_t;
} __attribute__((packed, aligned(4))) component_t;
typedef struct entity_t {
uint16_t id;
uint32_t nb_component;
component_t *components;
} entity_t;
} __attribute__((packed, aligned(4))) entity_t;
#endif // ECS_H

View File

@ -3,6 +3,6 @@
typedef struct sprite_component_data_t {
const char *texture_name;
} sprite_component_data_t;
} __attribute__((packed, aligned(4))) sprite_component_data_t;
#endif // SPRITE_COMPONENT_H

View File

@ -4,7 +4,7 @@
typedef struct transform_component_data_t {
uint32_t x, y;
uint32_t w, h;
float speed;
} transform_component_data_t;
uint32_t speed;
} __attribute__((packed, aligned(4))) transform_component_data_t;
#endif // TRANSFORM_COMPONENT_H