mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-09-02 21:13:13 +02:00
Update to v094r28 release.
byuu says: This WIP substantially restructures the ruby API for the first time since that project started. It is my hope that with this restructuring, destruction of the ruby objects should now be deterministic, which should fix the crashing on closing the emulator on Linux. We'll see I guess ... either way, it removed two layers of wrappers from ruby, so it's a pretty nice code cleanup. It won't compile on Windows due to a few issues I didn't see until uploading the WIP, too lazy to upload another. But I fixed all the compilation issues locally, so it'll work on Windows again with the next WIP (unless I break something else.) (Kind of annoying that Linux defines glActiveTexture but Windows doesn't.)
This commit is contained in:
@@ -406,6 +406,8 @@ struct mObject {
|
||||
mObject(const mObject&) = delete;
|
||||
mObject& operator=(const mObject&) = delete;
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
auto abstract() const -> bool;
|
||||
auto adjustOffset(signed displacement) -> type&;
|
||||
auto enabled(bool recursive = false) const -> bool;
|
||||
|
@@ -26,6 +26,11 @@ auto mObject::destruct() -> void {
|
||||
|
||||
//
|
||||
|
||||
//used to test if returned items "exist" from eg Window::layout(), ListView::selected(), etc.
|
||||
mObject::operator bool() const {
|
||||
return parent() || !abstract();
|
||||
}
|
||||
|
||||
//this is used to control dynamic allocation of pObject delegates
|
||||
//an mObject is abstract only if it has no top-level object (eg a Button not attached to any Window)
|
||||
//if the mObject is not abstract, the pObject delegate is allocated immediately
|
||||
|
@@ -6,15 +6,14 @@
|
||||
}) { \
|
||||
(*this)->bind(*this); \
|
||||
} \
|
||||
Name(std::nullptr_t) {} \
|
||||
Name(const s##Name& source) : s##Name(source) {} \
|
||||
explicit operator bool() const { return !empty(); } \
|
||||
Name(const s##Name& source) : s##Name(source) { assert(source); } \
|
||||
explicit operator bool() const { return self().operator bool(); } \
|
||||
auto self() const -> m##Name& { return (m##Name&)operator*(); } \
|
||||
|
||||
#define DeclareSharedObject(Name) \
|
||||
DeclareShared(Name) \
|
||||
template<typename T, typename... P> Name(T* parent, P&&... p) : Name() { \
|
||||
if(parent && *parent) (*parent)->append(*this, std::forward<P>(p)...); \
|
||||
if(parent) (*parent)->append(*this, std::forward<P>(p)...); \
|
||||
} \
|
||||
auto enabled(bool recursive = false) const { return self().enabled(recursive); } \
|
||||
auto focused() const { return self().focused(); } \
|
||||
|
@@ -57,7 +57,7 @@ auto mComboButton::selected() const -> ComboButtonItem {
|
||||
for(auto& item : state.items) {
|
||||
if(item->selected()) return item;
|
||||
}
|
||||
return {nullptr};
|
||||
return {};
|
||||
}
|
||||
|
||||
auto mComboButton::setParent(mObject* parent, signed offset) -> type& {
|
||||
|
@@ -182,7 +182,7 @@ auto mListView::selected() const -> ListViewItem {
|
||||
for(auto& item : state.items) {
|
||||
if(item->selected()) return item;
|
||||
}
|
||||
return {nullptr};
|
||||
return {};
|
||||
}
|
||||
|
||||
auto mListView::selectedItems() const -> vector<ListViewItem> {
|
||||
|
@@ -78,7 +78,7 @@ auto mTabFrame::selected() const -> TabFrameItem {
|
||||
for(auto& item : state.items) {
|
||||
if(item->selected()) return item;
|
||||
}
|
||||
return {nullptr};
|
||||
return {};
|
||||
}
|
||||
|
||||
auto mTabFrame::setEdge(Edge edge) -> type& {
|
||||
|
Reference in New Issue
Block a user