mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
Optimize parameter passing to avoid unnecessary copying
This commit is contained in:
parent
46ca1bb04a
commit
f25a425cb9
123 changed files with 578 additions and 522 deletions
|
|
@ -1,12 +1,14 @@
|
|||
#include "Button.hpp"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "Label.hpp"
|
||||
#include "../../core/DrawContext.hpp"
|
||||
#include "../../core/Batch2D.hpp"
|
||||
|
||||
using namespace gui;
|
||||
|
||||
Button::Button(std::shared_ptr<UINode> content, glm::vec4 padding)
|
||||
Button::Button(const std::shared_ptr<UINode>& content, glm::vec4 padding)
|
||||
: Panel(glm::vec2(), padding, 0) {
|
||||
glm::vec4 margin = getMargin();
|
||||
setSize(content->getSize()+
|
||||
|
|
@ -20,9 +22,9 @@ Button::Button(std::shared_ptr<UINode> content, glm::vec4 padding)
|
|||
}
|
||||
|
||||
Button::Button(
|
||||
std::wstring text,
|
||||
const std::wstring& text,
|
||||
glm::vec4 padding,
|
||||
onaction action,
|
||||
const onaction& action,
|
||||
glm::vec2 size
|
||||
) : Panel(size, padding, 0)
|
||||
{
|
||||
|
|
@ -63,7 +65,7 @@ std::wstring Button::getText() const {
|
|||
|
||||
Button* Button::textSupplier(wstringsupplier supplier) {
|
||||
if (label) {
|
||||
label->textSupplier(supplier);
|
||||
label->textSupplier(std::move(supplier));
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue