Code cleanup: moving poly::ui to xe::ui
This commit is contained in:
parent
4d15b2296e
commit
f7ca026db0
|
@ -62,6 +62,5 @@
|
||||||
],
|
],
|
||||||
|
|
||||||
'includes': [
|
'includes': [
|
||||||
'ui/sources.gypi',
|
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
# Copyright 2014 Ben Vanik. All Rights Reserved.
|
|
||||||
{
|
|
||||||
'sources': [
|
|
||||||
'control.cc',
|
|
||||||
'control.h',
|
|
||||||
'loop.h',
|
|
||||||
'menu_item.cc',
|
|
||||||
'menu_item.h',
|
|
||||||
'ui_event.h',
|
|
||||||
'window.h',
|
|
||||||
],
|
|
||||||
|
|
||||||
'conditions': [
|
|
||||||
['OS == "win"', {
|
|
||||||
'includes': [
|
|
||||||
'win32/sources.gypi',
|
|
||||||
],
|
|
||||||
}],
|
|
||||||
],
|
|
||||||
}
|
|
|
@ -142,7 +142,8 @@ GL4ProfilerDisplay::GL4ProfilerDisplay(WGLControl* control)
|
||||||
vao_(0),
|
vao_(0),
|
||||||
font_texture_(0),
|
font_texture_(0),
|
||||||
font_handle_(0),
|
font_handle_(0),
|
||||||
vertex_buffer_(MICROPROFILE_MAX_VERTICES * sizeof(Vertex) * 10, sizeof(Vertex)),
|
vertex_buffer_(MICROPROFILE_MAX_VERTICES * sizeof(Vertex) * 10,
|
||||||
|
sizeof(Vertex)),
|
||||||
draw_command_count_(0) {
|
draw_command_count_(0) {
|
||||||
if (!SetupFont() || !SetupState() || !SetupShaders()) {
|
if (!SetupFont() || !SetupState() || !SetupShaders()) {
|
||||||
// Hrm.
|
// Hrm.
|
||||||
|
@ -150,32 +151,32 @@ GL4ProfilerDisplay::GL4ProfilerDisplay(WGLControl* control)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pass through mouse events.
|
// Pass through mouse events.
|
||||||
control->on_mouse_down.AddListener([](poly::ui::MouseEvent& e) {
|
control->on_mouse_down.AddListener([](xe::ui::MouseEvent& e) {
|
||||||
Profiler::OnMouseDown(e.button() == poly::ui::MouseEvent::Button::kLeft,
|
Profiler::OnMouseDown(e.button() == xe::ui::MouseEvent::Button::kLeft,
|
||||||
e.button() == poly::ui::MouseEvent::Button::kRight);
|
e.button() == xe::ui::MouseEvent::Button::kRight);
|
||||||
e.set_handled(true);
|
e.set_handled(true);
|
||||||
});
|
});
|
||||||
control->on_mouse_up.AddListener([](poly::ui::MouseEvent& e) {
|
control->on_mouse_up.AddListener([](xe::ui::MouseEvent& e) {
|
||||||
Profiler::OnMouseUp();
|
Profiler::OnMouseUp();
|
||||||
e.set_handled(true);
|
e.set_handled(true);
|
||||||
});
|
});
|
||||||
control->on_mouse_move.AddListener([](poly::ui::MouseEvent& e) {
|
control->on_mouse_move.AddListener([](xe::ui::MouseEvent& e) {
|
||||||
Profiler::OnMouseMove(e.x(), e.y());
|
Profiler::OnMouseMove(e.x(), e.y());
|
||||||
e.set_handled(true);
|
e.set_handled(true);
|
||||||
});
|
});
|
||||||
control->on_mouse_wheel.AddListener([](poly::ui::MouseEvent& e) {
|
control->on_mouse_wheel.AddListener([](xe::ui::MouseEvent& e) {
|
||||||
Profiler::OnMouseWheel(e.x(), e.y(), -e.dy());
|
Profiler::OnMouseWheel(e.x(), e.y(), -e.dy());
|
||||||
e.set_handled(true);
|
e.set_handled(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Watch for toggle/mode keys and such.
|
// Watch for toggle/mode keys and such.
|
||||||
control->on_key_down.AddListener([](poly::ui::KeyEvent& e) {
|
control->on_key_down.AddListener([](xe::ui::KeyEvent& e) {
|
||||||
Profiler::OnKeyDown(e.key_code());
|
Profiler::OnKeyDown(e.key_code());
|
||||||
//e.set_handled(true);
|
// e.set_handled(true);
|
||||||
});
|
});
|
||||||
control->on_key_up.AddListener([](poly::ui::KeyEvent& e) {
|
control->on_key_up.AddListener([](xe::ui::KeyEvent& e) {
|
||||||
Profiler::OnKeyUp(e.key_code());
|
Profiler::OnKeyUp(e.key_code());
|
||||||
//e.set_handled(true);
|
// e.set_handled(true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -258,7 +259,7 @@ struct VertexData { \n\
|
||||||
};\n\
|
};\n\
|
||||||
";
|
";
|
||||||
const std::string vertex_shader_source = header +
|
const std::string vertex_shader_source = header +
|
||||||
"\n\
|
"\n\
|
||||||
layout(location = 0) uniform mat4 projection_matrix; \n\
|
layout(location = 0) uniform mat4 projection_matrix; \n\
|
||||||
struct VertexFetch { \n\
|
struct VertexFetch { \n\
|
||||||
vec2 pos; \n\
|
vec2 pos; \n\
|
||||||
|
@ -274,7 +275,7 @@ void main() { \n\
|
||||||
} \n\
|
} \n\
|
||||||
";
|
";
|
||||||
const std::string fragment_shader_source = header +
|
const std::string fragment_shader_source = header +
|
||||||
"\n\
|
"\n\
|
||||||
layout(location = 1, bindless_sampler) uniform sampler2D font_texture; \n\
|
layout(location = 1, bindless_sampler) uniform sampler2D font_texture; \n\
|
||||||
layout(location = 2) uniform float font_height; \n\
|
layout(location = 2) uniform float font_height; \n\
|
||||||
layout(location = 0) in VertexData vtx; \n\
|
layout(location = 0) in VertexData vtx; \n\
|
||||||
|
|
|
@ -21,8 +21,8 @@ namespace gl4 {
|
||||||
extern "C" GLEWContext* glewGetContext();
|
extern "C" GLEWContext* glewGetContext();
|
||||||
extern "C" WGLEWContext* wglewGetContext();
|
extern "C" WGLEWContext* wglewGetContext();
|
||||||
|
|
||||||
WGLControl::WGLControl(poly::ui::Loop* loop)
|
WGLControl::WGLControl(xe::ui::Loop* loop)
|
||||||
: poly::ui::win32::Win32Control(Flags::kFlagOwnPaint), loop_(loop) {}
|
: xe::ui::win32::Win32Control(Flags::kFlagOwnPaint), loop_(loop) {}
|
||||||
|
|
||||||
WGLControl::~WGLControl() = default;
|
WGLControl::~WGLControl() = default;
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ bool WGLControl::Create() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WGLControl::OnLayout(poly::ui::UIEvent& e) { Control::ResizeToFill(); }
|
void WGLControl::OnLayout(xe::ui::UIEvent& e) { Control::ResizeToFill(); }
|
||||||
|
|
||||||
LRESULT WGLControl::WndProc(HWND hWnd, UINT message, WPARAM wParam,
|
LRESULT WGLControl::WndProc(HWND hWnd, UINT message, WPARAM wParam,
|
||||||
LPARAM lParam) {
|
LPARAM lParam) {
|
||||||
|
@ -89,7 +89,7 @@ LRESULT WGLControl::WndProc(HWND hWnd, UINT message, WPARAM wParam,
|
||||||
current_paint_callback_ = nullptr;
|
current_paint_callback_ = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
poly::ui::UIEvent e(this);
|
xe::ui::UIEvent e(this);
|
||||||
OnPaint(e);
|
OnPaint(e);
|
||||||
|
|
||||||
// TODO(benvanik): profiler present.
|
// TODO(benvanik): profiler present.
|
||||||
|
|
|
@ -13,17 +13,17 @@
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
#include "poly/threading.h"
|
#include "poly/threading.h"
|
||||||
#include "poly/ui/loop.h"
|
|
||||||
#include "poly/ui/win32/win32_control.h"
|
|
||||||
#include "xenia/gpu/gl4/gl_context.h"
|
#include "xenia/gpu/gl4/gl_context.h"
|
||||||
|
#include "xenia/ui/loop.h"
|
||||||
|
#include "xenia/ui/win32/win32_control.h"
|
||||||
|
|
||||||
namespace xe {
|
namespace xe {
|
||||||
namespace gpu {
|
namespace gpu {
|
||||||
namespace gl4 {
|
namespace gl4 {
|
||||||
|
|
||||||
class WGLControl : public poly::ui::win32::Win32Control {
|
class WGLControl : public xe::ui::win32::Win32Control {
|
||||||
public:
|
public:
|
||||||
WGLControl(poly::ui::Loop* loop);
|
WGLControl(xe::ui::Loop* loop);
|
||||||
~WGLControl() override;
|
~WGLControl() override;
|
||||||
|
|
||||||
GLContext* context() { return &context_; }
|
GLContext* context() { return &context_; }
|
||||||
|
@ -33,13 +33,13 @@ class WGLControl : public poly::ui::win32::Win32Control {
|
||||||
protected:
|
protected:
|
||||||
bool Create() override;
|
bool Create() override;
|
||||||
|
|
||||||
void OnLayout(poly::ui::UIEvent& e) override;
|
void OnLayout(xe::ui::UIEvent& e) override;
|
||||||
|
|
||||||
LRESULT WndProc(HWND hWnd, UINT message, WPARAM wParam,
|
LRESULT WndProc(HWND hWnd, UINT message, WPARAM wParam,
|
||||||
LPARAM lParam) override;
|
LPARAM lParam) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
poly::ui::Loop* loop_;
|
xe::ui::Loop* loop_;
|
||||||
GLContext context_;
|
GLContext context_;
|
||||||
std::function<void()> current_paint_callback_;
|
std::function<void()> current_paint_callback_;
|
||||||
};
|
};
|
||||||
|
|
|
@ -767,7 +767,7 @@ class TraceReader {
|
||||||
|
|
||||||
class TracePlayer : public TraceReader {
|
class TracePlayer : public TraceReader {
|
||||||
public:
|
public:
|
||||||
TracePlayer(poly::ui::Loop* loop, GraphicsSystem* graphics_system)
|
TracePlayer(xe::ui::Loop* loop, GraphicsSystem* graphics_system)
|
||||||
: loop_(loop),
|
: loop_(loop),
|
||||||
graphics_system_(graphics_system),
|
graphics_system_(graphics_system),
|
||||||
current_frame_index_(0),
|
current_frame_index_(0),
|
||||||
|
@ -827,7 +827,7 @@ class TracePlayer : public TraceReader {
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
poly::ui::Loop* loop_;
|
xe::ui::Loop* loop_;
|
||||||
GraphicsSystem* graphics_system_;
|
GraphicsSystem* graphics_system_;
|
||||||
int current_frame_index_;
|
int current_frame_index_;
|
||||||
int current_command_index_;
|
int current_command_index_;
|
||||||
|
@ -2213,7 +2213,7 @@ int trace_viewer_main(std::vector<std::wstring>& args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
auto control = window->child(0);
|
auto control = window->child(0);
|
||||||
control->on_key_char.AddListener([graphics_system](poly::ui::KeyEvent& e) {
|
control->on_key_char.AddListener([graphics_system](xe::ui::KeyEvent& e) {
|
||||||
auto& io = ImGui::GetIO();
|
auto& io = ImGui::GetIO();
|
||||||
if (e.key_code() > 0 && e.key_code() < 0x10000) {
|
if (e.key_code() > 0 && e.key_code() < 0x10000) {
|
||||||
if (e.key_code() == 0x74 /* VK_F5 */) {
|
if (e.key_code() == 0x74 /* VK_F5 */) {
|
||||||
|
@ -2224,41 +2224,41 @@ int trace_viewer_main(std::vector<std::wstring>& args) {
|
||||||
}
|
}
|
||||||
e.set_handled(true);
|
e.set_handled(true);
|
||||||
});
|
});
|
||||||
control->on_mouse_down.AddListener([](poly::ui::MouseEvent& e) {
|
control->on_mouse_down.AddListener([](xe::ui::MouseEvent& e) {
|
||||||
auto& io = ImGui::GetIO();
|
auto& io = ImGui::GetIO();
|
||||||
io.MousePos = ImVec2(float(e.x()), float(e.y()));
|
io.MousePos = ImVec2(float(e.x()), float(e.y()));
|
||||||
switch (e.button()) {
|
switch (e.button()) {
|
||||||
case poly::ui::MouseEvent::Button::kLeft:
|
case xe::ui::MouseEvent::Button::kLeft:
|
||||||
io.MouseDown[0] = true;
|
io.MouseDown[0] = true;
|
||||||
break;
|
break;
|
||||||
case poly::ui::MouseEvent::Button::kRight:
|
case xe::ui::MouseEvent::Button::kRight:
|
||||||
io.MouseDown[1] = true;
|
io.MouseDown[1] = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
control->on_mouse_move.AddListener([](poly::ui::MouseEvent& e) {
|
control->on_mouse_move.AddListener([](xe::ui::MouseEvent& e) {
|
||||||
auto& io = ImGui::GetIO();
|
auto& io = ImGui::GetIO();
|
||||||
io.MousePos = ImVec2(float(e.x()), float(e.y()));
|
io.MousePos = ImVec2(float(e.x()), float(e.y()));
|
||||||
});
|
});
|
||||||
control->on_mouse_up.AddListener([](poly::ui::MouseEvent& e) {
|
control->on_mouse_up.AddListener([](xe::ui::MouseEvent& e) {
|
||||||
auto& io = ImGui::GetIO();
|
auto& io = ImGui::GetIO();
|
||||||
io.MousePos = ImVec2(float(e.x()), float(e.y()));
|
io.MousePos = ImVec2(float(e.x()), float(e.y()));
|
||||||
switch (e.button()) {
|
switch (e.button()) {
|
||||||
case poly::ui::MouseEvent::Button::kLeft:
|
case xe::ui::MouseEvent::Button::kLeft:
|
||||||
io.MouseDown[0] = false;
|
io.MouseDown[0] = false;
|
||||||
break;
|
break;
|
||||||
case poly::ui::MouseEvent::Button::kRight:
|
case xe::ui::MouseEvent::Button::kRight:
|
||||||
io.MouseDown[1] = false;
|
io.MouseDown[1] = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
control->on_mouse_wheel.AddListener([](poly::ui::MouseEvent& e) {
|
control->on_mouse_wheel.AddListener([](xe::ui::MouseEvent& e) {
|
||||||
auto& io = ImGui::GetIO();
|
auto& io = ImGui::GetIO();
|
||||||
io.MousePos = ImVec2(float(e.x()), float(e.y()));
|
io.MousePos = ImVec2(float(e.x()), float(e.y()));
|
||||||
io.MouseWheel += float(e.dy() / 120.0f);
|
io.MouseWheel += float(e.dy() / 120.0f);
|
||||||
});
|
});
|
||||||
|
|
||||||
control->on_paint.AddListener([&](poly::ui::UIEvent& e) {
|
control->on_paint.AddListener([&](xe::ui::UIEvent& e) {
|
||||||
static bool imgui_setup = false;
|
static bool imgui_setup = false;
|
||||||
if (!imgui_setup) {
|
if (!imgui_setup) {
|
||||||
ImImpl_Setup();
|
ImImpl_Setup();
|
||||||
|
|
|
@ -7,11 +7,11 @@
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "poly/ui/control.h"
|
#include "xenia/ui/control.h"
|
||||||
|
|
||||||
#include "poly/assert.h"
|
#include "poly/assert.h"
|
||||||
|
|
||||||
namespace poly {
|
namespace xe {
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
Control::Control(uint32_t flags)
|
Control::Control(uint32_t flags)
|
||||||
|
@ -129,4 +129,4 @@ void Control::OnMouseWheel(MouseEvent& e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace ui
|
} // namespace ui
|
||||||
} // namespace poly
|
} // namespace xe
|
|
@ -7,16 +7,16 @@
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef POLY_UI_CONTROL_H_
|
#ifndef XENIA_UI_CONTROL_H_
|
||||||
#define POLY_UI_CONTROL_H_
|
#define XENIA_UI_CONTROL_H_
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "poly/delegate.h"
|
#include "poly/delegate.h"
|
||||||
#include "poly/ui/ui_event.h"
|
#include "xenia/ui/ui_event.h"
|
||||||
|
|
||||||
namespace poly {
|
namespace xe {
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
class Control {
|
class Control {
|
||||||
|
@ -129,6 +129,6 @@ class Control {
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ui
|
} // namespace ui
|
||||||
} // namespace poly
|
} // namespace xe
|
||||||
|
|
||||||
#endif // POLY_UI_CONTROL_H_
|
#endif // XENIA_UI_CONTROL_H_
|
|
@ -7,12 +7,12 @@
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef POLY_UI_LOOP_H_
|
#ifndef XENIA_UI_LOOP_H_
|
||||||
#define POLY_UI_LOOP_H_
|
#define XENIA_UI_LOOP_H_
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
namespace poly {
|
namespace xe {
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
class Loop {
|
class Loop {
|
||||||
|
@ -27,6 +27,6 @@ class Loop {
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ui
|
} // namespace ui
|
||||||
} // namespace poly
|
} // namespace xe
|
||||||
|
|
||||||
#endif // POLY_UI_LOOP_H_
|
#endif // XENIA_UI_LOOP_H_
|
|
@ -46,7 +46,7 @@ bool MainWindow::Initialize() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Resize(1280, 720);
|
Resize(1280, 720);
|
||||||
on_key_down.AddListener([this](poly::ui::KeyEvent& e) {
|
on_key_down.AddListener([this](KeyEvent& e) {
|
||||||
bool handled = true;
|
bool handled = true;
|
||||||
switch (e.key_code()) {
|
switch (e.key_code()) {
|
||||||
case 0x73: { // VK_F4
|
case 0x73: { // VK_F4
|
||||||
|
|
|
@ -10,12 +10,12 @@
|
||||||
#ifndef XENIA_UI_MAIN_WINDOW_H_
|
#ifndef XENIA_UI_MAIN_WINDOW_H_
|
||||||
#define XENIA_UI_MAIN_WINDOW_H_
|
#define XENIA_UI_MAIN_WINDOW_H_
|
||||||
|
|
||||||
#include "poly/ui/window.h"
|
#include "xenia/ui/window.h"
|
||||||
#include "xenia/xbox.h"
|
#include "xenia/xbox.h"
|
||||||
|
|
||||||
// TODO(benvanik): only on windows.
|
// TODO(benvanik): only on windows.
|
||||||
#include "poly/ui/win32/win32_loop.h"
|
#include "xenia/ui/win32/win32_loop.h"
|
||||||
#include "poly/ui/win32/win32_window.h"
|
#include "xenia/ui/win32/win32_window.h"
|
||||||
|
|
||||||
namespace xe {
|
namespace xe {
|
||||||
class Emulator;
|
class Emulator;
|
||||||
|
@ -24,8 +24,8 @@ class Emulator;
|
||||||
namespace xe {
|
namespace xe {
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
using PlatformLoop = poly::ui::win32::Win32Loop;
|
using PlatformLoop = xe::ui::win32::Win32Loop;
|
||||||
using PlatformWindow = poly::ui::win32::Win32Window;
|
using PlatformWindow = xe::ui::win32::Win32Window;
|
||||||
|
|
||||||
class MainWindow : public PlatformWindow {
|
class MainWindow : public PlatformWindow {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -7,9 +7,9 @@
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "poly/ui/menu_item.h"
|
#include "xenia/ui/menu_item.h"
|
||||||
|
|
||||||
namespace poly {
|
namespace xe {
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
MenuItem::MenuItem(Type type) : type_(type), parent_item_(nullptr) {}
|
MenuItem::MenuItem(Type type) : type_(type), parent_item_(nullptr) {}
|
||||||
|
@ -41,9 +41,7 @@ void MenuItem::RemoveChild(MenuItem* child_item) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuItem::OnSelected(UIEvent& e) {
|
void MenuItem::OnSelected(UIEvent& e) { on_selected(e); }
|
||||||
on_selected(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ui
|
} // namespace ui
|
||||||
} // namespace poly
|
} // namespace xe
|
|
@ -7,16 +7,16 @@
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef POLY_UI_MENU_ITEM_H_
|
#ifndef XENIA_UI_MENU_ITEM_H_
|
||||||
#define POLY_UI_MENU_ITEM_H_
|
#define XENIA_UI_MENU_ITEM_H_
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "poly/delegate.h"
|
#include "poly/delegate.h"
|
||||||
#include "poly/ui/ui_event.h"
|
#include "xenia/ui/ui_event.h"
|
||||||
|
|
||||||
namespace poly {
|
namespace xe {
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
class Window;
|
class Window;
|
||||||
|
@ -56,6 +56,6 @@ class MenuItem {
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ui
|
} // namespace ui
|
||||||
} // namespace poly
|
} // namespace xe
|
||||||
|
|
||||||
#endif // POLY_UI_MENU_ITEM_H_
|
#endif // XENIA_UI_MENU_ITEM_H_
|
|
@ -1,7 +1,22 @@
|
||||||
# Copyright 2014 Ben Vanik. All Rights Reserved.
|
# Copyright 2014 Ben Vanik. All Rights Reserved.
|
||||||
{
|
{
|
||||||
'sources': [
|
'sources': [
|
||||||
|
'control.cc',
|
||||||
|
'control.h',
|
||||||
|
'loop.h',
|
||||||
'main_window.cc',
|
'main_window.cc',
|
||||||
'main_window.h',
|
'main_window.h',
|
||||||
|
'menu_item.cc',
|
||||||
|
'menu_item.h',
|
||||||
|
'ui_event.h',
|
||||||
|
'window.h',
|
||||||
|
],
|
||||||
|
|
||||||
|
'conditions': [
|
||||||
|
['OS == "win"', {
|
||||||
|
'includes': [
|
||||||
|
'win32/sources.gypi',
|
||||||
|
],
|
||||||
|
}],
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,10 +7,10 @@
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef POLY_UI_UI_EVENT_H_
|
#ifndef XENIA_UI_UI_EVENT_H_
|
||||||
#define POLY_UI_UI_EVENT_H_
|
#define XENIA_UI_UI_EVENT_H_
|
||||||
|
|
||||||
namespace poly {
|
namespace xe {
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
class Control;
|
class Control;
|
||||||
|
@ -84,6 +84,6 @@ class MouseEvent : public UIEvent {
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ui
|
} // namespace ui
|
||||||
} // namespace poly
|
} // namespace xe
|
||||||
|
|
||||||
#endif // POLY_UI_UI_EVENT_H_
|
#endif // XENIA_UI_UI_EVENT_H_
|
|
@ -7,9 +7,9 @@
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "poly/ui/win32/win32_control.h"
|
#include "xenia/ui/win32/win32_control.h"
|
||||||
|
|
||||||
namespace poly {
|
namespace xe {
|
||||||
namespace ui {
|
namespace ui {
|
||||||
namespace win32 {
|
namespace win32 {
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ LRESULT CALLBACK Win32Control::WndProcThunk(HWND hWnd, UINT message,
|
||||||
if (message == WM_NCCREATE) {
|
if (message == WM_NCCREATE) {
|
||||||
auto create_struct = reinterpret_cast<LPCREATESTRUCT>(lParam);
|
auto create_struct = reinterpret_cast<LPCREATESTRUCT>(lParam);
|
||||||
control = reinterpret_cast<Win32Control*>(create_struct->lpCreateParams);
|
control = reinterpret_cast<Win32Control*>(create_struct->lpCreateParams);
|
||||||
SetWindowLongPtr(hWnd, GWLP_USERDATA, (__int3264)(LONG_PTR)control);
|
SetWindowLongPtr(hWnd, GWLP_USERDATA, (__int3264)(LONG_PTR) control);
|
||||||
} else {
|
} else {
|
||||||
control =
|
control =
|
||||||
reinterpret_cast<Win32Control*>(GetWindowLongPtr(hWnd, GWLP_USERDATA));
|
reinterpret_cast<Win32Control*>(GetWindowLongPtr(hWnd, GWLP_USERDATA));
|
||||||
|
@ -365,4 +365,4 @@ bool Win32Control::HandleKeyboard(UINT message, WPARAM wParam, LPARAM lParam) {
|
||||||
|
|
||||||
} // namespace win32
|
} // namespace win32
|
||||||
} // namespace ui
|
} // namespace ui
|
||||||
} // namespace poly
|
} // namespace xe
|
|
@ -7,15 +7,15 @@
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef POLY_UI_WIN32_WIN32_CONTROL_H_
|
#ifndef XENIA_UI_WIN32_WIN32_CONTROL_H_
|
||||||
#define POLY_UI_WIN32_WIN32_CONTROL_H_
|
#define XENIA_UI_WIN32_WIN32_CONTROL_H_
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <windowsx.h>
|
#include <windowsx.h>
|
||||||
|
|
||||||
#include "poly/ui/control.h"
|
#include "xenia/ui/control.h"
|
||||||
|
|
||||||
namespace poly {
|
namespace xe {
|
||||||
namespace ui {
|
namespace ui {
|
||||||
namespace win32 {
|
namespace win32 {
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ class Win32Control : public Control {
|
||||||
void OnResize(UIEvent& e) override;
|
void OnResize(UIEvent& e) override;
|
||||||
|
|
||||||
static LRESULT CALLBACK
|
static LRESULT CALLBACK
|
||||||
WndProcThunk(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
WndProcThunk(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
||||||
virtual LRESULT WndProc(HWND hWnd, UINT message, WPARAM wParam,
|
virtual LRESULT WndProc(HWND hWnd, UINT message, WPARAM wParam,
|
||||||
LPARAM lParam);
|
LPARAM lParam);
|
||||||
|
|
||||||
|
@ -65,6 +65,6 @@ class Win32Control : public Control {
|
||||||
|
|
||||||
} // namespace win32
|
} // namespace win32
|
||||||
} // namespace ui
|
} // namespace ui
|
||||||
} // namespace poly
|
} // namespace xe
|
||||||
|
|
||||||
#endif // POLY_UI_WIN32_WIN32_CONTROL_H_
|
#endif // XENIA_UI_WIN32_WIN32_CONTROL_H_
|
|
@ -7,11 +7,11 @@
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "poly/ui/win32/win32_loop.h"
|
#include "xenia/ui/win32/win32_loop.h"
|
||||||
|
|
||||||
#include "poly/assert.h"
|
#include "poly/assert.h"
|
||||||
|
|
||||||
namespace poly {
|
namespace xe {
|
||||||
namespace ui {
|
namespace ui {
|
||||||
namespace win32 {
|
namespace win32 {
|
||||||
|
|
||||||
|
@ -89,4 +89,4 @@ void Win32Loop::AwaitQuit() { quit_fence_.Wait(); }
|
||||||
|
|
||||||
} // namespace win32
|
} // namespace win32
|
||||||
} // namespace ui
|
} // namespace ui
|
||||||
} // namespace poly
|
} // namespace xe
|
|
@ -7,8 +7,8 @@
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef POLY_UI_WIN32_WIN32_LOOP_H_
|
#ifndef XENIA_UI_WIN32_WIN32_LOOP_H_
|
||||||
#define POLY_UI_WIN32_WIN32_LOOP_H_
|
#define XENIA_UI_WIN32_WIN32_LOOP_H_
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <windowsx.h>
|
#include <windowsx.h>
|
||||||
|
@ -19,9 +19,9 @@
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
#include "poly/threading.h"
|
#include "poly/threading.h"
|
||||||
#include "poly/ui/loop.h"
|
#include "xenia/ui/loop.h"
|
||||||
|
|
||||||
namespace poly {
|
namespace xe {
|
||||||
namespace ui {
|
namespace ui {
|
||||||
namespace win32 {
|
namespace win32 {
|
||||||
|
|
||||||
|
@ -45,6 +45,6 @@ class Win32Loop : public Loop {
|
||||||
|
|
||||||
} // namespace win32
|
} // namespace win32
|
||||||
} // namespace ui
|
} // namespace ui
|
||||||
} // namespace poly
|
} // namespace xe
|
||||||
|
|
||||||
#endif // POLY_UI_WIN32_WIN32_LOOP_H_
|
#endif // XENIA_UI_WIN32_WIN32_LOOP_H_
|
|
@ -7,9 +7,9 @@
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "poly/ui/win32/win32_menu_item.h"
|
#include "xenia/ui/win32/win32_menu_item.h"
|
||||||
|
|
||||||
namespace poly {
|
namespace xe {
|
||||||
namespace ui {
|
namespace ui {
|
||||||
namespace win32 {
|
namespace win32 {
|
||||||
|
|
||||||
|
@ -34,4 +34,4 @@ void Win32MenuItem::OnChildRemoved(MenuItem* generic_child_item) {
|
||||||
|
|
||||||
} // namespace win32
|
} // namespace win32
|
||||||
} // namespace ui
|
} // namespace ui
|
||||||
} // namespace poly
|
} // namespace xe
|
|
@ -7,15 +7,15 @@
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef POLY_UI_WIN32_WIN32_MENU_ITEM_H_
|
#ifndef XENIA_UI_WIN32_WIN32_MENU_ITEM_H_
|
||||||
#define POLY_UI_WIN32_WIN32_MENU_ITEM_H_
|
#define XENIA_UI_WIN32_WIN32_MENU_ITEM_H_
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <windowsx.h>
|
#include <windowsx.h>
|
||||||
|
|
||||||
#include "poly/ui/menu_item.h"
|
#include "xenia/ui/menu_item.h"
|
||||||
|
|
||||||
namespace poly {
|
namespace xe {
|
||||||
namespace ui {
|
namespace ui {
|
||||||
namespace win32 {
|
namespace win32 {
|
||||||
|
|
||||||
|
@ -35,6 +35,6 @@ class Win32MenuItem : public MenuItem {
|
||||||
|
|
||||||
} // namespace win32
|
} // namespace win32
|
||||||
} // namespace ui
|
} // namespace ui
|
||||||
} // namespace poly
|
} // namespace xe
|
||||||
|
|
||||||
#endif // POLY_UI_WIN32_WIN32_MENU_ITEM_H_
|
#endif // XENIA_UI_WIN32_WIN32_MENU_ITEM_H_
|
|
@ -7,7 +7,7 @@
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "poly/ui/win32/win32_window.h"
|
#include "xenia/ui/win32/win32_window.h"
|
||||||
|
|
||||||
#include <dwmapi.h>
|
#include <dwmapi.h>
|
||||||
#include <tpcshrd.h>
|
#include <tpcshrd.h>
|
||||||
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
#include "poly/logging.h"
|
#include "poly/logging.h"
|
||||||
|
|
||||||
namespace poly {
|
namespace xe {
|
||||||
namespace ui {
|
namespace ui {
|
||||||
namespace win32 {
|
namespace win32 {
|
||||||
|
|
||||||
|
@ -58,9 +58,8 @@ bool Win32Window::Create() {
|
||||||
|
|
||||||
// Create window.
|
// Create window.
|
||||||
hwnd_ = CreateWindowEx(window_ex_style, L"XeniaWindowClass", L"Xenia",
|
hwnd_ = CreateWindowEx(window_ex_style, L"XeniaWindowClass", L"Xenia",
|
||||||
window_style, rc.left, rc.top,
|
window_style, rc.left, rc.top, rc.right - rc.left,
|
||||||
rc.right - rc.left, rc.bottom - rc.top, nullptr,
|
rc.bottom - rc.top, nullptr, nullptr, hInstance, this);
|
||||||
nullptr, hInstance, this);
|
|
||||||
if (!hwnd_) {
|
if (!hwnd_) {
|
||||||
PLOGE("CreateWindow failed");
|
PLOGE("CreateWindow failed");
|
||||||
return false;
|
return false;
|
||||||
|
@ -210,4 +209,4 @@ LRESULT Win32Window::WndProc(HWND hWnd, UINT message, WPARAM wParam,
|
||||||
|
|
||||||
} // namespace win32
|
} // namespace win32
|
||||||
} // namespace ui
|
} // namespace ui
|
||||||
} // namespace poly
|
} // namespace xe
|
|
@ -7,15 +7,15 @@
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef POLY_UI_WIN32_WIN32_WINDOW_H_
|
#ifndef XENIA_UI_WIN32_WIN32_WINDOW_H_
|
||||||
#define POLY_UI_WIN32_WIN32_WINDOW_H_
|
#define XENIA_UI_WIN32_WIN32_WINDOW_H_
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "poly/ui/win32/win32_control.h"
|
#include "xenia/ui/win32/win32_control.h"
|
||||||
#include "poly/ui/window.h"
|
#include "xenia/ui/window.h"
|
||||||
|
|
||||||
namespace poly {
|
namespace xe {
|
||||||
namespace ui {
|
namespace ui {
|
||||||
namespace win32 {
|
namespace win32 {
|
||||||
|
|
||||||
|
@ -50,6 +50,6 @@ class Win32Window : public Window<Win32Control> {
|
||||||
|
|
||||||
} // namespace win32
|
} // namespace win32
|
||||||
} // namespace ui
|
} // namespace ui
|
||||||
} // namespace poly
|
} // namespace xe
|
||||||
|
|
||||||
#endif // POLY_UI_WIN32_WIN32_WINDOW_H_
|
#endif // XENIA_UI_WIN32_WIN32_WINDOW_H_
|
|
@ -7,16 +7,16 @@
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef POLY_UI_WINDOW_H_
|
#ifndef XENIA_UI_WINDOW_H_
|
||||||
#define POLY_UI_WINDOW_H_
|
#define XENIA_UI_WINDOW_H_
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "poly/delegate.h"
|
#include "poly/delegate.h"
|
||||||
#include "poly/ui/control.h"
|
#include "xenia/ui/control.h"
|
||||||
#include "poly/ui/ui_event.h"
|
#include "xenia/ui/ui_event.h"
|
||||||
|
|
||||||
namespace poly {
|
namespace xe {
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
@ -79,6 +79,6 @@ class Window : public T {
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ui
|
} // namespace ui
|
||||||
} // namespace poly
|
} // namespace xe
|
||||||
|
|
||||||
#endif // POLY_UI_WINDOW_H_
|
#endif // XENIA_UI_WINDOW_H_
|
Loading…
Reference in New Issue