Loading...
Searching...
No Matches
RenderingSystem.h
Go to the documentation of this file.
1//
2// Created by Dave Smith on 3/11/25.
3//
4
5#ifndef RENDERINGSYSTEM_H
6#define RENDERINGSYSTEM_H
7
8#pragma once
9
10#include <SFML/Graphics.hpp>
11#include "Core/ECSManager.h"
12
13namespace ml
14{
20 {
21 public:
23 {
24 int i = 1;
25 for (auto &[entity, position] : ecs.positions)
26 {
27 sf::CircleShape shape(ecs.size[i++].health);
28 shape.setPosition({position.x, position.y});
29 shape.setFillColor(sf::Color(rand() % 256, rand() % 256, rand() % 256));
30 window.draw(shape);
31 }
32 }
33 };
34}
35
36#endif // RENDERINGSYSTEM_H
ECSManager.
Definition ECSManager.h:23
std::unordered_map< Entity, PositionComponent > positions
Definition ECSManager.h:25
std::unordered_map< Entity, HealthComponent > size
Definition ECSManager.h:28
RenderingSystem.
void render(sf::RenderWindow &window, ECSManager &ecs)
void draw(const Drawable &drawable, const RenderStates &states=RenderStates::Default)
void setFillColor(Color color)
void setPosition(Vector2f position)
Definition Component.h:18