diff --git a/core/Common/Scene.cpp b/core/Common/Scene.cpp index 98d55127..de3f3e3c 100644 --- a/core/Common/Scene.cpp +++ b/core/Common/Scene.cpp @@ -74,7 +74,7 @@ e2d::Node * e2d::Scene::getOne(const String& name) const return _root->getChild(name); } -std::vector e2d::Scene::getAll() const +const std::vector& e2d::Scene::getAll() const { return _root->getAllChildren(); } diff --git a/core/Manager/ActionManager.cpp b/core/Manager/ActionManager.cpp index 122ee842..2abbea6d 100644 --- a/core/Manager/ActionManager.cpp +++ b/core/Manager/ActionManager.cpp @@ -224,7 +224,7 @@ std::vector e2d::ActionManager::get(const String& strActionName) return std::move(actions); } -std::vector e2d::ActionManager::getAll() +const std::vector& e2d::ActionManager::getAll() { return s_vActions; } diff --git a/core/Node/Menu.cpp b/core/Node/Menu.cpp index 1bfebb63..1487c0c7 100644 --- a/core/Node/Menu.cpp +++ b/core/Node/Menu.cpp @@ -89,3 +89,8 @@ bool e2d::Menu::removeButton(Button * button) } return false; } + +const std::vector& e2d::Menu::getAllButtons() const +{ + return _buttons; +} diff --git a/core/Node/Node.cpp b/core/Node/Node.cpp index 79834302..c27d5a9e 100644 --- a/core/Node/Node.cpp +++ b/core/Node/Node.cpp @@ -713,7 +713,7 @@ e2d::Node * e2d::Node::getChild(const String& name) const return nullptr; } -std::vector e2d::Node::getAllChildren() const +const std::vector& e2d::Node::getAllChildren() const { return _children; } diff --git a/core/Node/Text.cpp b/core/Node/Text.cpp index 26c2784c..b8e4d18f 100644 --- a/core/Node/Text.cpp +++ b/core/Node/Text.cpp @@ -165,7 +165,7 @@ void e2d::Text::setText(const String& text) _reset(); } -void e2d::Text::setTextStyle(TextStyle textStyle) +void e2d::Text::setStyle(const TextStyle& textStyle) { _style = textStyle; _reset(); @@ -209,11 +209,11 @@ void e2d::Text::setWrapping(bool wrapping) } } -void e2d::Text::setWrappingWidth(double fWrappingWidth) +void e2d::Text::setWrappingWidth(double wrappingWidth) { - if (_style.wrappingWidth != fWrappingWidth) + if (_style.wrappingWidth != wrappingWidth) { - _style.wrappingWidth = max(fWrappingWidth, 0); + _style.wrappingWidth = max(wrappingWidth, 0); if (_style.wrapping) { @@ -222,11 +222,11 @@ void e2d::Text::setWrappingWidth(double fWrappingWidth) } } -void e2d::Text::setLineSpacing(double fLineSpacing) +void e2d::Text::setLineSpacing(double lineSpacing) { - if (_style.lineSpacing != fLineSpacing) + if (_style.lineSpacing != lineSpacing) { - _style.lineSpacing = fLineSpacing; + _style.lineSpacing = lineSpacing; _reset(); } } diff --git a/core/e2dcommon.h b/core/e2dcommon.h index e89e4aef..9643e600 100644 --- a/core/e2dcommon.h +++ b/core/e2dcommon.h @@ -872,7 +872,7 @@ public: ) const; // 获取所有子节点 - std::vector getAll() const; + const std::vector& getAll() const; // 获取根节点 Node * getRoot() const; diff --git a/core/e2dmanager.h b/core/e2dmanager.h index 911829c0..679e8c7b 100644 --- a/core/e2dmanager.h +++ b/core/e2dmanager.h @@ -130,7 +130,7 @@ public: ); // 获取所有动作 - static std::vector getAll(); + static const std::vector& getAll(); private: // 更新动作状态 diff --git a/core/e2dnode.h b/core/e2dnode.h index 4088ad85..9d6cc2d9 100644 --- a/core/e2dnode.h +++ b/core/e2dnode.h @@ -133,7 +133,7 @@ public: ) const; // 获取所有子节点 - virtual std::vector getAllChildren() const; + virtual const std::vector& getAllChildren() const; // 获取子节点数量 virtual int getChildrenCount() const; @@ -649,8 +649,8 @@ public: ); // 设置文本样式 - void setTextStyle( - TextStyle pTextStyle + void setStyle( + const TextStyle& textStyle ); // 设置字体 @@ -685,12 +685,12 @@ public: // 设置文本自动换行的宽度(默认为 0) void setWrappingWidth( - double fWrappingWidth + double wrappingWidth ); // 设置行间距(默认为 0) void setLineSpacing( - double fLineSpacing + double lineSpacing ); // 设置对齐方式(默认为 TextAlign::LEFT) @@ -1000,6 +1000,9 @@ public: Button * button ); + // 获取所有按钮 + const std::vector& getAllButtons() const; + protected: bool _enable; std::vector _buttons;