mirror of
https://github.com/ggerganov/ggwave.git
synced 2026-02-25 00:45:07 +08:00
ggwave-gui : minor
This commit is contained in:
@@ -4,8 +4,6 @@
|
||||
|
||||
#include "ggwave-common.h"
|
||||
|
||||
#include <imgui-extra/imgui_impl.h>
|
||||
|
||||
#include <SDL_opengl.h>
|
||||
|
||||
#include <chrono>
|
||||
@@ -282,33 +280,3 @@ bool GGWave_deinit() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ImGui_beginFrame(SDL_Window * window) {
|
||||
SDL_Event event;
|
||||
while (SDL_PollEvent(&event))
|
||||
{
|
||||
ImGui_ProcessEvent(&event);
|
||||
if (event.type == SDL_QUIT) return false;
|
||||
if (event.type == SDL_WINDOWEVENT && event.window.event == SDL_WINDOWEVENT_CLOSE && event.window.windowID == SDL_GetWindowID(window)) return false;
|
||||
}
|
||||
|
||||
ImGui_NewFrame(window);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ImGui_endFrame(SDL_Window * window) {
|
||||
// Rendering
|
||||
int display_w, display_h;
|
||||
SDL_GetWindowSize(window, &display_w, &display_h);
|
||||
glViewport(0, 0, display_w, display_h);
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 0.4f);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
ImGui::Render();
|
||||
ImGui_RenderDrawData(ImGui::GetDrawData());
|
||||
|
||||
SDL_GL_SwapWindow(window);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -13,8 +13,3 @@ bool GGWave_init(const int playbackId, const int captureId);
|
||||
GGWave * GGWave_instance();
|
||||
bool GGWave_mainLoop();
|
||||
bool GGWave_deinit();
|
||||
|
||||
// ImGui helpers
|
||||
|
||||
bool ImGui_beginFrame(SDL_Window * window);
|
||||
bool ImGui_endFrame(SDL_Window * window);
|
||||
|
||||
@@ -559,8 +559,6 @@ void deinitMain(std::thread & worker) {
|
||||
g_isRunning = false;
|
||||
worker.join();
|
||||
|
||||
GGWave_deinit();
|
||||
|
||||
// Cleanup
|
||||
ImGui_Shutdown();
|
||||
ImGui::DestroyContext();
|
||||
|
||||
@@ -1,5 +1,44 @@
|
||||
#include "common.h"
|
||||
|
||||
#include <imgui-extra/imgui_impl.h>
|
||||
|
||||
#include <SDL_opengl.h>
|
||||
|
||||
// ImGui helpers
|
||||
|
||||
bool ImGui_beginFrame(SDL_Window * window);
|
||||
bool ImGui_endFrame(SDL_Window * window);
|
||||
|
||||
bool ImGui_beginFrame(SDL_Window * window) {
|
||||
SDL_Event event;
|
||||
while (SDL_PollEvent(&event))
|
||||
{
|
||||
ImGui_ProcessEvent(&event);
|
||||
if (event.type == SDL_QUIT) return false;
|
||||
if (event.type == SDL_WINDOWEVENT && event.window.event == SDL_WINDOWEVENT_CLOSE && event.window.windowID == SDL_GetWindowID(window)) return false;
|
||||
}
|
||||
|
||||
ImGui_NewFrame(window);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ImGui_endFrame(SDL_Window * window) {
|
||||
// Rendering
|
||||
int display_w, display_h;
|
||||
SDL_GetWindowSize(window, &display_w, &display_h);
|
||||
glViewport(0, 0, display_w, display_h);
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 0.4f);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
ImGui::Render();
|
||||
ImGui_RenderDrawData(ImGui::GetDrawData());
|
||||
|
||||
SDL_GL_SwapWindow(window);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static SDL_Window * g_window;
|
||||
static void * g_gl_context;
|
||||
|
||||
@@ -49,6 +88,8 @@ int main(int argc, char** argv) {
|
||||
|
||||
deinitMain(worker);
|
||||
|
||||
GGWave_deinit();
|
||||
|
||||
SDL_GL_DeleteContext(g_gl_context);
|
||||
SDL_DestroyWindow(g_window);
|
||||
SDL_Quit();
|
||||
|
||||
Reference in New Issue
Block a user