Merge fixes

This commit is contained in:
Lynix
2020-05-27 20:03:46 +02:00
parent 68208f5426
commit e0e7435c55
11 changed files with 48 additions and 40 deletions

View File

@@ -15,6 +15,6 @@ namespace Nz
void DummySurface::Destroy()
{
m_handle = nullptr;
m_handle = WindowHandle{};
}
}

View File

@@ -29,12 +29,21 @@ namespace Nz::GL
::ShowWindow(m_window.get(), FALSE);
return Create(baseContext, params, m_window.get(), shareContext);
m_deviceContext = ::GetDC(m_window.get());
if (!m_deviceContext)
{
NazaraError("failed to retrieve dummy window device context: " + Error::GetLastSystemError());
return false;
}
return CreateInternal(baseContext, params, shareContext);
}
bool WGLContext::Create(const WGLContext* baseContext, const ContextParams& params, WindowHandle window, const WGLContext* shareContext)
{
m_deviceContext = ::GetDC(static_cast<HWND>(window));
NazaraAssert(window.type == WindowManager::Windows, "expected Windows window");
m_deviceContext = ::GetDC(static_cast<HWND>(window.windows.window));
if (!m_deviceContext)
{
NazaraError("failed to retrieve window device context: " + Error::GetLastSystemError());

View File

@@ -13,7 +13,7 @@ namespace Nz
bool CursorImpl::Create(const Image& cursor, int hotSpotX, int hotSpotY)
{
m_iconImage = cursor;
if (!m_iconImage.Convert(PixelFormatType_BGRA8))
if (!m_iconImage.Convert(PixelFormat_BGRA8))
{
NazaraError("Failed to convert icon to BGRA8");
return false;

View File

@@ -12,7 +12,7 @@ namespace Nz
bool IconImpl::Create(const Image& icon)
{
m_iconImage = icon;
if (!m_iconImage.Convert(PixelFormatType_BGRA8))
if (!m_iconImage.Convert(PixelFormat_BGRA8))
{
NazaraError("Failed to convert icon to BGRA8");
return false;

View File

@@ -4,11 +4,8 @@
#include <cstdio>
#include <memory>
#include <Nazara/Core/ConditionVariable.hpp>
#include <Nazara/Core/Error.hpp>
#include <Nazara/Core/ErrorFlags.hpp>
#include <Nazara/Core/Mutex.hpp>
#include <Nazara/Core/Thread.hpp>
#include <Nazara/Platform/Config.hpp>
#include <Nazara/Platform/Cursor.hpp>
#include <Nazara/Platform/Icon.hpp>

View File

@@ -40,7 +40,7 @@ namespace Nz
{
RendererImpl *rendererImpl = Renderer::GetRendererImpl();
auto surface = rendererImpl->CreateRenderSurfaceImpl();
if (!surface->Create(GetHandle()))
if (!surface->Create(GetSystemHandle()))
{
NazaraError("Failed to create render surface: " + Error::GetLastError());
return false;
@@ -49,26 +49,25 @@ namespace Nz
auto impl = rendererImpl->CreateRenderWindowImpl();
if (!impl->Create(rendererImpl, surface.get(), GetSize(), m_parameters))
{
{
NazaraError("Failed to create render window implementation: " + Error::GetLastError());
return false;
}
m_impl = std::move(impl);
m_surface = std::move(surface);
m_clock.Restart();
return true;
NazaraError("Failed to create render window implementation: " + Error::GetLastError());
return false;
}
void RenderWindow::OnWindowDestroy()
{
m_impl.reset();
m_surface.reset();
}
m_impl = std::move(impl);
m_surface = std::move(surface);
void RenderWindow::OnWindowResized()
{
}
m_clock.Restart();
return true;
}
void RenderWindow::OnWindowDestroy()
{
m_impl.reset();
m_surface.reset();
}
void RenderWindow::OnWindowResized()
{
}
}

View File

@@ -110,6 +110,7 @@ namespace Nz
chosenImpl = std::move(impl); //< Move (and delete previous) implementation before unloading library
chosenLib = std::move(implLib);
break;
}
if (!chosenImpl)

View File

@@ -18,7 +18,9 @@ namespace Nz
bool success = false;
#if defined(NAZARA_PLATFORM_WINDOWS)
{
HWND winHandle = reinterpret_cast<HWND>(handle);
NazaraAssert(handle.type == WindowManager::Windows, "expected Windows window");
HWND winHandle = reinterpret_cast<HWND>(handle.windows.window);
HINSTANCE instance = reinterpret_cast<HINSTANCE>(GetWindowLongPtrW(winHandle, GWLP_HINSTANCE));
success = m_surface.Create(instance, winHandle);