Upgrade Platform

This commit is contained in:
Jérôme Leclercq
2021-05-24 21:06:55 +02:00
parent 8b0b5295f7
commit ba7c56ddfa
20 changed files with 322 additions and 389 deletions

View File

@@ -2,47 +2,11 @@
// This file is part of the "Nazara Engine - Platform module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Core/ErrorFlags.hpp>
#include <Nazara/Platform/Cursor.hpp>
#include <Nazara/Platform/Debug.hpp>
namespace Nz
{
inline Cursor::Cursor() :
m_impl(nullptr)
{
}
inline Cursor::Cursor(const Image& cursor, const Vector2i& hotSpot, SystemCursor placeholder)
{
ErrorFlags flags(ErrorFlag_ThrowException, true);
Create(cursor, hotSpot, placeholder);
}
inline Cursor* Cursor::Get(SystemCursor cursor)
{
return &s_systemCursors[cursor];
}
inline Cursor::Cursor(SystemCursor systemCursor) :
Cursor()
{
ErrorFlags flags(ErrorFlag_ThrowException, true);
Create(systemCursor);
}
inline Cursor::~Cursor()
{
Destroy();
}
inline const Image& Cursor::GetImage() const
{
NazaraAssert(IsValid(), "Invalid cursor");
NazaraAssert(m_cursorImage.IsValid(), "System cursors have no image");
return m_cursorImage;
}
inline SystemCursor Cursor::GetSystemCursor() const
{
NazaraAssert(IsValid(), "Invalid cursor");
@@ -55,13 +19,9 @@ namespace Nz
return m_impl != nullptr;
}
template<typename... Args>
CursorRef Cursor::New(Args&&... args)
inline std::shared_ptr<Cursor>& Cursor::Get(SystemCursor cursor)
{
std::unique_ptr<Cursor> object(new Cursor(std::forward<Args>(args)...));
object->SetPersistent(false);
return object.release();
return s_systemCursors[UnderlyingCast(cursor)];
}
}