Some progress

This commit is contained in:
SimoZ64
2025-05-22 00:30:33 +02:00
parent 8fa341bf72
commit 722a0e98c0
14 changed files with 317 additions and 178 deletions

View File

@@ -2,20 +2,12 @@
#include <nfd.hpp>
#include <backend/Core.hpp>
#include <ImGuiImpl/StatusBar.hpp>
#include <imgui.h>
#include <imgui_impl_sdl3.h>
#include <imgui_impl_vulkan.h>
#include <ImGuiImpl/GUI.hpp>
static void check_vk_result(VkResult err)
{
if (err == 0)
return;
fprintf(stderr, "[vulkan] Error: VkResult = %d\n", err);
if (err < 0)
abort();
}
KaizenGui::KaizenGui() noexcept : window("Kaizen", 1280, 720), core(std::make_shared<n64::Core>()), vulkanWidget(core, window.getHandle()), emuThread(core, fpsCounter, vulkanWidget, settingsWindow) {
KaizenGui::KaizenGui() noexcept : window("Kaizen", 1280, 720), core(std::make_shared<n64::Core>()), vulkanWidget(core, window.getHandle()), emuThread(core, fpsCounter, vulkanWidget, settingsWindow, *this) {
core->parallel.Init(vulkanWidget.wsiPlatform, vulkanWidget.windowInfo, core->cpu->GetMem().GetRDRAMPtr());
gui::Initialize(core->parallel.wsi, window.getHandle());
emuExitFunc = [&]() {
quit = true;
if (emuThread.isRunning) {
@@ -28,7 +20,7 @@ KaizenGui::KaizenGui() noexcept : window("Kaizen", 1280, 720), core(std::make_sh
ImGui::Text("Kaizen is a Nintendo 64 emulator that strives");
ImGui::Text("to offer a friendly user experience and compatibility.");
ImGui::Text("Kaizen is licensed under the BSD 3-clause license.");
ImGui::Text("Nintendo 64 is a registered trademarks of Nintendo Co., Ltd.");
ImGui::Text("Nintendo 64 is a registered trademark of Nintendo Co., Ltd.");
if(ImGui::Button("OK")) {
about.setOpened(false);
}
@@ -55,24 +47,34 @@ KaizenGui::KaizenGui() noexcept : window("Kaizen", 1280, 720), core(std::make_sh
}
});
menuBar.addMenu({"Emulation",
{
actionPause,
actionStop,
actionReset,
{"Settings", [&]() {
settingsWindow.render();
}},
}
});
menuBar.addMenu({
"Emulation", {
actionPause,
actionStop,
actionReset,
{"Settings", [&]() {
settingsWindow.render();
}},
}});
menuBar.addMenu({"Help",
{
{"About", [&]() {
about.setOpened(true);
}},
}
});
menuBar.addMenu({
"Help", {
{"About", [&]() {
about.setOpened(true);
}},
}});
}
void KaizenGui::RenderUI() {
gui::StartFrame();
menuBar.render();
about.render();
statusBar.render();
gui::EndFrame();
}
void KaizenGui::LoadROM(const std::string &path) noexcept {
@@ -88,6 +90,7 @@ void KaizenGui::LoadROM(const std::string &path) noexcept {
void KaizenGui::handleEvents() {
SDL_Event e;
while(SDL_PollEvent(&e)) {
ImGui_ImplSDL3_ProcessEvent(&e);
switch(e.type) {
case SDL_EVENT_QUIT:
emuExitFunc();
@@ -99,12 +102,6 @@ void KaizenGui::handleEvents() {
int KaizenGui::run() {
while(!quit) {
handleEvents();
menuBar.render();
about.render();
statusBar.render();
}
return 0;