Skip to content

Commit

Permalink
Clean.
Browse files Browse the repository at this point in the history
  • Loading branch information
Chukobyte committed Nov 2, 2024
1 parent c4129ce commit 7e29eac
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 25 deletions.
2 changes: 1 addition & 1 deletion Dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if (NOT TARGET seika)
FetchContent_Declare(
seika_content
GIT_REPOSITORY https://github.com/Chukobyte/seika.git
GIT_TAG v0.2.1
GIT_TAG v0.2.2
)
FetchContent_MakeAvailable(seika_content)
endif ()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#include "animated_sprite_rendering_ec_system.h"

#include <seika/seika.h>
#include <seika/assert.h>
#include <seika/time.h>
#include <seika/rendering/renderer.h>
#include <seika/rendering/shader/shader_cache.h>
#include <seika/ecs/ecs.h>
#include <seika/assert.h>

#include "../ecs_globals.h"
#include "../components/animated_sprite_component.h"
Expand Down Expand Up @@ -36,8 +36,7 @@ void animated_sprite_render(SkaECSSystem* system) {
const CRECamera2D* camera2D = cre_camera_manager_get_current_camera();
const CRECamera2D* defaultCamera = cre_camera_manager_get_default_camera();
const int32 currentTickTime = (int32)ska_get_ticks();
SKA_ARRAY_LIST_FOR_EACH(system->entities, SkaEntity, entityPtr) {
const SkaEntity entity = *entityPtr;
SKA_ECS_SYSTEM_ENTITIES_FOR(system, entity) {
Transform2DComponent* spriteTransformComp = (Transform2DComponent*)ska_ecs_component_manager_get_component(entity, TRANSFORM2D_COMPONENT_INDEX);
AnimatedSpriteComponent* animatedSpriteComponent = (AnimatedSpriteComponent*)ska_ecs_component_manager_get_component(entity, ANIMATED_SPRITE_COMPONENT_INDEX);
CreAnimationFrame* currentFrame = &animatedSpriteComponent->currentAnimation->animationFrames[animatedSpriteComponent->currentAnimation->currentFrame];
Expand Down
6 changes: 2 additions & 4 deletions engine/src/core/ecs/systems/collision_ec_system.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ void on_entity_entered_scene(SkaECSSystem* system, SkaEntity entity) {
}

void fixed_update(SkaECSSystem* system, f32 deltaTime) {
SKA_ARRAY_LIST_FOR_EACH(system->entities, SkaEntity, entityPtr) {
const SkaEntity entity = *entityPtr;
SKA_ECS_SYSTEM_ENTITIES_FOR(system, entity) {
Transform2DComponent* transformComp = (Transform2DComponent*)ska_ecs_component_manager_get_component(entity,TRANSFORM2D_COMPONENT_INDEX);
transformComp->isGlobalTransformDirty = true;
}
Expand All @@ -93,8 +92,7 @@ void fixed_update(SkaECSSystem* system, f32 deltaTime) {
void collision_render(SkaECSSystem* system) {
const CRECamera2D* camera2D = cre_camera_manager_get_current_camera();
const CRECamera2D* defaultCamera = cre_camera_manager_get_default_camera();
SKA_ARRAY_LIST_FOR_EACH(system->entities, SkaEntity, entityPtr) {
const SkaEntity entity = *entityPtr;
SKA_ECS_SYSTEM_ENTITIES_FOR(system, entity) {
Transform2DComponent* transformComp = (Transform2DComponent*)ska_ecs_component_manager_get_component(entity,TRANSFORM2D_COMPONENT_INDEX);
const Collider2DComponent* colliderComp = (Collider2DComponent*)ska_ecs_component_manager_get_component(entity,COLLIDER2D_COMPONENT_INDEX);
const CRECamera2D* renderCamera = transformComp->ignoreCamera ? defaultCamera : camera2D;
Expand Down
3 changes: 1 addition & 2 deletions engine/src/core/ecs/systems/color_rect_ec_system.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ void color_rect_render(SkaECSSystem* system) {
const CRECamera2D* camera2D = cre_camera_manager_get_current_camera();
const CRECamera2D* defaultCamera = cre_camera_manager_get_default_camera();

SKA_ARRAY_LIST_FOR_EACH(system->entities, SkaEntity, entityPtr) {
const SkaEntity entity = *entityPtr;
SKA_ECS_SYSTEM_ENTITIES_FOR(system, entity) {
Transform2DComponent* transformComp = (Transform2DComponent*)ska_ecs_component_manager_get_component(entity, TRANSFORM2D_COMPONENT_INDEX);
const ColorRectComponent* colorRectComponent = (ColorRectComponent*)ska_ecs_component_manager_get_component(entity, COLOR_RECT_COMPONENT_INDEX);
const CRECamera2D* renderCamera = transformComp->ignoreCamera ? defaultCamera : camera2D;
Expand Down
3 changes: 1 addition & 2 deletions engine/src/core/ecs/systems/font_rendering_ec_system.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ void on_entity_registered(SkaECSSystem* system, SkaEntity entity) {
void font_render(SkaECSSystem* system) {
const CRECamera2D* camera2D = cre_camera_manager_get_current_camera();
const CRECamera2D* defaultCamera = cre_camera_manager_get_default_camera();
SKA_ARRAY_LIST_FOR_EACH(system->entities, SkaEntity, entityPtr) {
const SkaEntity entity = *entityPtr;
SKA_ECS_SYSTEM_ENTITIES_FOR(system, entity) {
Transform2DComponent* fontTransformComp = (Transform2DComponent*)ska_ecs_component_manager_get_component(entity, TRANSFORM2D_COMPONENT_INDEX);
TextLabelComponent* textLabelComponent = (TextLabelComponent*)ska_ecs_component_manager_get_component(entity, TEXT_LABEL_COMPONENT_INDEX);
const CRECamera2D* renderCamera = fontTransformComp->ignoreCamera ? defaultCamera : camera2D;
Expand Down
3 changes: 1 addition & 2 deletions engine/src/core/ecs/systems/parallax_ec_system.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ void on_entity_unregistered(SkaECSSystem* system, SkaEntity entity) {

void fixed_update(SkaECSSystem* system, f32 deltaTime) {
CRECamera2D* camera2D = cre_camera_manager_get_current_camera();
SKA_ARRAY_LIST_FOR_EACH(system->entities, SkaEntity, entityPtr) {
const SkaEntity entity = *entityPtr;
SKA_ECS_SYSTEM_ENTITIES_FOR(system, entity) {
Transform2DComponent* transformComp = (Transform2DComponent*)ska_ecs_component_manager_get_component(entity, TRANSFORM2D_COMPONENT_INDEX);
ParallaxComponent* parallaxComp = (ParallaxComponent*)ska_ecs_component_manager_get_component(entity, PARALLAX_COMPONENT_INDEX);
parallax_system_update_entity(entity, transformComp, parallaxComp, camera2D);
Expand Down
6 changes: 2 additions & 4 deletions engine/src/core/ecs/systems/particle_emitter_ec_system.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ void on_entity_entered_scene(SkaECSSystem* system, SkaEntity entity) {
}

void ec_system_update(SkaECSSystem* system, float deltaTime) {
SKA_ARRAY_LIST_FOR_EACH(system->entities, SkaEntity, entityPtr) {
const SkaEntity entity = *entityPtr;
SKA_ECS_SYSTEM_ENTITIES_FOR(system, entity) {
Particles2DComponent* particles2DComponent = (Particles2DComponent*)ska_ecs_component_manager_get_component(entity, PARTICLES2D_COMPONENT_INDEX);
cre_particle_emitter_ec_system_update_component(particles2DComponent, deltaTime);
}
Expand All @@ -63,8 +62,7 @@ void ec_system_render(SkaECSSystem* system) {
const CRECamera2D* camera2D = cre_camera_manager_get_current_camera();
const CRECamera2D* defaultCamera = cre_camera_manager_get_default_camera();

SKA_ARRAY_LIST_FOR_EACH(system->entities, SkaEntity, entityPtr) {
const SkaEntity entity = *entityPtr;
SKA_ECS_SYSTEM_ENTITIES_FOR(system, entity) {
Transform2DComponent* particleTransformComp = (Transform2DComponent*)ska_ecs_component_manager_get_component(entity, TRANSFORM2D_COMPONENT_INDEX);
Particles2DComponent* particles2DComponent = (Particles2DComponent*)ska_ecs_component_manager_get_component(entity, PARTICLES2D_COMPONENT_INDEX);
const CRECamera2D* renderCamera = particleTransformComp->ignoreCamera ? defaultCamera : camera2D;
Expand Down
7 changes: 3 additions & 4 deletions engine/src/core/ecs/systems/sprite_rendering_ec_system.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@ void sprite_render(SkaECSSystem* system) {
const CRECamera2D* camera2D = cre_camera_manager_get_current_camera();
const CRECamera2D* defaultCamera = cre_camera_manager_get_default_camera();

SKA_ARRAY_LIST_FOR_EACH(system->entities, SkaEntity, entityPtr) {
const SkaEntity entity = *entityPtr;
Transform2DComponent* spriteTransformComp = (Transform2DComponent*) ska_ecs_component_manager_get_component(entity, TRANSFORM2D_COMPONENT_INDEX);
SpriteComponent* spriteComponent = (SpriteComponent*) ska_ecs_component_manager_get_component(entity, SPRITE_COMPONENT_INDEX);
SKA_ECS_SYSTEM_ENTITIES_FOR(system, entity) {
Transform2DComponent* spriteTransformComp = (Transform2DComponent*)ska_ecs_component_manager_get_component(entity, TRANSFORM2D_COMPONENT_INDEX);
SpriteComponent* spriteComponent = (SpriteComponent*)ska_ecs_component_manager_get_component(entity, SPRITE_COMPONENT_INDEX);
const CRECamera2D* renderCamera = spriteTransformComp->ignoreCamera ? defaultCamera : camera2D;
const SceneNodeRenderResource renderResource = cre_scene_manager_get_scene_node_global_render_resource(entity, spriteTransformComp, &spriteComponent->origin);
const SkaSize2D destinationSize = {
Expand Down
3 changes: 1 addition & 2 deletions engine/src/core/ecs/systems/tilemap_ec_system.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ void on_entity_unregistered(SkaECSSystem* system, SkaEntity entity) {
void tilemap_render(SkaECSSystem* system) {
const CRECamera2D* camera2D = cre_camera_manager_get_current_camera();
const CRECamera2D* defaultCamera = cre_camera_manager_get_default_camera();
SKA_ARRAY_LIST_FOR_EACH(system->entities, SkaEntity, entityPtr) {
const SkaEntity entity = *entityPtr;
SKA_ECS_SYSTEM_ENTITIES_FOR(system, entity) {
Transform2DComponent* tilemapTransformComp = (Transform2DComponent*)ska_ecs_component_manager_get_component(entity, TRANSFORM2D_COMPONENT_INDEX);
TilemapComponent* tilemapComponent = (TilemapComponent*)ska_ecs_component_manager_get_component(entity, TILEMAP_COMPONENT_INDEX);
SKA_ASSERT(tilemapComponent->tilemap);
Expand Down

0 comments on commit 7e29eac

Please sign in to comment.