Widgets: Add ImageWidget
This commit is contained in:
54
include/Nazara/Widgets/ImageWidget.inl
Normal file
54
include/Nazara/Widgets/ImageWidget.inl
Normal file
@@ -0,0 +1,54 @@
|
||||
// Copyright (C) 2021 Samy Bensaid
|
||||
// This file is part of the "Nazara Engine - Widgets module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Widgets/ImageWidget.hpp>
|
||||
#include <Nazara/Widgets/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
inline const Color& ImageWidget::GetColor() const
|
||||
{
|
||||
return m_sprite->GetColor();
|
||||
}
|
||||
|
||||
inline const std::shared_ptr<Material>& ImageWidget::GetMaterial() const
|
||||
{
|
||||
return m_sprite->GetMaterial();
|
||||
}
|
||||
|
||||
inline const Rectf& ImageWidget::GetTextureCoords() const
|
||||
{
|
||||
return m_sprite->GetTextureCoords();
|
||||
}
|
||||
|
||||
inline void ImageWidget::SetColor(const Color& color)
|
||||
{
|
||||
m_sprite->SetColor(color);
|
||||
}
|
||||
|
||||
inline void ImageWidget::SetMaterial(const std::shared_ptr<Material>& texture)
|
||||
{
|
||||
m_sprite->SetMaterial(texture);
|
||||
|
||||
const Rectf& textureCoords = GetTextureCoords();
|
||||
|
||||
Vector2f textureSize = Vector2f(Vector2ui(m_sprite->GetTextureSize()));
|
||||
textureSize.x *= textureCoords.width;
|
||||
textureSize.y *= textureCoords.height;
|
||||
|
||||
SetPreferredSize(textureSize);
|
||||
}
|
||||
|
||||
inline void ImageWidget::SetTextureCoords(const Rectf& coords)
|
||||
{
|
||||
m_sprite->SetTextureCoords(coords);
|
||||
}
|
||||
|
||||
inline void ImageWidget::SetTextureRect(const Rectf& rect)
|
||||
{
|
||||
m_sprite->SetTextureRect(rect);
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Widgets/DebugOff.hpp>
|
||||
Reference in New Issue
Block a user