I now have a semi-functional GUI system that uses the ECS style to build gui elements rather than inheritance.
This commit is contained in:
parent
615599084a
commit
46de98e6f4
12 changed files with 213 additions and 146 deletions
28
tests/ecs_gui.cpp
Normal file
28
tests/ecs_gui.cpp
Normal file
|
@ -0,0 +1,28 @@
|
|||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <fmt/core.h>
|
||||
#include "constants.hpp"
|
||||
#include "ecs_gui.hpp"
|
||||
|
||||
|
||||
TEST_CASE("prototype one gui", "[ecs-gui]") {
|
||||
GUECS gui;
|
||||
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();
|
||||
|
||||
// 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();
|
||||
}
|
|
@ -2,10 +2,6 @@
|
|||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <fmt/core.h>
|
||||
#include <string>
|
||||
#include "ansi_parser.hpp"
|
||||
#include <codecvt>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
TEST_CASE("test basic ops", "[lel]") {
|
||||
lel::Parser parser(0, 0, 500, 500);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue