Merge remote-tracking branch 'refs/remotes/origin/master' into console-widget
This commit is contained in:
@@ -10,8 +10,8 @@ namespace Ndk
|
||||
{
|
||||
inline BaseWidget::BaseWidget() :
|
||||
m_canvasIndex(InvalidCanvasIndex),
|
||||
m_backgroundColor(Nz::Color(230, 230, 230, 255)),
|
||||
m_canvas(nullptr),
|
||||
m_backgroundColor(Nz::Color(230, 230, 230, 255)),
|
||||
m_cursor(Nz::SystemCursor_Default),
|
||||
m_contentSize(50.f, 50.f),
|
||||
m_widgetParent(nullptr),
|
||||
@@ -33,6 +33,7 @@ namespace Ndk
|
||||
inline void BaseWidget::AddChild(std::unique_ptr<BaseWidget>&& widget)
|
||||
{
|
||||
widget->Show(m_visible);
|
||||
widget->SetParent(this);
|
||||
m_children.emplace_back(std::move(widget));
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ namespace Ndk
|
||||
inline CameraComponent::CameraComponent(const CameraComponent& camera) :
|
||||
Component(camera),
|
||||
AbstractViewer(camera),
|
||||
HandledObject(camera),
|
||||
m_visibilityHash(camera.m_visibilityHash),
|
||||
m_projectionType(camera.m_projectionType),
|
||||
m_targetRegion(camera.m_targetRegion),
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Ndk
|
||||
|
||||
//virtual ButtonWidget* Clone() const = 0;
|
||||
|
||||
void ResizeToContent();
|
||||
void ResizeToContent() override;
|
||||
|
||||
inline void UpdateText(const Nz::AbstractTextDrawer& drawer);
|
||||
|
||||
@@ -40,7 +40,6 @@ namespace Ndk
|
||||
void Layout() override;
|
||||
|
||||
void OnMouseEnter() override;
|
||||
void OnMouseMoved(int x, int y, int deltaX, int deltaY) override;
|
||||
void OnMouseButtonRelease(int x, int y, Nz::Mouse::Button button) override;
|
||||
void OnMouseExit() override;
|
||||
|
||||
|
||||
@@ -158,11 +158,16 @@ namespace Ndk
|
||||
}
|
||||
m_systemBits.Clear();
|
||||
|
||||
UnregisterAllHandles();
|
||||
// We properly destroy each component
|
||||
for (std::size_t i = m_componentBits.FindFirst(); i != m_componentBits.npos; i = m_componentBits.FindNext(i))
|
||||
m_components[i]->SetEntity(nullptr);
|
||||
|
||||
m_components.clear();
|
||||
m_componentBits.Reset();
|
||||
|
||||
// And then free every handle
|
||||
UnregisterAllHandles();
|
||||
|
||||
m_valid = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -85,23 +85,23 @@ namespace Ndk
|
||||
|
||||
entity.BindMethod("AddComponent", [this] (Nz::LuaInstance& instance, EntityHandle& handle, std::size_t /*argumentCount*/) -> int
|
||||
{
|
||||
LuaBinding::ComponentBinding* binding = m_binding.QueryComponentIndex(instance);
|
||||
LuaBinding::ComponentBinding* bindingComponent = m_binding.QueryComponentIndex(instance);
|
||||
|
||||
return binding->adder(instance, handle);
|
||||
return bindingComponent->adder(instance, handle);
|
||||
});
|
||||
|
||||
entity.BindMethod("GetComponent", [this] (Nz::LuaInstance& instance, EntityHandle& handle, std::size_t /*argumentCount*/) -> int
|
||||
{
|
||||
LuaBinding::ComponentBinding* binding = m_binding.QueryComponentIndex(instance);
|
||||
LuaBinding::ComponentBinding* bindingComponent = m_binding.QueryComponentIndex(instance);
|
||||
|
||||
return binding->getter(instance, handle->GetComponent(binding->index));
|
||||
return bindingComponent->getter(instance, handle->GetComponent(bindingComponent->index));
|
||||
});
|
||||
|
||||
entity.BindMethod("RemoveComponent", [this] (Nz::LuaInstance& instance, EntityHandle& handle, std::size_t /*argumentCount*/) -> int
|
||||
{
|
||||
LuaBinding::ComponentBinding* binding = m_binding.QueryComponentIndex(instance);
|
||||
LuaBinding::ComponentBinding* bindingComponent = m_binding.QueryComponentIndex(instance);
|
||||
|
||||
handle->RemoveComponent(binding->index);
|
||||
handle->RemoveComponent(bindingComponent->index);
|
||||
return 0;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -61,10 +61,7 @@ namespace Ndk
|
||||
m_gradientSprite->SetColor(Nz::Color(128, 128, 128));
|
||||
}
|
||||
|
||||
void ButtonWidget::OnMouseMoved(int x, int y, int deltaX, int deltaY)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void ButtonWidget::OnMouseExit()
|
||||
{
|
||||
m_gradientSprite->SetColor(Nz::Color(74, 74, 74));
|
||||
|
||||
Reference in New Issue
Block a user