mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-08 23:25:40 +12:00
More terrible code to get Imgui+Lua working on Qt
This commit is contained in:
parent
918645479a
commit
3a33b4f8b8
3 changed files with 12 additions and 24 deletions
|
@ -55,6 +55,7 @@ include_directories(third_party/httplib)
|
||||||
include_directories(third_party/stb)
|
include_directories(third_party/stb)
|
||||||
include_directories(third_party/opengl)
|
include_directories(third_party/opengl)
|
||||||
include_directories(third_party/mio/single_include)
|
include_directories(third_party/mio/single_include)
|
||||||
|
include_directories(third_party/imgui-lua-bindings)
|
||||||
|
|
||||||
add_compile_definitions(NOMINMAX) # Make windows.h not define min/max macros because third-party deps don't like it
|
add_compile_definitions(NOMINMAX) # Make windows.h not define min/max macros because third-party deps don't like it
|
||||||
add_compile_definitions(WIN32_LEAN_AND_MEAN) # Make windows.h not include literally everything
|
add_compile_definitions(WIN32_LEAN_AND_MEAN) # Make windows.h not include literally everything
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifdef PANDA3DS_ENABLE_LUA
|
#ifdef PANDA3DS_ENABLE_LUA
|
||||||
#include "lua_manager.hpp"
|
#include "lua_manager.hpp"
|
||||||
|
|
||||||
|
void LoadImguiBindings(lua_State* lState);
|
||||||
|
|
||||||
void LuaManager::initialize() {
|
void LuaManager::initialize() {
|
||||||
L = luaL_newstate(); // Open Lua
|
L = luaL_newstate(); // Open Lua
|
||||||
|
|
||||||
|
@ -12,6 +14,7 @@ void LuaManager::initialize() {
|
||||||
|
|
||||||
luaL_openlibs(L);
|
luaL_openlibs(L);
|
||||||
initializeThunks();
|
initializeThunks();
|
||||||
|
LoadImguiBindings(L);
|
||||||
|
|
||||||
initialized = true;
|
initialized = true;
|
||||||
haveScript = false;
|
haveScript = false;
|
||||||
|
@ -91,7 +94,6 @@ void LuaManager::reset() {
|
||||||
|
|
||||||
// Initialize C++ thunks for Lua code to call here
|
// Initialize C++ thunks for Lua code to call here
|
||||||
// All code beyond this point is terrible and full of global state, don't judge
|
// All code beyond this point is terrible and full of global state, don't judge
|
||||||
|
|
||||||
Memory* LuaManager::g_memory = nullptr;
|
Memory* LuaManager::g_memory = nullptr;
|
||||||
|
|
||||||
#define MAKE_MEMORY_FUNCTIONS(size) \
|
#define MAKE_MEMORY_FUNCTIONS(size) \
|
||||||
|
|
|
@ -179,6 +179,14 @@ void MainWindow::emuThreadMainLoop() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SDL_GL_MakeCurrent(nullptr, nullptr);
|
||||||
|
SDL_GL_MakeCurrent(windowSDL, glContextSDL);
|
||||||
|
// Start the Dear ImGui frame
|
||||||
|
ImGui_ImplOpenGL3_NewFrame();
|
||||||
|
ImGui_ImplSDL2_NewFrame(windowSDL);
|
||||||
|
ImGui::NewFrame();
|
||||||
|
screen.getGLContext()->MakeCurrent();
|
||||||
|
|
||||||
emu->runFrame();
|
emu->runFrame();
|
||||||
if (emu->romType != ROMType::None) {
|
if (emu->romType != ROMType::None) {
|
||||||
emu->getServiceManager().getHID().updateInputs(emu->getTicks());
|
emu->getServiceManager().getHID().updateInputs(emu->getTicks());
|
||||||
|
@ -199,30 +207,7 @@ void MainWindow::emuThreadMainLoop() {
|
||||||
ImGui_ImplSDL2_ProcessEvent(&event);
|
ImGui_ImplSDL2_ProcessEvent(&event);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start the Dear ImGui frame
|
|
||||||
ImGui_ImplOpenGL3_NewFrame();
|
|
||||||
ImGui_ImplSDL2_NewFrame(windowSDL);
|
|
||||||
ImGui::NewFrame();
|
|
||||||
|
|
||||||
// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear
|
|
||||||
// ImGui!).
|
|
||||||
bool show_demo_window = true;
|
bool show_demo_window = true;
|
||||||
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to create a named window.
|
|
||||||
{
|
|
||||||
static float f = 0.0f;
|
|
||||||
static int counter = 0;
|
|
||||||
|
|
||||||
ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it.
|
|
||||||
|
|
||||||
ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too)
|
|
||||||
ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state
|
|
||||||
if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated)
|
|
||||||
counter++;
|
|
||||||
ImGui::SameLine();
|
|
||||||
ImGui::Text("counter = %d", counter);
|
|
||||||
|
|
||||||
ImGui::End();
|
|
||||||
}
|
|
||||||
ImGui::ShowDemoWindow(&show_demo_window);
|
ImGui::ShowDemoWindow(&show_demo_window);
|
||||||
ImGui::Render();
|
ImGui::Render();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue