diff --git a/src/xenia/ui/gl/premake5.lua b/src/xenia/ui/gl/premake5.lua index dab3c9a42..69e4a7c30 100644 --- a/src/xenia/ui/gl/premake5.lua +++ b/src/xenia/ui/gl/premake5.lua @@ -21,3 +21,43 @@ project("xenia-ui-gl") project_root.."/build_tools/third_party/gflags/src", }) local_platform_files() + removefiles({"*_demo.cc"}) + +group("demos") +project("xenia-ui-window-gl-demo") + uuid("e0a687e5-d1f4-4c18-b2f7-012c53ec1ee4") + kind("WindowedApp") + language("C++") + links({ + "elemental-forms", + "gflags", + "glew", + "imgui", + "xenia-base", + "xenia-core", + "xenia-ui", + "xenia-ui-gl", + }) + flags({ + "WinMain", -- Use WinMain instead of main. + }) + defines({ + "GLEW_STATIC=1", + "GLEW_MX=1", + }) + includedirs({ + project_root.."/third_party/elemental-forms/src", + project_root.."/build_tools/third_party/gflags/src", + }) + files({ + "../window_demo.cc", + "window_gl_demo.cc", + 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", + }) diff --git a/src/xenia/ui/gl/window_gl_demo.cc b/src/xenia/ui/gl/window_gl_demo.cc new file mode 100644 index 000000000..7db76602a --- /dev/null +++ b/src/xenia/ui/gl/window_gl_demo.cc @@ -0,0 +1,30 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2015 Ben Vanik. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#include +#include + +#include "xenia/base/main.h" +#include "xenia/ui/gl/gl_context.h" +#include "xenia/ui/window.h" + +namespace xe { +namespace ui { + +int window_demo_main(const std::vector& args); + +std::unique_ptr CreateDemoContext(Window* window) { + return xe::ui::gl::GLContext::Create(window); +} + +} // namespace ui +} // namespace xe + +DEFINE_ENTRY_POINT(L"xenia-ui-window-gl-demo", L"xenia-ui-window-gl-demo", + xe::ui::window_demo_main); diff --git a/src/xenia/ui/premake5.lua b/src/xenia/ui/premake5.lua index 35f40ef1f..03e363acc 100644 --- a/src/xenia/ui/premake5.lua +++ b/src/xenia/ui/premake5.lua @@ -17,41 +17,4 @@ project("xenia-ui") project_root.."/build_tools/third_party/gflags/src", }) local_platform_files() - -group("demos") -project("xenia-ui-window-demo") - uuid("e0a687e5-d1f4-4c18-b2f7-012c53ec1ee4") - kind("WindowedApp") - language("C++") - links({ - "elemental-forms", - "gflags", - "glew", - "imgui", - "xenia-base", - "xenia-core", - "xenia-ui", - "xenia-ui-gl", - }) - flags({ - "WinMain", -- Use WinMain instead of main. - }) - defines({ - "GLEW_STATIC=1", - "GLEW_MX=1", - }) - includedirs({ - project_root.."/third_party/elemental-forms/src", - project_root.."/build_tools/third_party/gflags/src", - }) - files({ - "window_demo.cc", - "../base/main_"..platform_suffix..".cc", - }) - files({ - project_root.."/third_party/elemental-forms/resources.rc", - }) - resincludedirs({ - project_root, - project_root.."/third_party/elemental-forms", - }) + removefiles({"*_demo.cc"}) diff --git a/src/xenia/ui/window_demo.cc b/src/xenia/ui/window_demo.cc index abdab998f..aefa28882 100644 --- a/src/xenia/ui/window_demo.cc +++ b/src/xenia/ui/window_demo.cc @@ -19,13 +19,15 @@ #include "xenia/base/platform_win.h" #include "xenia/base/threading.h" #include "xenia/profiling.h" -#include "xenia/ui/gl/gl_context.h" #include "xenia/ui/imgui_drawer.h" #include "xenia/ui/window.h" namespace xe { namespace ui { +// Implemented in one of the window_*_demo.cc files under a subdir. +std::unique_ptr CreateDemoContext(Window* window); + std::unique_ptr imgui_drawer_; int window_demo_main(const std::vector& args) { @@ -34,7 +36,7 @@ int window_demo_main(const std::vector& args) { // Create run loop and the window. auto loop = ui::Loop::Create(); - auto window = xe::ui::Window::Create(loop.get(), L"xenia-ui-window-demo"); + auto window = xe::ui::Window::Create(loop.get(), GetEntryInfo().name); loop->PostSynchronous([&window]() { xe::threading::set_name("Win32 Loop"); xe::Profiler::ThreadEnter("Win32 Loop"); @@ -80,7 +82,7 @@ int window_demo_main(const std::vector& args) { // Create context and give it to the window. // The window will finish initialization wtih the context (loading // resources, etc). - auto context = xe::ui::gl::GLContext::Create(window.get()); + auto context = CreateDemoContext(window.get()); window->set_context(std::move(context)); // Setup the profiler display. @@ -184,8 +186,6 @@ int window_demo_main(const std::vector& args) { window->Invalidate(); }); - window->Invalidate(); - // Wait until we are exited. loop->AwaitQuit(); @@ -201,5 +201,3 @@ int window_demo_main(const std::vector& args) { } // namespace ui } // namespace xe -DEFINE_ENTRY_POINT(L"xenia-ui-window-demo", L"xenia-ui-window-demo", - xe::ui::window_demo_main);