Converted test application from QuickApp to proper sub class.
This commit is contained in:
parent
0f2f5973fb
commit
58329a2033
@ -3,6 +3,8 @@ Import('env')
|
||||
|
||||
src_files = Split("""
|
||||
main.cpp
|
||||
|
||||
application.cpp
|
||||
""")
|
||||
|
||||
prog_app = env.UnityProgram(
|
||||
|
57
private/raid_test/application.cpp
Normal file
57
private/raid_test/application.cpp
Normal file
@ -0,0 +1,57 @@
|
||||
|
||||
#include "raid_test/application.hpp"
|
||||
|
||||
namespace raid_test
|
||||
{
|
||||
Application gApplication;
|
||||
|
||||
bool Application::init()
|
||||
{
|
||||
if (!raid::Application::init()) {
|
||||
return false;
|
||||
}
|
||||
setMainWindowFlags(raid::DEFAULT_MAIN_WINDOW_FLAGS | ImGuiWindowFlags_MenuBar | ImGuiWindowFlags_NoDocking);
|
||||
setMainWindowStyle(ImGuiStyleVar_WindowPadding, ImVec2());
|
||||
setMainWindowStyle(ImGuiStyleVar_WindowBorderSize, 0.f);
|
||||
return true;
|
||||
}
|
||||
|
||||
void Application::configureImgui()
|
||||
{
|
||||
raid::Application::configureImgui();
|
||||
ImGuiIO& imguiIO = ImGui::GetIO();
|
||||
imguiIO.ConfigFlags |= ImGuiConfigFlags_DockingEnable;
|
||||
}
|
||||
|
||||
void Application::render()
|
||||
{
|
||||
if (ImGui::BeginMenuBar())
|
||||
{
|
||||
if (ImGui::BeginMenu("File"))
|
||||
{
|
||||
if (ImGui::MenuItem("Quit"))
|
||||
{
|
||||
requestQuit();
|
||||
}
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
ImGui::EndMenuBar();
|
||||
}
|
||||
ImGui::Text("hi");
|
||||
|
||||
ImGui::ShowMetricsWindow();
|
||||
ImGui::Begin("Test");
|
||||
ImGui::Text("Test Content");
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
std::string Application::getFolderName()
|
||||
{
|
||||
return "raid_test_app";
|
||||
}
|
||||
|
||||
std::string Application::getWindowTitle()
|
||||
{
|
||||
return "RAID Test Application";
|
||||
}
|
||||
} // namespace raid_test
|
24
private/raid_test/application.hpp
Normal file
24
private/raid_test/application.hpp
Normal file
@ -0,0 +1,24 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#if !defined(RAID_TEST_APPLICATION_HPP_INCLUDED)
|
||||
#define RAID_TEST_APPLICATION_HPP_INCLUDED 1
|
||||
|
||||
#include "raid/raid.hpp"
|
||||
|
||||
namespace raid_test
|
||||
{
|
||||
class Application : public raid::Application
|
||||
{
|
||||
protected:
|
||||
bool init() override;
|
||||
void configureImgui() override;
|
||||
void render() override;
|
||||
std::string getFolderName() override;
|
||||
std::string getWindowTitle() override;
|
||||
};
|
||||
|
||||
extern Application gApplication;
|
||||
} // namespace raid_test
|
||||
|
||||
#endif // !defined(RAID_TEST_APPLICATION_HPP_INCLUDED)
|
@ -1,40 +1,7 @@
|
||||
|
||||
#include "raid/raid.hpp"
|
||||
|
||||
#include <imgui.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
void render()
|
||||
{
|
||||
if (ImGui::BeginMenuBar())
|
||||
{
|
||||
if (ImGui::BeginMenu("File"))
|
||||
{
|
||||
if (ImGui::MenuItem("Quit"))
|
||||
{
|
||||
raid::QuickApp::get().requestQuit();
|
||||
}
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
ImGui::EndMenuBar();
|
||||
}
|
||||
ImGui::Text("hi");
|
||||
|
||||
ImGui::Begin("Test");
|
||||
ImGui::Text("Test Content");
|
||||
ImGui::End();
|
||||
}
|
||||
}
|
||||
#include "./application.hpp"
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
return raid::runQuick(argc, argv, {
|
||||
.callbacks = {
|
||||
.render = &render
|
||||
},
|
||||
.folderName = "raid_test_app",
|
||||
.windowTitle = "RAID Test App",
|
||||
.mainWindowFlags = raid::DEFAULT_MAIN_WINDOW_FLAGS | ImGuiWindowFlags_MenuBar
|
||||
});
|
||||
return raid_test::gApplication.run(argc, argv);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user