A chip8 emulator for learning old school assembly language game dev.
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.
|
|
|
|
#include "control_panel.hpp"
|
|
|
|
|
#include <fmt/xchar.h>
|
|
|
|
|
#include "constants.hpp"
|
|
|
|
|
|
|
|
|
|
ControlPanel::ControlPanel() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ControlPanel::init(sf::Vector2f size) {
|
|
|
|
|
$gui.position(0, size.y, size.x, WINDOW_HEIGHT - size.y);
|
|
|
|
|
$gui.layout(
|
|
|
|
|
"[pause |*%(200, 400)code|_]"
|
|
|
|
|
"[step |_|_]"
|
|
|
|
|
"[play |_|_]"
|
|
|
|
|
"[restart|_|_]"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
for(auto& [name, cell] : $gui.cells()) {
|
|
|
|
|
auto id = $gui.entity(name);
|
|
|
|
|
$gui.set<guecs::Rectangle>(id, {});
|
|
|
|
|
$gui.set<guecs::Text>(id, {guecs::to_wstring(name)});
|
|
|
|
|
if(name != "code") {
|
|
|
|
|
$gui.set<guecs::Clickable>(id, {[name](auto) {
|
|
|
|
|
fmt::println("CLICKED {}", name);
|
|
|
|
|
}});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$gui.init();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ControlPanel::render(sf::RenderTarget& window) {
|
|
|
|
|
$gui.render(window);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ControlPanel::update(Chip8& vm) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool ControlPanel::mouse(float x, float y, guecs::Modifiers mods) {
|
|
|
|
|
return $gui.mouse(x, y, mods);
|
|
|
|
|
}
|