Refactored the GUECS system to have its own namespace then got Meter to work.
This commit is contained in:
parent
9c66e870d2
commit
722d55d948
9 changed files with 206 additions and 177 deletions
34
tests/guecs.cpp
Normal file
34
tests/guecs.cpp
Normal file
|
@ -0,0 +1,34 @@
|
|||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <fmt/core.h>
|
||||
#include "constants.hpp"
|
||||
#include "guecs.hpp"
|
||||
#include "texture.hpp"
|
||||
|
||||
using namespace guecs;
|
||||
|
||||
TEST_CASE("prototype one gui", "[ecs-gui]") {
|
||||
guecs::UI gui;
|
||||
|
||||
TexturePack textures;
|
||||
textures.load_sprites();
|
||||
|
||||
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});
|
||||
}
|
||||
|
||||
gui.init(textures);
|
||||
|
||||
// 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();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue