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

@ -3,7 +3,7 @@
#include <array>
#include <iostream>
#define SPIRV 0
#define SPIRV 1
int main()
{
@ -266,27 +266,27 @@ int main()
float cameraSpeed = 2.f * updateClock.GetSeconds();
updateClock.Restart();
if (Nz::Keyboard::IsKeyPressed(Nz::Keyboard::Up) || Nz::Keyboard::IsKeyPressed(Nz::Keyboard::Z))
if (Nz::Keyboard::IsKeyPressed(Nz::Keyboard::VKey::Up) || Nz::Keyboard::IsKeyPressed(Nz::Keyboard::VKey::Z))
viewerPos += camQuat * Nz::Vector3f::Forward() * cameraSpeed;
// Si la flèche du bas ou la touche S est pressée, on recule
if (Nz::Keyboard::IsKeyPressed(Nz::Keyboard::Down) || Nz::Keyboard::IsKeyPressed(Nz::Keyboard::S))
if (Nz::Keyboard::IsKeyPressed(Nz::Keyboard::VKey::Down) || Nz::Keyboard::IsKeyPressed(Nz::Keyboard::VKey::S))
viewerPos += camQuat * Nz::Vector3f::Backward() * cameraSpeed;
// Etc...
if (Nz::Keyboard::IsKeyPressed(Nz::Keyboard::Left) || Nz::Keyboard::IsKeyPressed(Nz::Keyboard::Q))
if (Nz::Keyboard::IsKeyPressed(Nz::Keyboard::VKey::Left) || Nz::Keyboard::IsKeyPressed(Nz::Keyboard::VKey::Q))
viewerPos += camQuat * Nz::Vector3f::Left() * cameraSpeed;
// Etc...
if (Nz::Keyboard::IsKeyPressed(Nz::Keyboard::Right) || Nz::Keyboard::IsKeyPressed(Nz::Keyboard::D))
if (Nz::Keyboard::IsKeyPressed(Nz::Keyboard::VKey::Right) || Nz::Keyboard::IsKeyPressed(Nz::Keyboard::VKey::D))
viewerPos += camQuat * Nz::Vector3f::Right() * cameraSpeed;
// Majuscule pour monter, notez l'utilisation d'une direction globale (Non-affectée par la rotation)
if (Nz::Keyboard::IsKeyPressed(Nz::Keyboard::LShift) || Nz::Keyboard::IsKeyPressed(Nz::Keyboard::RShift))
if (Nz::Keyboard::IsKeyPressed(Nz::Keyboard::VKey::LShift) || Nz::Keyboard::IsKeyPressed(Nz::Keyboard::VKey::RShift))
viewerPos += Nz::Vector3f::Up() * cameraSpeed;
// Contrôle (Gauche ou droite) pour descendre dans l'espace global, etc...
if (Nz::Keyboard::IsKeyPressed(Nz::Keyboard::LControl) || Nz::Keyboard::IsKeyPressed(Nz::Keyboard::RControl))
if (Nz::Keyboard::IsKeyPressed(Nz::Keyboard::VKey::LControl) || Nz::Keyboard::IsKeyPressed(Nz::Keyboard::VKey::RControl))
viewerPos += Nz::Vector3f::Down() * cameraSpeed;
}

View File

@ -20,7 +20,7 @@ namespace Nz
Create(mode, title, style, parameters);
}
inline RenderWindow::RenderWindow(WindowHandle handle, const RenderWindowParameters& parameters)
inline RenderWindow::RenderWindow(void* handle, const RenderWindowParameters& parameters)
{
ErrorFlags errFlags(ErrorFlag_ThrowException, true);
@ -39,7 +39,7 @@ namespace Nz
return Window::Create(mode, title, style);
}
inline bool RenderWindow::Create(WindowHandle handle, const RenderWindowParameters& parameters)
inline bool RenderWindow::Create(void* handle, const RenderWindowParameters& parameters)
{
m_parameters = parameters;

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;
@ -48,7 +48,6 @@ 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;

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);