You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
857 B
35 lines
857 B
3 weeks ago
|
#include <catch2/catch_test_macros.hpp>
|
||
|
#include <fmt/core.h>
|
||
|
#include "constants.hpp"
|
||
3 weeks ago
|
#include "guecs.hpp"
|
||
3 weeks ago
|
#include "texture.hpp"
|
||
3 weeks ago
|
|
||
3 weeks ago
|
using namespace guecs;
|
||
3 weeks ago
|
|
||
|
TEST_CASE("prototype one gui", "[ecs-gui]") {
|
||
3 weeks ago
|
guecs::UI gui;
|
||
|
|
||
3 weeks ago
|
TexturePack textures;
|
||
|
textures.load_sprites();
|
||
|
|
||
3 weeks ago
|
gui.position(0, 0, 1000, 500);
|
||
|
gui.layout("[test1|test2|test3][test4|_|test5]");
|
||
|
|
||
|
for(auto& [name, cell] : gui.cells()) {
|
||
|
auto& world = gui.world();
|
||
|
auto button = gui.entity(name);
|
||
|
world.set<lel::Cell>(button, cell);
|
||
|
world.set<Rectangle>(button, {});
|
||
|
world.set<Clickable>(button, {});
|
||
|
world.set<Textual>(button, {name});
|
||
|
}
|
||
|
|
||
3 weeks ago
|
gui.init(textures);
|
||
3 weeks ago
|
|
||
|
// at this point it's mostly ready but I'd need to render it to a window real quick
|
||
|
sf::RenderWindow window;
|
||
|
window.setSize({SCREEN_WIDTH, SCREEN_HEIGHT});
|
||
|
gui.render(window);
|
||
|
window.display();
|
||
|
}
|