mirror of https://github.com/sm64pc/sm64pc.git
Add menu bar to ImGui
This commit is contained in:
parent
bd20d16d07
commit
c7e928f631
|
@ -28,8 +28,10 @@
|
||||||
#define GL_GLEXT_PROTOTYPES 1
|
#define GL_GLEXT_PROTOTYPES 1
|
||||||
#ifdef USE_GLES
|
#ifdef USE_GLES
|
||||||
# include <SDL2/SDL_opengles2.h>
|
# include <SDL2/SDL_opengles2.h>
|
||||||
|
# define RAPI_NAME "OpenGL ES"
|
||||||
#else
|
#else
|
||||||
# include <SDL2/SDL_opengl.h>
|
# include <SDL2/SDL_opengl.h>
|
||||||
|
# define RAPI_NAME "OpenGL"
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -49,7 +51,8 @@ extern "C" {
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
bool showWindow = true;
|
bool showMenu = true;
|
||||||
|
bool showWindowMoon = false;
|
||||||
|
|
||||||
SDL_Window* window = nullptr;
|
SDL_Window* window = nullptr;
|
||||||
ImGuiIO io;
|
ImGuiIO io;
|
||||||
|
@ -87,7 +90,7 @@ namespace MoonInternal {
|
||||||
switch (ev->type){
|
switch (ev->type){
|
||||||
case SDL_KEYDOWN:
|
case SDL_KEYDOWN:
|
||||||
if(ev->key.keysym.sym == SDLK_F12)
|
if(ev->key.keysym.sym == SDLK_F12)
|
||||||
showWindow = !showWindow;
|
showMenu = !showMenu;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}});
|
}});
|
||||||
|
@ -100,16 +103,22 @@ namespace MoonInternal {
|
||||||
MoonInternal::initBindHook(0);
|
MoonInternal::initBindHook(0);
|
||||||
MoonInternal::callBindHook(0);
|
MoonInternal::callBindHook(0);
|
||||||
|
|
||||||
if(showWindow){
|
if(showMenu){
|
||||||
|
ImGui::BeginMainMenuBar();
|
||||||
|
ImGui::MenuItem("Moon64", NULL, &showWindowMoon);
|
||||||
|
ImGui::EndMainMenuBar();
|
||||||
|
|
||||||
|
if (showWindowMoon){
|
||||||
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0, 0, 0, 0));
|
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0, 0, 0, 0));
|
||||||
ImGui::Begin("Moon64 Game Stats", NULL, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize);
|
ImGui::Begin("Moon64 Game Stats", NULL, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove);
|
||||||
ImGui::Text("Framerate: %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
|
ImGui::SetWindowPos(ImVec2(10, 35));
|
||||||
ImGui::Text("Platform: " PLATFORM);
|
ImGui::Text("Platform: " PLATFORM " (" RAPI_NAME ")");
|
||||||
ImGui::Text("Branch: " GIT_BRANCH);
|
ImGui::Text("Status: %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
|
||||||
ImGui::Text("Commit: " GIT_HASH);
|
ImGui::Text("Version: " GIT_BRANCH " " GIT_HASH);
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
ImGui::PopStyleColor();
|
ImGui::PopStyleColor();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::Render();
|
ImGui::Render();
|
||||||
GLint last_program;
|
GLint last_program;
|
||||||
|
|
Loading…
Reference in New Issue