Merge fixes
This commit is contained in:
parent
68208f5426
commit
e0e7435c55
|
|
@ -3,7 +3,7 @@
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#define SPIRV 0
|
#define SPIRV 1
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
|
@ -266,27 +266,27 @@ int main()
|
||||||
float cameraSpeed = 2.f * updateClock.GetSeconds();
|
float cameraSpeed = 2.f * updateClock.GetSeconds();
|
||||||
updateClock.Restart();
|
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;
|
viewerPos += camQuat * Nz::Vector3f::Forward() * cameraSpeed;
|
||||||
|
|
||||||
// Si la flèche du bas ou la touche S est pressée, on recule
|
// 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;
|
viewerPos += camQuat * Nz::Vector3f::Backward() * cameraSpeed;
|
||||||
|
|
||||||
// Etc...
|
// 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;
|
viewerPos += camQuat * Nz::Vector3f::Left() * cameraSpeed;
|
||||||
|
|
||||||
// Etc...
|
// 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;
|
viewerPos += camQuat * Nz::Vector3f::Right() * cameraSpeed;
|
||||||
|
|
||||||
// Majuscule pour monter, notez l'utilisation d'une direction globale (Non-affectée par la rotation)
|
// 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;
|
viewerPos += Nz::Vector3f::Up() * cameraSpeed;
|
||||||
|
|
||||||
// Contrôle (Gauche ou droite) pour descendre dans l'espace global, etc...
|
// 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;
|
viewerPos += Nz::Vector3f::Down() * cameraSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,11 +26,11 @@ namespace Nz
|
||||||
public:
|
public:
|
||||||
inline RenderWindow();
|
inline RenderWindow();
|
||||||
inline RenderWindow(VideoMode mode, const String &title, WindowStyleFlags style = WindowStyle_Default, const RenderWindowParameters ¶meters = RenderWindowParameters());
|
inline RenderWindow(VideoMode mode, const String &title, WindowStyleFlags style = WindowStyle_Default, const RenderWindowParameters ¶meters = RenderWindowParameters());
|
||||||
inline explicit RenderWindow(void *handle, const RenderWindowParameters ¶meters = RenderWindowParameters());
|
inline explicit RenderWindow(void* handle, const RenderWindowParameters ¶meters = RenderWindowParameters());
|
||||||
inline ~RenderWindow();
|
inline ~RenderWindow();
|
||||||
|
|
||||||
inline bool Create(VideoMode mode, const String &title, WindowStyleFlags style = WindowStyle_Default, const RenderWindowParameters ¶meters = RenderWindowParameters());
|
inline bool Create(VideoMode mode, const String &title, WindowStyleFlags style = WindowStyle_Default, const RenderWindowParameters ¶meters = RenderWindowParameters());
|
||||||
inline bool Create(void *handle, const RenderWindowParameters ¶meters = RenderWindowParameters());
|
inline bool Create(void* handle, const RenderWindowParameters ¶meters = RenderWindowParameters());
|
||||||
|
|
||||||
void Display();
|
void Display();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ namespace Nz
|
||||||
Create(mode, title, style, parameters);
|
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);
|
ErrorFlags errFlags(ErrorFlag_ThrowException, true);
|
||||||
|
|
||||||
|
|
@ -39,7 +39,7 @@ namespace Nz
|
||||||
return Window::Create(mode, title, style);
|
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;
|
m_parameters = parameters;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,6 @@ namespace Nz
|
||||||
|
|
||||||
void DummySurface::Destroy()
|
void DummySurface::Destroy()
|
||||||
{
|
{
|
||||||
m_handle = nullptr;
|
m_handle = WindowHandle{};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,12 +29,21 @@ namespace Nz::GL
|
||||||
|
|
||||||
::ShowWindow(m_window.get(), FALSE);
|
::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)
|
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)
|
if (!m_deviceContext)
|
||||||
{
|
{
|
||||||
NazaraError("failed to retrieve window device context: " + Error::GetLastSystemError());
|
NazaraError("failed to retrieve window device context: " + Error::GetLastSystemError());
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ namespace Nz
|
||||||
bool CursorImpl::Create(const Image& cursor, int hotSpotX, int hotSpotY)
|
bool CursorImpl::Create(const Image& cursor, int hotSpotX, int hotSpotY)
|
||||||
{
|
{
|
||||||
m_iconImage = cursor;
|
m_iconImage = cursor;
|
||||||
if (!m_iconImage.Convert(PixelFormatType_BGRA8))
|
if (!m_iconImage.Convert(PixelFormat_BGRA8))
|
||||||
{
|
{
|
||||||
NazaraError("Failed to convert icon to BGRA8");
|
NazaraError("Failed to convert icon to BGRA8");
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ namespace Nz
|
||||||
bool IconImpl::Create(const Image& icon)
|
bool IconImpl::Create(const Image& icon)
|
||||||
{
|
{
|
||||||
m_iconImage = icon;
|
m_iconImage = icon;
|
||||||
if (!m_iconImage.Convert(PixelFormatType_BGRA8))
|
if (!m_iconImage.Convert(PixelFormat_BGRA8))
|
||||||
{
|
{
|
||||||
NazaraError("Failed to convert icon to BGRA8");
|
NazaraError("Failed to convert icon to BGRA8");
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,8 @@
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <Nazara/Core/ConditionVariable.hpp>
|
|
||||||
#include <Nazara/Core/Error.hpp>
|
#include <Nazara/Core/Error.hpp>
|
||||||
#include <Nazara/Core/ErrorFlags.hpp>
|
#include <Nazara/Core/ErrorFlags.hpp>
|
||||||
#include <Nazara/Core/Mutex.hpp>
|
|
||||||
#include <Nazara/Core/Thread.hpp>
|
|
||||||
#include <Nazara/Platform/Config.hpp>
|
#include <Nazara/Platform/Config.hpp>
|
||||||
#include <Nazara/Platform/Cursor.hpp>
|
#include <Nazara/Platform/Cursor.hpp>
|
||||||
#include <Nazara/Platform/Icon.hpp>
|
#include <Nazara/Platform/Icon.hpp>
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ namespace Nz
|
||||||
{
|
{
|
||||||
RendererImpl *rendererImpl = Renderer::GetRendererImpl();
|
RendererImpl *rendererImpl = Renderer::GetRendererImpl();
|
||||||
auto surface = rendererImpl->CreateRenderSurfaceImpl();
|
auto surface = rendererImpl->CreateRenderSurfaceImpl();
|
||||||
if (!surface->Create(GetHandle()))
|
if (!surface->Create(GetSystemHandle()))
|
||||||
{
|
{
|
||||||
NazaraError("Failed to create render surface: " + Error::GetLastError());
|
NazaraError("Failed to create render surface: " + Error::GetLastError());
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -49,26 +49,25 @@ namespace Nz
|
||||||
auto impl = rendererImpl->CreateRenderWindowImpl();
|
auto impl = rendererImpl->CreateRenderWindowImpl();
|
||||||
if (!impl->Create(rendererImpl, surface.get(), GetSize(), m_parameters))
|
if (!impl->Create(rendererImpl, surface.get(), GetSize(), m_parameters))
|
||||||
{
|
{
|
||||||
{
|
NazaraError("Failed to create render window implementation: " + Error::GetLastError());
|
||||||
NazaraError("Failed to create render window implementation: " + Error::GetLastError());
|
return false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_impl = std::move(impl);
|
|
||||||
m_surface = std::move(surface);
|
|
||||||
|
|
||||||
m_clock.Restart();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderWindow::OnWindowDestroy()
|
m_impl = std::move(impl);
|
||||||
{
|
m_surface = std::move(surface);
|
||||||
m_impl.reset();
|
|
||||||
m_surface.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
void RenderWindow::OnWindowResized()
|
m_clock.Restart();
|
||||||
{
|
|
||||||
}
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RenderWindow::OnWindowDestroy()
|
||||||
|
{
|
||||||
|
m_impl.reset();
|
||||||
|
m_surface.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
void RenderWindow::OnWindowResized()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -110,6 +110,7 @@ namespace Nz
|
||||||
|
|
||||||
chosenImpl = std::move(impl); //< Move (and delete previous) implementation before unloading library
|
chosenImpl = std::move(impl); //< Move (and delete previous) implementation before unloading library
|
||||||
chosenLib = std::move(implLib);
|
chosenLib = std::move(implLib);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!chosenImpl)
|
if (!chosenImpl)
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,9 @@ namespace Nz
|
||||||
bool success = false;
|
bool success = false;
|
||||||
#if defined(NAZARA_PLATFORM_WINDOWS)
|
#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));
|
HINSTANCE instance = reinterpret_cast<HINSTANCE>(GetWindowLongPtrW(winHandle, GWLP_HINSTANCE));
|
||||||
|
|
||||||
success = m_surface.Create(instance, winHandle);
|
success = m_surface.Create(instance, winHandle);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue