Compare commits

..

No commits in common. "fef3d87ca6387fcd5676935b3f20d1139791b7c8" and "d070dc85663fa7b5a7105a746f952ba65d10ee5c" have entirely different histories.

6 changed files with 12 additions and 10 deletions

View File

@ -3,7 +3,7 @@
#include "ecs.h" #include "ecs.h"
#include "transform_component.h" #include "transform_component.h"
#include "asset_manager.h" #include "texture_manager.h"
typedef struct sprite_component_data_t { typedef struct sprite_component_data_t {
transform_component_data_t *transform_component_data; transform_component_data_t *transform_component_data;

View File

@ -27,7 +27,7 @@ inline void sprite_component_update(component_t *component)
inline void sprite_component_draw(component_t *component) inline void sprite_component_draw(component_t *component)
{ {
sprite_component_data_t *component_data = component->component_data; sprite_component_data_t *component_data = component->component_data;
asset_manager_draw_texture(component_data->texture, &component_data->src_rect, &component_data->dst_rect, component_data->flip); draw_texture(component_data->texture, &component_data->src_rect, &component_data->dst_rect, component_data->flip);
} }
inline void sprite_component_destroy(component_t *component) inline void sprite_component_destroy(component_t *component)
@ -37,5 +37,5 @@ inline void sprite_component_destroy(component_t *component)
inline void sprite_component_set_texture(sprite_component_data_t *component_data, const char *name) inline void sprite_component_set_texture(sprite_component_data_t *component_data, const char *name)
{ {
component_data->texture = asset_manager_get_texture(&game.asset_manager, name); component_data->texture = texture_manager_get_texture(&game.texture_manager, name);
} }

View File

@ -157,7 +157,7 @@ inline void entity_manager_remove_entity(entity_manager_t *entity_manager, unsig
linked_list_remove_if(&entity_manager->entities, condition_is_entity_name, id); linked_list_remove_if(&entity_manager->entities, condition_is_entity_name, id);
} }
inline void entity_manager_exit(entity_manager_t *entity_manager) inline void entity_manager_clear(entity_manager_t *entity_manager)
{ {
linked_list_clear(&entity_manager->entities); linked_list_clear(&entity_manager->entities);
} }

View File

@ -72,6 +72,6 @@ void entity_manager_draw(entity_manager_t *entity_manager);
void entity_manager_remove_entity(entity_manager_t *entity_manager, const unsigned int id); void entity_manager_remove_entity(entity_manager_t *entity_manager, const unsigned int id);
void entity_manager_exit(entity_manager_t *entity_manager); void entity_manager_clear(entity_manager_t *entity_manager);
#endif // ECS_H #endif // ECS_H

View File

@ -8,8 +8,9 @@
void game_init(void) void game_init(void)
{ {
display_init(); display_init();
asset_manager_init();
asset_manager_init(&game.asset_manager); texture_manager_init(&game.texture_manager);
entity_manager_init(&game.entity_manager); entity_manager_init(&game.entity_manager);
entity_t *player = create_entity(0); entity_t *player = create_entity(0);
@ -68,8 +69,9 @@ void game_render(void)
void game_exit(void) void game_exit(void)
{ {
entity_manager_exit(&game.entity_manager); entity_manager_clear(&game.entity_manager);
asset_manager_exit(&game.asset_manager); texture_manager_clear(&game.texture_manager);
asset_manager_exit();
display_exit(); display_exit();
} }

View File

@ -4,7 +4,7 @@
#include <stdbool.h> #include <stdbool.h>
#include "events.h" #include "events.h"
#include "asset_manager.h" #include "texture_manager.h"
#include "ecs.h" #include "ecs.h"
/** /**
@ -19,7 +19,7 @@
*/ */
typedef struct game_t { typedef struct game_t {
events_t events; events_t events;
asset_manager_t asset_manager; texture_manager_t texture_manager;
entity_manager_t entity_manager; entity_manager_t entity_manager;
bool is_running; bool is_running;