diff --git a/SConstruct b/SConstruct index 7299511..3934907 100644 --- a/SConstruct +++ b/SConstruct @@ -116,6 +116,12 @@ opts.Add(EnumVariable( "armv7", ["armv7","arm64v8","x86","x86_64"] )) +opts.Add(EnumVariable( + "arch", + "Target MacOS architecture", + "arm64", + ["arm64", "x86_64"] +)) opts.Add(EnumVariable( "ios_arch", "Target iOS architecture", @@ -231,7 +237,7 @@ elif env["platform"] == "macos": if env["target"] == "debug": env.Append(CCFLAGS=["-Og", "-g"]) elif env["target"] == "release": - env.Append(CCFLAGS=["-Ofast"]) + env.Append(CCFLAGS=["-Ofast", "-Os"]) target_path = "libgdflexbox.dylib" diff --git a/src/flexbox.cpp b/src/flexbox.cpp index 7c88b31..67e5b8c 100644 --- a/src/flexbox.cpp +++ b/src/flexbox.cpp @@ -403,6 +403,16 @@ void Flexbox::remove_child(Flexbox *child) YGNodeRemoveChild(m_node, child->m_node); } +void Flexbox::remove_all_children(void) +{ + YGNodeRemoveAllChildren(m_node); +} + +void Flexbox::swap_child(Flexbox *child, unsigned index) +{ + YGNodeSwapChild(m_node, child->m_node, index); +} + unsigned Flexbox::get_child_count(void) const { return YGNodeGetChildCount(m_node); @@ -658,6 +668,8 @@ void Flexbox::_bind_methods() ClassDB::bind_method(D_METHOD("insert_child"), &Flexbox::insert_child); ClassDB::bind_method(D_METHOD("remove_child"), &Flexbox::remove_child); + ClassDB::bind_method(D_METHOD("remove_all_children"), &Flexbox::remove_all_children); + ClassDB::bind_method(D_METHOD("swap_child"), &Flexbox::swap_child); ClassDB::bind_method(D_METHOD("get_child_count"), &Flexbox::get_child_count); ClassDB::bind_method(D_METHOD("get_child"), &Flexbox::get_child); diff --git a/src/flexbox.h b/src/flexbox.h index 95e16f9..427c1af 100644 --- a/src/flexbox.h +++ b/src/flexbox.h @@ -115,6 +115,8 @@ class Flexbox : public RefCounted public: // Tree hierarchy mutators void insert_child(Flexbox *child, unsigned index); void remove_child(Flexbox *child); + void remove_all_children(void); + void swap_child(Flexbox *child, unsigned index); public: // Tree hierarchy inspectors unsigned get_child_count(void) const;