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:
@@ -12,11 +12,27 @@
|
||||
namespace xe {
|
||||
namespace ui {
|
||||
|
||||
MenuItem::MenuItem(Type type) : type_(type), parent_item_(nullptr) {}
|
||||
std::unique_ptr<MenuItem> MenuItem::Create(Type type) {
|
||||
return MenuItem::Create(type, L"", L"", nullptr);
|
||||
}
|
||||
|
||||
std::unique_ptr<MenuItem> MenuItem::Create(Type type,
|
||||
const std::wstring& text) {
|
||||
return MenuItem::Create(type, text, L"", nullptr);
|
||||
}
|
||||
|
||||
std::unique_ptr<MenuItem> MenuItem::Create(Type type, const std::wstring& text,
|
||||
std::function<void()> callback) {
|
||||
return MenuItem::Create(type, text, L"", std::move(callback));
|
||||
}
|
||||
|
||||
MenuItem::MenuItem(Type type, const std::wstring& text,
|
||||
const std::wstring& hotkey)
|
||||
: type_(type), parent_item_(nullptr), text_(text), hotkey_(hotkey) {}
|
||||
const std::wstring& hotkey, std::function<void()> callback)
|
||||
: type_(type),
|
||||
parent_item_(nullptr),
|
||||
text_(text),
|
||||
hotkey_(hotkey),
|
||||
callback_(std::move(callback)) {}
|
||||
|
||||
MenuItem::~MenuItem() = default;
|
||||
|
||||
@@ -45,7 +61,13 @@ void MenuItem::RemoveChild(MenuItem* child_item) {
|
||||
}
|
||||
}
|
||||
|
||||
void MenuItem::OnSelected(UIEvent& e) { on_selected(e); }
|
||||
MenuItem* MenuItem::child(size_t index) { return children_[index].get(); }
|
||||
|
||||
void MenuItem::OnSelected(UIEvent& e) {
|
||||
if (callback_) {
|
||||
callback_();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
} // namespace xe
|
||||
|
||||
Reference in New Issue
Block a user