Massive refactoring of xenia::ui and GL swap behavior.

This seems to dramatically improve most games (especially with
--vsync=false), though it may cause swap issues with others.
New code should be easier to port, and enables elemental-forms to be
drawn for any emulator UI.
This commit is contained in:
Ben Vanik
2015-07-12 22:03:47 -07:00
parent e69c7b00a8
commit 15c17459be
61 changed files with 1994 additions and 2623 deletions

View File

@@ -10,10 +10,10 @@
#ifndef XENIA_UI_MENU_ITEM_H_
#define XENIA_UI_MENU_ITEM_H_
#include <functional>
#include <memory>
#include <vector>
#include "xenia/base/delegate.h"
#include "xenia/ui/ui_event.h"
namespace xe {
@@ -30,6 +30,14 @@ class MenuItem {
kString, // Menu is just a string
};
static std::unique_ptr<MenuItem> Create(Type type);
static std::unique_ptr<MenuItem> Create(Type type, const std::wstring& text);
static std::unique_ptr<MenuItem> Create(Type type, const std::wstring& text,
std::function<void()> callback);
static std::unique_ptr<MenuItem> Create(Type type, const std::wstring& text,
const std::wstring& hotkey,
std::function<void()> callback);
virtual ~MenuItem();
MenuItem* parent_item() const { return parent_item_; }
@@ -41,12 +49,11 @@ class MenuItem {
void AddChild(std::unique_ptr<MenuItem> child_item);
void AddChild(MenuItemPtr child_item);
void RemoveChild(MenuItem* child_item);
Delegate<UIEvent> on_selected;
MenuItem* child(size_t index);
protected:
MenuItem(Type type);
MenuItem(Type type, const std::wstring& text, const std::wstring& hotkey);
MenuItem(Type type, const std::wstring& text, const std::wstring& hotkey,
std::function<void()> callback);
virtual void OnChildAdded(MenuItem* child_item) {}
virtual void OnChildRemoved(MenuItem* child_item) {}
@@ -58,6 +65,7 @@ class MenuItem {
std::vector<MenuItemPtr> children_;
std::wstring text_;
std::wstring hotkey_;
std::function<void()> callback_;
};
} // namespace ui