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.
37 lines
835 B
37 lines
835 B
3 weeks ago
|
#include "overlay_ui.hpp"
|
||
|
#include "constants.hpp"
|
||
|
#include "color.hpp"
|
||
|
#include "events.hpp"
|
||
|
|
||
|
namespace gui {
|
||
|
using namespace guecs;
|
||
|
|
||
|
OverlayUI::OverlayUI(GameLevel level) :
|
||
|
$level(level)
|
||
|
{
|
||
|
$gui.position(RAY_VIEW_X, RAY_VIEW_Y, RAY_VIEW_WIDTH, RAY_VIEW_HEIGHT);
|
||
|
$gui.layout(
|
||
|
"[top_left|top|top_right]"
|
||
|
"[*%(300,300)middle|_|_]"
|
||
|
"[_|_|_]"
|
||
|
"[_|_|_]"
|
||
|
"[bottom_left|bottom|bottom_right]"
|
||
|
);
|
||
|
}
|
||
|
|
||
|
void OverlayUI::render(TexturePack &textures) {
|
||
|
auto &world = $gui.world();
|
||
|
for(auto &[name, cell] : $gui.cells()) {
|
||
|
auto region = $gui.entity(name);
|
||
|
$name_ents.insert_or_assign(name, region);
|
||
|
world.set<lel::Cell>(region, cell);
|
||
|
}
|
||
|
$gui.init(textures);
|
||
|
}
|
||
|
|
||
|
void OverlayUI::draw(sf::RenderWindow& window) {
|
||
|
$gui.render(window);
|
||
|
}
|
||
|
|
||
|
}
|