1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
Entity* entity = new Tile(&tex, Vec3f(0, 0, 30), Vec3f(120, 60, 0), sf::IntRect(0, 0, 100, 50));
Entity* entity2 = new Tile(&tex, Vec3f(50, 25, 55), Vec3f(120, 60, 0), sf::IntRect(0, 0, 100, 50));
Entity* entity3 = new Tile(nullptr, Vec3f(100, 50, 80), Vec3f(120, 60, 0), sf::IntRect(0, 0, 100, 50), sf::Color::Red);
Entity* entity4 = new Tile(nullptr, Vec3f(150, 75, 105), Vec3f(120, 60, 0), sf::IntRect(0, 0, 100, 50), sf::Color::Yellow);
Entity* entity5 = new Tile(&tex, Vec3f(200, 100, 130), Vec3f(120, 60, 0), sf::IntRect(0, 0, 100, 50));
std::vector<Entity*> entities = {entity5, entity4, entity3, entity2, entity};
sf::Clock clock;
unsigned int fps = 0;
while (window.isOpen())
{
sf::Event event;
while(window.pollEvent(event)) {
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
CPURenderComponent cpu(Vec3f(0, 0, 0), Vec3f(800, 600, 0),Vec3f(400, 300, 0), false, window);
cpu.clear();
cpu.loadEntitiesOnComponent(entities);
cpu.drawNextFrame();
window.draw(cpu);
window.display();
} |
Partager