Aplicando formato default de jetbrains :c

This commit is contained in:
2025-06-26 21:01:27 -04:00
parent 4d129018e3
commit 5ebc235cae
21 changed files with 455 additions and 233 deletions

View File

@@ -12,17 +12,23 @@ ControlPanel::ControlPanel(
std::shared_ptr<CallbackManager> callback_manager
) : graphics{std::move(graphics)},
machine_state{std::move(machine_state)},
callback_manager{std::move(callback_manager)} {}
callback_manager{std::move(callback_manager)}
{
}
void ControlPanel::render() {
void ControlPanel::render()
{
constexpr auto full_width = ImVec2(-FLT_MIN, 0.0f);
if (ImGui::Begin("Chip-8 - Controls")) {
if (ImGui::Button("Load Rom", full_width)) {
if (ImGui::Begin("Chip-8 - Controls"))
{
if (ImGui::Button("Load Rom", full_width))
{
this->on_click_load_rom();
}
if (ImGui::Button(run ? "Pause" : "Run", full_width)) {
if (ImGui::Button(run ? "Pause" : "Run", full_width))
{
this->run = !run;
}
@@ -45,7 +51,8 @@ void ControlPanel::render() {
ImGui::SeparatorText("");
if (ImGui::Button("Reset", full_width)) {
if (ImGui::Button("Reset", full_width))
{
this->callback_manager->trigger_reset();
}
ImGui::Button("Reload ROM", full_width);
@@ -54,7 +61,8 @@ void ControlPanel::render() {
ImGui::End();
}
void ControlPanel::on_click_load_rom() {
void ControlPanel::on_click_load_rom()
{
constexpr SDL_DialogFileFilter filters[] = {
{"CHIP8 ROMs", "ch8"},
{"All files", "*"}
@@ -71,12 +79,14 @@ void ControlPanel::on_click_load_rom() {
);
}
void ControlPanel::on_callback_load_rom(void* self, const char* const* filelist, int filter) {
void ControlPanel::on_callback_load_rom(void* self, const char* const* filelist, int filter)
{
const auto control_panel = static_cast<ControlPanel*>(self);
if (!filelist || !*filelist) {
if (!filelist || !*filelist)
{
return;
}
control_panel->callback_manager->trigger_rom_load(filelist[0]);
}
}