If Amazon used this Besos wouldn't have banned PowerPoint.
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.
 
 
 
 
 
 
besos-loves-slides/control.cpp

46 lines
1.0 KiB

#include "guecs/sfml/components.hpp"
#include "guecs/ui.hpp"
#include <fmt/xchar.h>
#include <deque>
#include <iostream>
#include <nlohmann/json.hpp>
#include "dbc.hpp"
#include <memory>
#include <filesystem>
#include <fstream>
#include <iostream>
#include "constants.hpp"
#include "control.hpp"
ControlUI::ControlUI(sf::RenderWindow& presenter) :
$presenter(presenter)
{
$gui.position(0, 0, CONTROL_WIDTH, CONTROL_HEIGHT);
$gui.layout(
"[status]"
"[docs]"
);
}
void ControlUI::init() {
auto status_id = $gui.entity("status");
$gui.set<guecs::Text>(status_id, {L""});
auto docs_id = $gui.entity("docs");
$gui.set<guecs::Text>(docs_id, {L"A: win left\nD: win right\nQ: quit"});
$status = $gui.get_if<guecs::Text>(status_id);
$gui.init();
}
void ControlUI::render(sf::RenderWindow& window) {
auto pos = $presenter.getPosition();
auto size = $presenter.getSize();
$status->update(fmt::format(L"pos={},{}\nsize={},{}",
pos.x, pos.y, size.x, size.y));
window.clear();
$gui.render(window);
}