Minor fixes
This commit is contained in:
parent
0c3bcf6c86
commit
01cd4986cc
|
|
@ -61,7 +61,7 @@
|
||||||
// Number of spinlocks to use with the Windows critical sections (0 to disable)
|
// Number of spinlocks to use with the Windows critical sections (0 to disable)
|
||||||
#define NAZARA_CORE_WINDOWS_CS_SPINLOCKS 4096
|
#define NAZARA_CORE_WINDOWS_CS_SPINLOCKS 4096
|
||||||
|
|
||||||
// Optimize the Windows implementation with technologies of Windows NT 6.0 (and greater) (Break the compatibility with Windows XP)
|
// Optimize the Windows implementation with technologies of Windows NT 6.0 (and greater) (Breaks the compatibility with Windows XP)
|
||||||
#define NAZARA_CORE_WINDOWS_NT6 1
|
#define NAZARA_CORE_WINDOWS_NT6 1
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,15 @@ namespace Nz
|
||||||
inline void Model::SetMaterial(std::size_t subMeshIndex, std::shared_ptr<Material> material)
|
inline void Model::SetMaterial(std::size_t subMeshIndex, std::shared_ptr<Material> material)
|
||||||
{
|
{
|
||||||
assert(subMeshIndex < m_submeshes.size());
|
assert(subMeshIndex < m_submeshes.size());
|
||||||
|
assert(material);
|
||||||
|
|
||||||
OnMaterialInvalidated(this, subMeshIndex, material);
|
if (m_submeshes[subMeshIndex].material != material)
|
||||||
m_submeshes[subMeshIndex].material = std::move(material);
|
{
|
||||||
|
OnMaterialInvalidated(this, 0, material);
|
||||||
|
m_submeshes[subMeshIndex].material = std::move(material);
|
||||||
|
|
||||||
|
OnElementInvalidated(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,8 @@ namespace Nz
|
||||||
|
|
||||||
inline const Color& GetColor() const;
|
inline const Color& GetColor() const;
|
||||||
inline const Color& GetCornerColor(RectCorner corner) const;
|
inline const Color& GetCornerColor(RectCorner corner) const;
|
||||||
const std::shared_ptr<Material>& GetMaterial(std::size_t i = 0) const;
|
const std::shared_ptr<Material>& GetMaterial(std::size_t i = 0) const override;
|
||||||
std::size_t GetMaterialCount() const;
|
std::size_t GetMaterialCount() const override;
|
||||||
inline const Rectf& GetTextureCoords() const;
|
inline const Rectf& GetTextureCoords() const;
|
||||||
Vector3ui GetTextureSize() const;
|
Vector3ui GetTextureSize() const;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,13 @@ namespace Nz
|
||||||
{
|
{
|
||||||
assert(material);
|
assert(material);
|
||||||
|
|
||||||
m_material = std::move(material);
|
if (m_material != material)
|
||||||
|
{
|
||||||
|
OnMaterialInvalidated(this, 0, material);
|
||||||
|
m_material = std::move(material);
|
||||||
|
|
||||||
|
OnElementInvalidated(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Sprite::SetSize(const Vector2f& size)
|
inline void Sprite::SetSize(const Vector2f& size)
|
||||||
|
|
@ -68,7 +74,7 @@ namespace Nz
|
||||||
{
|
{
|
||||||
VertexStruct_XYZ_Color_UV* vertices = m_vertices.data();
|
VertexStruct_XYZ_Color_UV* vertices = m_vertices.data();
|
||||||
|
|
||||||
Vector3f origin = Vector3f::Zero();
|
Vector3f origin = Vector3f::Zero(); //< TODO
|
||||||
Boxf aabb;
|
Boxf aabb;
|
||||||
|
|
||||||
vertices->color = m_color * m_cornerColor[UnderlyingCast(RectCorner::LeftBottom)];
|
vertices->color = m_color * m_cornerColor[UnderlyingCast(RectCorner::LeftBottom)];
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,8 @@ namespace Nz
|
||||||
|
|
||||||
inline void Clear();
|
inline void Clear();
|
||||||
|
|
||||||
const std::shared_ptr<Material>& GetMaterial(std::size_t i) const;
|
const std::shared_ptr<Material>& GetMaterial(std::size_t i = 0) const override;
|
||||||
std::size_t GetMaterialCount() const;
|
std::size_t GetMaterialCount() const override;
|
||||||
|
|
||||||
inline void SetMaterial(std::shared_ptr<Material> material);
|
inline void SetMaterial(std::shared_ptr<Material> material);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,15 @@ namespace Nz
|
||||||
|
|
||||||
inline void TextSprite::SetMaterial(std::shared_ptr<Material> material)
|
inline void TextSprite::SetMaterial(std::shared_ptr<Material> material)
|
||||||
{
|
{
|
||||||
m_material = std::move(material);
|
assert(material);
|
||||||
|
|
||||||
|
if (m_material != material)
|
||||||
|
{
|
||||||
|
OnMaterialInvalidated(this, 0, material);
|
||||||
|
m_material = std::move(material);
|
||||||
|
|
||||||
|
OnElementInvalidated(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ namespace Nz
|
||||||
{
|
{
|
||||||
/*!
|
/*!
|
||||||
* \ingroup math
|
* \ingroup math
|
||||||
* \class Nz::Vector2
|
* \class Vector2
|
||||||
* \brief Math class that represents an element of the two dimensional vector space
|
* \brief Math class that represents an element of the two dimensional vector space
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -443,10 +443,7 @@ namespace Nz
|
||||||
template<typename T>
|
template<typename T>
|
||||||
std::string Vector2<T>::ToString() const
|
std::string Vector2<T>::ToString() const
|
||||||
{
|
{
|
||||||
std::ostringstream ss;
|
return "Vector2(" + std::to_string(x) + ", " + std::to_string(y) + ')';
|
||||||
ss << *this;
|
|
||||||
|
|
||||||
return ss.str();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,15 @@
|
||||||
|
|
||||||
namespace Nz
|
namespace Nz
|
||||||
{
|
{
|
||||||
|
enum class ClipboardContentType
|
||||||
|
{
|
||||||
|
Unknown = -1,
|
||||||
|
|
||||||
|
Text,
|
||||||
|
|
||||||
|
Max = Text
|
||||||
|
};
|
||||||
|
|
||||||
enum class SystemCursor
|
enum class SystemCursor
|
||||||
{
|
{
|
||||||
Crosshair,
|
Crosshair,
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,8 @@ namespace Nz
|
||||||
static void SetPosition(const Vector2i& position, const Window& relativeTo, bool ignoreEvent = true);
|
static void SetPosition(const Vector2i& position, const Window& relativeTo, bool ignoreEvent = true);
|
||||||
static void SetPosition(int x, int y);
|
static void SetPosition(int x, int y);
|
||||||
static void SetPosition(int x, int y, const Window& relativeTo, bool ignoreEvent = true);
|
static void SetPosition(int x, int y, const Window& relativeTo, bool ignoreEvent = true);
|
||||||
|
|
||||||
|
static constexpr std::size_t ButtonCount = static_cast<std::size_t>(Max + 1);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ namespace Nz
|
||||||
class NAZARA_PLATFORM_API Window
|
class NAZARA_PLATFORM_API Window
|
||||||
{
|
{
|
||||||
friend WindowImpl;
|
friend WindowImpl;
|
||||||
friend class EventImpl;
|
friend class InputImpl;
|
||||||
friend class Mouse;
|
friend class Mouse;
|
||||||
friend class Platform;
|
friend class Platform;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,6 @@ namespace Nz
|
||||||
inline EchoMode GetEchoMode() const;
|
inline EchoMode GetEchoMode() const;
|
||||||
inline std::size_t GetGlyphIndex() const;
|
inline std::size_t GetGlyphIndex() const;
|
||||||
inline std::size_t GetGlyphIndex(const Vector2ui& cursorPosition) const;
|
inline std::size_t GetGlyphIndex(const Vector2ui& cursorPosition) const;
|
||||||
inline const std::string& GetText() const;
|
|
||||||
|
|
||||||
Vector2ui GetHoveredGlyph(float x, float y) const;
|
Vector2ui GetHoveredGlyph(float x, float y) const;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -213,6 +213,9 @@ namespace Nz
|
||||||
if (toPosition.y < fromPosition.y || (toPosition.y == fromPosition.y && toPosition.x < fromPosition.x))
|
if (toPosition.y < fromPosition.y || (toPosition.y == fromPosition.y && toPosition.x < fromPosition.x))
|
||||||
std::swap(fromPosition, toPosition);
|
std::swap(fromPosition, toPosition);
|
||||||
|
|
||||||
|
fromPosition = NormalizeCursorPosition(fromPosition);
|
||||||
|
toPosition = NormalizeCursorPosition(toPosition);
|
||||||
|
|
||||||
if (m_cursorPositionBegin != fromPosition || m_cursorPositionEnd != toPosition)
|
if (m_cursorPositionBegin != fromPosition || m_cursorPositionEnd != toPosition)
|
||||||
{
|
{
|
||||||
OnTextAreaSelection(this, &fromPosition, &toPosition);
|
OnTextAreaSelection(this, &fromPosition, &toPosition);
|
||||||
|
|
|
||||||
|
|
@ -52,24 +52,24 @@ namespace Nz
|
||||||
|
|
||||||
inline const Color& GetBackgroundColor() const;
|
inline const Color& GetBackgroundColor() const;
|
||||||
inline Canvas* GetCanvas();
|
inline Canvas* GetCanvas();
|
||||||
inline Nz::SystemCursor GetCursor() const;
|
inline SystemCursor GetCursor() const;
|
||||||
inline float GetHeight() const;
|
inline float GetHeight() const;
|
||||||
|
|
||||||
inline float GetMaximumHeight() const;
|
inline float GetMaximumHeight() const;
|
||||||
inline Nz::Vector2f GetMaximumSize() const;
|
inline Vector2f GetMaximumSize() const;
|
||||||
inline float GetMaximumWidth() const;
|
inline float GetMaximumWidth() const;
|
||||||
|
|
||||||
inline float GetMinimumHeight() const;
|
inline float GetMinimumHeight() const;
|
||||||
inline Nz::Vector2f GetMinimumSize() const;
|
inline Vector2f GetMinimumSize() const;
|
||||||
inline float GetMinimumWidth() const;
|
inline float GetMinimumWidth() const;
|
||||||
|
|
||||||
inline float GetPreferredHeight() const;
|
inline float GetPreferredHeight() const;
|
||||||
inline Nz::Vector2f GetPreferredSize() const;
|
inline Vector2f GetPreferredSize() const;
|
||||||
inline float GetPreferredWidth() const;
|
inline float GetPreferredWidth() const;
|
||||||
|
|
||||||
inline const Nz::Rectf& GetRenderingRect() const;
|
inline const Rectf& GetRenderingRect() const;
|
||||||
|
|
||||||
inline Nz::Vector2f GetSize() const;
|
inline Vector2f GetSize() const;
|
||||||
inline float GetWidth() const;
|
inline float GetWidth() const;
|
||||||
inline std::size_t GetWidgetChildCount() const;
|
inline std::size_t GetWidgetChildCount() const;
|
||||||
|
|
||||||
|
|
@ -78,26 +78,26 @@ namespace Nz
|
||||||
inline void Hide();
|
inline void Hide();
|
||||||
inline bool IsVisible() const;
|
inline bool IsVisible() const;
|
||||||
|
|
||||||
void Resize(const Nz::Vector2f& size);
|
void Resize(const Vector2f& size);
|
||||||
|
|
||||||
void SetBackgroundColor(const Color& color);
|
void SetBackgroundColor(const Color& color);
|
||||||
void SetCursor(Nz::SystemCursor systemCursor);
|
void SetCursor(SystemCursor systemCursor);
|
||||||
void SetFocus();
|
void SetFocus();
|
||||||
void SetParent(BaseWidget* widget);
|
void SetParent(BaseWidget* widget);
|
||||||
|
|
||||||
inline void SetFixedHeight(float fixedHeight);
|
inline void SetFixedHeight(float fixedHeight);
|
||||||
inline void SetFixedSize(const Nz::Vector2f& fixedSize);
|
inline void SetFixedSize(const Vector2f& fixedSize);
|
||||||
inline void SetFixedWidth(float fixedWidth);
|
inline void SetFixedWidth(float fixedWidth);
|
||||||
|
|
||||||
inline void SetMaximumHeight(float maximumHeight);
|
inline void SetMaximumHeight(float maximumHeight);
|
||||||
inline void SetMaximumSize(const Nz::Vector2f& maximumSize);
|
inline void SetMaximumSize(const Vector2f& maximumSize);
|
||||||
inline void SetMaximumWidth(float maximumWidth);
|
inline void SetMaximumWidth(float maximumWidth);
|
||||||
|
|
||||||
inline void SetMinimumHeight(float minimumHeight);
|
inline void SetMinimumHeight(float minimumHeight);
|
||||||
inline void SetMinimumSize(const Nz::Vector2f& minimumSize);
|
inline void SetMinimumSize(const Vector2f& minimumSize);
|
||||||
inline void SetMinimumWidth(float minimumWidth);
|
inline void SetMinimumWidth(float minimumWidth);
|
||||||
|
|
||||||
virtual void SetRenderingRect(const Nz::Rectf& renderingRect);
|
virtual void SetRenderingRect(const Rectf& renderingRect);
|
||||||
|
|
||||||
void Show(bool show = true);
|
void Show(bool show = true);
|
||||||
|
|
||||||
|
|
@ -105,32 +105,34 @@ namespace Nz
|
||||||
BaseWidget& operator=(BaseWidget&&) = delete;
|
BaseWidget& operator=(BaseWidget&&) = delete;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
entt::entity CreateEntity();
|
|
||||||
void DestroyEntity(entt::entity entity);
|
|
||||||
virtual void Layout();
|
virtual void Layout();
|
||||||
|
|
||||||
void InvalidateNode() override;
|
entt::entity CreateEntity();
|
||||||
|
void DestroyEntity(entt::entity entity);
|
||||||
|
|
||||||
inline entt::registry& GetRegistry();
|
inline entt::registry& GetRegistry();
|
||||||
inline const entt::registry& GetRegistry() const;
|
inline const entt::registry& GetRegistry() const;
|
||||||
Nz::Rectf GetScissorRect() const;
|
|
||||||
|
void InvalidateNode() override;
|
||||||
|
|
||||||
|
Rectf GetScissorRect() const;
|
||||||
|
|
||||||
virtual bool IsFocusable() const;
|
virtual bool IsFocusable() const;
|
||||||
virtual void OnFocusLost();
|
virtual void OnFocusLost();
|
||||||
virtual void OnFocusReceived();
|
virtual void OnFocusReceived();
|
||||||
virtual bool OnKeyPressed(const Nz::WindowEvent::KeyEvent& key);
|
virtual bool OnKeyPressed(const WindowEvent::KeyEvent& key);
|
||||||
virtual void OnKeyReleased(const Nz::WindowEvent::KeyEvent& key);
|
virtual void OnKeyReleased(const WindowEvent::KeyEvent& key);
|
||||||
virtual void OnMouseEnter();
|
virtual void OnMouseEnter();
|
||||||
virtual void OnMouseMoved(int x, int y, int deltaX, int deltaY);
|
virtual void OnMouseMoved(int x, int y, int deltaX, int deltaY);
|
||||||
virtual void OnMouseButtonPress(int x, int y, Nz::Mouse::Button button);
|
virtual void OnMouseButtonPress(int x, int y, Mouse::Button button);
|
||||||
virtual void OnMouseButtonRelease(int x, int y, Nz::Mouse::Button button);
|
virtual void OnMouseButtonRelease(int x, int y, Mouse::Button button);
|
||||||
virtual void OnMouseWheelMoved(int x, int y, float delta);
|
virtual void OnMouseWheelMoved(int x, int y, float delta);
|
||||||
virtual void OnMouseExit();
|
virtual void OnMouseExit();
|
||||||
virtual void OnParentResized(const Nz::Vector2f& newSize);
|
virtual void OnParentResized(const Vector2f& newSize);
|
||||||
virtual void OnTextEntered(char32_t character, bool repeated);
|
virtual void OnTextEntered(char32_t character, bool repeated);
|
||||||
virtual void OnTextEdited(const std::array<char, 32>& characters, int length);
|
virtual void OnTextEdited(const std::array<char, 32>& characters, int length);
|
||||||
|
|
||||||
inline void SetPreferredSize(const Nz::Vector2f& preferredSize);
|
inline void SetPreferredSize(const Vector2f& preferredSize);
|
||||||
|
|
||||||
virtual void ShowChildren(bool show);
|
virtual void ShowChildren(bool show);
|
||||||
|
|
||||||
|
|
@ -140,7 +142,7 @@ namespace Nz
|
||||||
void DestroyChild(BaseWidget* widget);
|
void DestroyChild(BaseWidget* widget);
|
||||||
void DestroyChildren();
|
void DestroyChildren();
|
||||||
inline bool IsRegisteredToCanvas() const;
|
inline bool IsRegisteredToCanvas() const;
|
||||||
inline void NotifyParentResized(const Nz::Vector2f& newSize);
|
inline void NotifyParentResized(const Vector2f& newSize);
|
||||||
void RegisterToCanvas();
|
void RegisterToCanvas();
|
||||||
inline void UpdateCanvasIndex(std::size_t index);
|
inline void UpdateCanvasIndex(std::size_t index);
|
||||||
void UnregisterFromCanvas();
|
void UnregisterFromCanvas();
|
||||||
|
|
@ -149,10 +151,6 @@ namespace Nz
|
||||||
struct WidgetEntity
|
struct WidgetEntity
|
||||||
{
|
{
|
||||||
entt::entity handle;
|
entt::entity handle;
|
||||||
bool isEnabled = true;
|
|
||||||
|
|
||||||
//NazaraSlot(Ndk::Entity, OnEntityDisabled, onDisabledSlot);
|
|
||||||
//NazaraSlot(Ndk::Entity, OnEntityEnabled, onEnabledSlot);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr std::size_t InvalidCanvasIndex = std::numeric_limits<std::size_t>::max();
|
static constexpr std::size_t InvalidCanvasIndex = std::numeric_limits<std::size_t>::max();
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ namespace Nz
|
||||||
m_canvas(nullptr),
|
m_canvas(nullptr),
|
||||||
m_backgroundColor(Color(230, 230, 230, 255)),
|
m_backgroundColor(Color(230, 230, 230, 255)),
|
||||||
m_renderingRect(-std::numeric_limits<float>::infinity(), -std::numeric_limits<float>::infinity(), std::numeric_limits<float>::infinity(), std::numeric_limits<float>::infinity()),
|
m_renderingRect(-std::numeric_limits<float>::infinity(), -std::numeric_limits<float>::infinity(), std::numeric_limits<float>::infinity(), std::numeric_limits<float>::infinity()),
|
||||||
m_cursor(Nz::SystemCursor::Default),
|
m_cursor(SystemCursor::Default),
|
||||||
m_maximumSize(std::numeric_limits<float>::infinity()),
|
m_maximumSize(std::numeric_limits<float>::infinity()),
|
||||||
m_minimumSize(0.f),
|
m_minimumSize(0.f),
|
||||||
m_preferredSize(-1),
|
m_preferredSize(-1),
|
||||||
|
|
@ -47,8 +47,8 @@ namespace Nz
|
||||||
{
|
{
|
||||||
NazaraAssert(m_widgetParent, "Widget has no parent");
|
NazaraAssert(m_widgetParent, "Widget has no parent");
|
||||||
|
|
||||||
Nz::Vector2f parentSize = m_widgetParent->GetSize();
|
Vector2f parentSize = m_widgetParent->GetSize();
|
||||||
Nz::Vector2f mySize = GetSize();
|
Vector2f mySize = GetSize();
|
||||||
SetPosition((parentSize.x - mySize.x) / 2.f, (parentSize.y - mySize.y) / 2.f);
|
SetPosition((parentSize.x - mySize.x) / 2.f, (parentSize.y - mySize.y) / 2.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -56,23 +56,23 @@ namespace Nz
|
||||||
{
|
{
|
||||||
NazaraAssert(m_widgetParent, "Widget has no parent");
|
NazaraAssert(m_widgetParent, "Widget has no parent");
|
||||||
|
|
||||||
Nz::Vector2f parentSize = m_widgetParent->GetSize();
|
Vector2f parentSize = m_widgetParent->GetSize();
|
||||||
Nz::Vector2f mySize = GetSize();
|
Vector2f mySize = GetSize();
|
||||||
SetPosition((parentSize.x - mySize.x) / 2.f, GetPosition(Nz::CoordSys::Local).y);
|
SetPosition((parentSize.x - mySize.x) / 2.f, GetPosition(CoordSys::Local).y);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void BaseWidget::CenterVertical()
|
inline void BaseWidget::CenterVertical()
|
||||||
{
|
{
|
||||||
NazaraAssert(m_widgetParent, "Widget has no parent");
|
NazaraAssert(m_widgetParent, "Widget has no parent");
|
||||||
|
|
||||||
Nz::Vector2f parentSize = m_widgetParent->GetSize();
|
Vector2f parentSize = m_widgetParent->GetSize();
|
||||||
Nz::Vector2f mySize = GetSize();
|
Vector2f mySize = GetSize();
|
||||||
SetPosition(GetPosition(Nz::CoordSys::Local).x, (parentSize.y - mySize.y) / 2.f);
|
SetPosition(GetPosition(CoordSys::Local).x, (parentSize.y - mySize.y) / 2.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void BaseWidget::ClearRenderingRect()
|
inline void BaseWidget::ClearRenderingRect()
|
||||||
{
|
{
|
||||||
SetRenderingRect(Nz::Rectf(-std::numeric_limits<float>::infinity(), -std::numeric_limits<float>::infinity(), std::numeric_limits<float>::infinity(), std::numeric_limits<float>::infinity()));
|
SetRenderingRect(Rectf(-std::numeric_limits<float>::infinity(), -std::numeric_limits<float>::infinity(), std::numeric_limits<float>::infinity(), std::numeric_limits<float>::infinity()));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename F>
|
template<typename F>
|
||||||
|
|
@ -99,7 +99,7 @@ namespace Nz
|
||||||
return m_canvas;
|
return m_canvas;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Nz::SystemCursor BaseWidget::GetCursor() const
|
inline SystemCursor BaseWidget::GetCursor() const
|
||||||
{
|
{
|
||||||
return m_cursor;
|
return m_cursor;
|
||||||
}
|
}
|
||||||
|
|
@ -114,7 +114,7 @@ namespace Nz
|
||||||
return m_maximumSize.y;
|
return m_maximumSize.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Nz::Vector2f BaseWidget::GetMaximumSize() const
|
inline Vector2f BaseWidget::GetMaximumSize() const
|
||||||
{
|
{
|
||||||
return m_maximumSize;
|
return m_maximumSize;
|
||||||
}
|
}
|
||||||
|
|
@ -129,7 +129,7 @@ namespace Nz
|
||||||
return m_minimumSize.y;
|
return m_minimumSize.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Nz::Vector2f BaseWidget::GetMinimumSize() const
|
inline Vector2f BaseWidget::GetMinimumSize() const
|
||||||
{
|
{
|
||||||
return m_minimumSize;
|
return m_minimumSize;
|
||||||
}
|
}
|
||||||
|
|
@ -144,7 +144,7 @@ namespace Nz
|
||||||
return m_preferredSize.y;
|
return m_preferredSize.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Nz::Vector2f BaseWidget::GetPreferredSize() const
|
inline Vector2f BaseWidget::GetPreferredSize() const
|
||||||
{
|
{
|
||||||
return m_preferredSize;
|
return m_preferredSize;
|
||||||
}
|
}
|
||||||
|
|
@ -154,14 +154,14 @@ namespace Nz
|
||||||
return m_preferredSize.x;
|
return m_preferredSize.x;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const Nz::Rectf& BaseWidget::GetRenderingRect() const
|
inline const Rectf& BaseWidget::GetRenderingRect() const
|
||||||
{
|
{
|
||||||
return m_renderingRect;
|
return m_renderingRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Nz::Vector2f BaseWidget::GetSize() const
|
inline Vector2f BaseWidget::GetSize() const
|
||||||
{
|
{
|
||||||
return Nz::Vector2f(GetWidth(), GetHeight());
|
return Vector2f(GetWidth(), GetHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
inline float BaseWidget::GetWidth() const
|
inline float BaseWidget::GetWidth() const
|
||||||
|
|
@ -190,7 +190,7 @@ namespace Nz
|
||||||
SetMinimumHeight(fixedHeight);
|
SetMinimumHeight(fixedHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void BaseWidget::SetFixedSize(const Nz::Vector2f& fixedSize)
|
inline void BaseWidget::SetFixedSize(const Vector2f& fixedSize)
|
||||||
{
|
{
|
||||||
SetMaximumSize(fixedSize);
|
SetMaximumSize(fixedSize);
|
||||||
SetMinimumSize(fixedSize);
|
SetMinimumSize(fixedSize);
|
||||||
|
|
@ -204,24 +204,24 @@ namespace Nz
|
||||||
|
|
||||||
inline void BaseWidget::SetMaximumHeight(float maximumHeight)
|
inline void BaseWidget::SetMaximumHeight(float maximumHeight)
|
||||||
{
|
{
|
||||||
Nz::Vector2f maximumSize = GetMaximumSize();
|
Vector2f maximumSize = GetMaximumSize();
|
||||||
maximumSize.y = maximumHeight;
|
maximumSize.y = maximumHeight;
|
||||||
|
|
||||||
SetMaximumSize(maximumSize);
|
SetMaximumSize(maximumSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void BaseWidget::SetMaximumSize(const Nz::Vector2f& maximumSize)
|
inline void BaseWidget::SetMaximumSize(const Vector2f& maximumSize)
|
||||||
{
|
{
|
||||||
m_maximumSize = maximumSize;
|
m_maximumSize = maximumSize;
|
||||||
|
|
||||||
Nz::Vector2f size = GetSize();
|
Vector2f size = GetSize();
|
||||||
if (size.x > m_maximumSize.x || size.y > m_maximumSize.y)
|
if (size.x > m_maximumSize.x || size.y > m_maximumSize.y)
|
||||||
Resize(size); //< Will clamp automatically
|
Resize(size); //< Will clamp automatically
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void BaseWidget::SetMaximumWidth(float maximumWidth)
|
inline void BaseWidget::SetMaximumWidth(float maximumWidth)
|
||||||
{
|
{
|
||||||
Nz::Vector2f maximumSize = GetMaximumSize();
|
Vector2f maximumSize = GetMaximumSize();
|
||||||
maximumSize.x = maximumWidth;
|
maximumSize.x = maximumWidth;
|
||||||
|
|
||||||
SetMaximumSize(maximumSize);
|
SetMaximumSize(maximumSize);
|
||||||
|
|
@ -229,30 +229,30 @@ namespace Nz
|
||||||
|
|
||||||
inline void BaseWidget::SetMinimumHeight(float minimumHeight)
|
inline void BaseWidget::SetMinimumHeight(float minimumHeight)
|
||||||
{
|
{
|
||||||
Nz::Vector2f minimumSize = GetMinimumSize();
|
Vector2f minimumSize = GetMinimumSize();
|
||||||
minimumSize.y = minimumHeight;
|
minimumSize.y = minimumHeight;
|
||||||
|
|
||||||
SetMinimumSize(minimumSize);
|
SetMinimumSize(minimumSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void BaseWidget::SetMinimumSize(const Nz::Vector2f& minimumSize)
|
inline void BaseWidget::SetMinimumSize(const Vector2f& minimumSize)
|
||||||
{
|
{
|
||||||
m_minimumSize = minimumSize;
|
m_minimumSize = minimumSize;
|
||||||
|
|
||||||
Nz::Vector2f size = GetSize();
|
Vector2f size = GetSize();
|
||||||
if (size.x < m_minimumSize.x || size.y < m_minimumSize.y)
|
if (size.x < m_minimumSize.x || size.y < m_minimumSize.y)
|
||||||
Resize(size); //< Will clamp automatically
|
Resize(size); //< Will clamp automatically
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void BaseWidget::SetMinimumWidth(float minimumWidth)
|
inline void BaseWidget::SetMinimumWidth(float minimumWidth)
|
||||||
{
|
{
|
||||||
Nz::Vector2f minimumSize = GetMinimumSize();
|
Vector2f minimumSize = GetMinimumSize();
|
||||||
minimumSize.x = minimumWidth;
|
minimumSize.x = minimumWidth;
|
||||||
|
|
||||||
SetMinimumSize(minimumSize);
|
SetMinimumSize(minimumSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void BaseWidget::SetPreferredSize(const Nz::Vector2f& preferredSize)
|
inline void BaseWidget::SetPreferredSize(const Vector2f& preferredSize)
|
||||||
{
|
{
|
||||||
m_preferredSize = preferredSize;
|
m_preferredSize = preferredSize;
|
||||||
|
|
||||||
|
|
@ -276,7 +276,7 @@ namespace Nz
|
||||||
return m_canvas && m_canvasIndex != InvalidCanvasIndex;
|
return m_canvas && m_canvasIndex != InvalidCanvasIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void BaseWidget::NotifyParentResized(const Nz::Vector2f& newSize)
|
inline void BaseWidget::NotifyParentResized(const Vector2f& newSize)
|
||||||
{
|
{
|
||||||
for (const auto& widgetPtr : m_children)
|
for (const auto& widgetPtr : m_children)
|
||||||
widgetPtr->OnParentResized(newSize);
|
widgetPtr->OnParentResized(newSize);
|
||||||
|
|
|
||||||
|
|
@ -246,6 +246,7 @@ namespace Nz
|
||||||
|
|
||||||
if (viewerData.rebuildDepthPrepass)
|
if (viewerData.rebuildDepthPrepass)
|
||||||
{
|
{
|
||||||
|
renderFrame.PushForRelease(std::move(viewerData.depthPrepassRenderElements));
|
||||||
viewerData.depthPrepassRenderElements.clear();
|
viewerData.depthPrepassRenderElements.clear();
|
||||||
|
|
||||||
for (const auto& renderableData : m_visibleRenderables)
|
for (const auto& renderableData : m_visibleRenderables)
|
||||||
|
|
@ -268,6 +269,7 @@ namespace Nz
|
||||||
|
|
||||||
if (viewerData.rebuildForwardPass)
|
if (viewerData.rebuildForwardPass)
|
||||||
{
|
{
|
||||||
|
renderFrame.PushForRelease(std::move(viewerData.forwardRenderElements));
|
||||||
viewerData.forwardRenderElements.clear();
|
viewerData.forwardRenderElements.clear();
|
||||||
|
|
||||||
for (const auto& renderableData : m_visibleRenderables)
|
for (const auto& renderableData : m_visibleRenderables)
|
||||||
|
|
|
||||||
|
|
@ -194,7 +194,6 @@ namespace Nz
|
||||||
Nz::TextureInfo texInfo;
|
Nz::TextureInfo texInfo;
|
||||||
texInfo.width = texInfo.height = texInfo.depth = texInfo.mipmapLevel = 1;
|
texInfo.width = texInfo.height = texInfo.depth = texInfo.mipmapLevel = 1;
|
||||||
texInfo.pixelFormat = PixelFormat::L8;
|
texInfo.pixelFormat = PixelFormat::L8;
|
||||||
texInfo.type = ImageType::E2D;
|
|
||||||
|
|
||||||
std::array<UInt8, 6> whitePixels = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
|
std::array<UInt8, 6> whitePixels = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,6 @@ namespace Nz
|
||||||
}
|
}
|
||||||
|
|
||||||
// Couldn't get material pass or texture
|
// Couldn't get material pass or texture
|
||||||
return Vector3ui::Zero();
|
return Vector3ui::Unit(); //< prevents division by zero
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ namespace Nz
|
||||||
CameraComponent& entityCamera = registry.get<CameraComponent>(entity);
|
CameraComponent& entityCamera = registry.get<CameraComponent>(entity);
|
||||||
NodeComponent& entityNode = registry.get<NodeComponent>(entity);
|
NodeComponent& entityNode = registry.get<NodeComponent>(entity);
|
||||||
|
|
||||||
m_pipeline->RegisterViewer(&entityCamera);
|
m_pipeline->RegisterViewer(&entityCamera, entityCamera.GetRenderOrder());
|
||||||
|
|
||||||
m_invalidatedCameraNode.insert(entity);
|
m_invalidatedCameraNode.insert(entity);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -120,6 +120,11 @@ namespace Nz
|
||||||
return Vector2ui::Zero();
|
return Vector2ui::Zero();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AbstractTextAreaWidget::IsFocusable() const
|
||||||
|
{
|
||||||
|
return !m_readOnly;
|
||||||
|
}
|
||||||
|
|
||||||
void AbstractTextAreaWidget::Layout()
|
void AbstractTextAreaWidget::Layout()
|
||||||
{
|
{
|
||||||
BaseWidget::Layout();
|
BaseWidget::Layout();
|
||||||
|
|
@ -135,11 +140,6 @@ namespace Nz
|
||||||
RefreshCursor();
|
RefreshCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AbstractTextAreaWidget::IsFocusable() const
|
|
||||||
{
|
|
||||||
return !m_readOnly;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AbstractTextAreaWidget::OnFocusLost()
|
void AbstractTextAreaWidget::OnFocusLost()
|
||||||
{
|
{
|
||||||
// Hide cursors
|
// Hide cursors
|
||||||
|
|
@ -367,7 +367,7 @@ namespace Nz
|
||||||
m_isMouseButtonDown = false;
|
m_isMouseButtonDown = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractTextAreaWidget::OnMouseMoved(int x, int y, int deltaX, int deltaY)
|
void AbstractTextAreaWidget::OnMouseMoved(int x, int y, int /*deltaX*/, int /*deltaY*/)
|
||||||
{
|
{
|
||||||
if (m_isMouseButtonDown)
|
if (m_isMouseButtonDown)
|
||||||
SetSelection(m_selectionCursor, GetHoveredGlyph(float(x), float(y)));
|
SetSelection(m_selectionCursor, GetHoveredGlyph(float(x), float(y)));
|
||||||
|
|
|
||||||
|
|
@ -187,13 +187,8 @@ namespace Nz
|
||||||
auto& registry = GetRegistry();
|
auto& registry = GetRegistry();
|
||||||
for (WidgetEntity& entity : m_entities)
|
for (WidgetEntity& entity : m_entities)
|
||||||
{
|
{
|
||||||
if (entity.isEnabled)
|
if (GraphicsComponent* gfx = registry.try_get<GraphicsComponent>(entity.handle))
|
||||||
{
|
gfx->Show(show);
|
||||||
if (GraphicsComponent* gfx = registry.try_get<GraphicsComponent>(entity.handle))
|
|
||||||
gfx->Show(show);
|
|
||||||
|
|
||||||
entity.isEnabled = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ShowChildren(show);
|
ShowChildren(show);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue