testbed: refine a couple of components
This commit is contained in:
@@ -4,8 +4,6 @@
|
||||
|
||||
namespace testbed {
|
||||
|
||||
struct position_component {
|
||||
SDL_FPoint point;
|
||||
};
|
||||
struct position_component: SDL_FPoint {};
|
||||
|
||||
} // namespace testbed
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
|
||||
namespace testbed {
|
||||
|
||||
struct rect_component {
|
||||
SDL_FRect area;
|
||||
};
|
||||
struct rect_component: SDL_FRect {};
|
||||
|
||||
} // namespace testbed
|
||||
|
||||
@@ -17,7 +17,7 @@ void rendering_system(entt::registry ®istry, const context &ctx) {
|
||||
SDL_RenderClear(ctx);
|
||||
|
||||
for(auto [entt, pos, rect]: registry.view<renderable_component, position_component, rect_component>().each()) {
|
||||
SDL_FRect elem{rect.area.x + pos.point.x, rect.area.y + pos.point.y, rect.area.w, rect.area.h};
|
||||
SDL_FRect elem{rect.x + pos.x, rect.y + pos.y, rect.w, rect.h};
|
||||
SDL_SetRenderDrawColor(ctx, 255u, 255u, 255u, SDL_ALPHA_OPAQUE);
|
||||
SDL_RenderRect(ctx, &elem);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user