Making window demo graphics API-specific.

This commit is contained in:
Ben Vanik 2015-11-07 10:53:07 -08:00
parent f065872241
commit 91229de429
4 changed files with 76 additions and 45 deletions

View File

@ -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",
})

View File

@ -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 <string>
#include <vector>
#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<std::wstring>& args);
std::unique_ptr<GraphicsContext> 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);

View File

@ -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"})

View File

@ -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<GraphicsContext> CreateDemoContext(Window* window);
std::unique_ptr<xe::ui::ImGuiDrawer> imgui_drawer_;
int window_demo_main(const std::vector<std::wstring>& args) {
@ -34,7 +36,7 @@ int window_demo_main(const std::vector<std::wstring>& 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<std::wstring>& 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<std::wstring>& args) {
window->Invalidate();
});
window->Invalidate();
// Wait until we are exited.
loop->AwaitQuit();
@ -201,5 +201,3 @@ int window_demo_main(const std::vector<std::wstring>& args) {
} // namespace ui
} // namespace xe
DEFINE_ENTRY_POINT(L"xenia-ui-window-demo", L"xenia-ui-window-demo",
xe::ui::window_demo_main);