1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
RenderWindow window (sf::VideoMode (800, 600), "Test", sf::Style::Default, sf::ContextSettings(0, 0, 4, 3, 0));
window.getView().move(400, 300, 0);
Texture tex;
RectangleShape rs(Vec3f(100, 100, 0));
rs.move(Vec3f(100, 100, 0));
tex.loadFromFile("tilesets/herbe.png");
Tile tile1 (nullptr, Vec3f(0, 0, 0), Vec3f(100, 100, 0), sf::IntRect(0, 0, 100, 100), sf::Color(255, 0, 0, 128));
Tile tile2 (nullptr, Vec3f(10, 10, 1), Vec3f(100, 100, 0), sf::IntRect(0, 0, 100, 100), sf::Color(255, 255, 0, 128));
Tile tile3 (nullptr, Vec3f(20, 20, 2), Vec3f(100, 100, 0), sf::IntRect(0, 0, 100, 100), sf::Color(0, 0, 255, 128));
std::vector<Entity*> entities = {&tile1, &tile2};
FastRenderComponent frc(window,0, "E_TILE", false);
frc.clear();
frc.loadEntitiesOnComponent(entities);
//frc.draw(rs);
frc.drawNextFrame();
while (window.isOpen()) {
window.clear();
window.draw(frc);
window.display();
sf::Event event;
while (window.pollEvent(event)) {
if (event.type == sf::Event::Closed) {
window.close();
}
}
}
return 0; |
Partager