Dropping elemental-forms and swapping out with imgui.

Too much code for such little use. This should simplify porting.
This commit is contained in:
Ben Vanik
2015-12-26 20:25:24 -08:00
parent 2071286040
commit 0e58208add
39 changed files with 644 additions and 1100 deletions

View File

@@ -34,7 +34,6 @@ DEFINE_string(hid, "any", "Input system. Use: [any, nop, winkey, xinput]");
namespace xe {
namespace hid {
std::unique_ptr<xe::ui::ImGuiDrawer> imgui_drawer_;
std::unique_ptr<xe::hid::InputSystem> input_system_;
std::vector<std::unique_ptr<hid::InputDriver>> CreateInputDrivers(
@@ -88,7 +87,6 @@ int hid_demo_main(const std::vector<std::wstring>& args) {
window->on_closed.AddListener([&loop](xe::ui::UIEvent* e) {
loop->Quit();
XELOGI("User-initiated death!");
imgui_drawer_.reset();
exit(1);
});
loop->on_quit.AddListener([&window](xe::ui::UIEvent* e) { window.reset(); });
@@ -105,30 +103,18 @@ int hid_demo_main(const std::vector<std::wstring>& args) {
graphics_provider = CreateDemoGraphicsProvider(window.get());
window->set_context(graphics_provider->CreateContext(window.get()));
// Initialize the ImGui renderer we'll use.
imgui_drawer_ = std::make_unique<xe::ui::ImGuiDrawer>(window.get());
imgui_drawer_->SetupDefaultInput();
// Initialize input system and all drivers.
input_system_ = std::make_unique<xe::hid::InputSystem>(window.get());
auto drivers = CreateInputDrivers(window.get());
for (size_t i = 0; i < drivers.size(); ++i) {
input_system_->AddDriver(std::move(drivers[i]));
}
window->Invalidate();
});
window->on_painting.AddListener([&](xe::ui::UIEvent* e) {
auto& io = ImGui::GetIO();
auto current_tick_count = Clock::QueryHostTickCount();
static uint64_t last_draw_tick_count = 0;
io.DeltaTime = (current_tick_count - last_draw_tick_count) /
static_cast<float>(Clock::host_tick_frequency());
last_draw_tick_count = current_tick_count;
io.DisplaySize = ImVec2(static_cast<float>(window->width()),
static_cast<float>(window->height()));
ImGui::NewFrame();
auto& io = window->imgui_drawer()->GetIO();
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(-1, 0));
ImGui::Begin("main_window", nullptr, ImGuiWindowFlags_NoMove |
@@ -146,8 +132,6 @@ int hid_demo_main(const std::vector<std::wstring>& args) {
ImGui::End();
ImGui::PopStyleVar();
ImGui::Render();
// Continuous paint.
window->Invalidate();
});
@@ -155,7 +139,6 @@ int hid_demo_main(const std::vector<std::wstring>& args) {
// Wait until we are exited.
loop->AwaitQuit();
imgui_drawer_.reset();
input_system_.reset();
loop->PostSynchronous([&graphics_provider]() { graphics_provider.reset(); });

View File

@@ -23,7 +23,6 @@ project("xenia-hid-demo")
kind("WindowedApp")
language("C++")
links({
"elemental-forms",
"gflags",
"glew",
"imgui",
@@ -41,7 +40,6 @@ project("xenia-hid-demo")
"GLEW_MX=1",
})
includedirs({
project_root.."/third_party/elemental-forms/src",
project_root.."/build_tools/third_party/gflags/src",
})
files({
@@ -49,11 +47,9 @@ project("xenia-hid-demo")
project_root.."/src/xenia/base/main_"..platform_suffix..".cc",
})
files({
project_root.."/third_party/elemental-forms/resources.rc",
})
resincludedirs({
project_root,
project_root.."/third_party/elemental-forms",
})
filter("platforms:Windows")

View File

@@ -15,6 +15,5 @@ project("xenia-hid-winkey")
})
includedirs({
project_root.."/build_tools/third_party/gflags/src",
project_root.."/third_party/elemental-forms/src",
})
local_platform_files()