New module: Platform - Split window management from Utility module (#128)

* New module: Platform - Split window management from Utility module

Final touch

* NDK/SDK: Bring back initialization of Utility
This commit is contained in:
Gawaboumga
2017-08-30 10:22:50 +02:00
committed by Jérôme Leclercq
parent 41a1b5d493
commit 5aa072cee3
125 changed files with 1049 additions and 782 deletions

View File

@@ -173,7 +173,7 @@ namespace Nz
}
/*!
* \brief Uninitializes the Core module
* \brief Uninitializes the Graphics module
*
* \remark Produces a NazaraNotice
*/

View File

@@ -1,18 +1,18 @@
// Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Engine - Utility module"
// This file is part of the "Nazara Engine - Platform module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Utility/Cursor.hpp>
#include <Nazara/Platform/Cursor.hpp>
#if defined(NAZARA_PLATFORM_WINDOWS)
#include <Nazara/Utility/Win32/CursorImpl.hpp>
#include <Nazara/Platform/Win32/CursorImpl.hpp>
#elif defined(NAZARA_PLATFORM_X11)
#include <Nazara/Utility/X11/CursorImpl.hpp>
#include <Nazara/Platform/X11/CursorImpl.hpp>
#else
#error Lack of implementation: Cursor
#endif
#include <Nazara/Utility/Debug.hpp>
#include <Nazara/Platform/Debug.hpp>
namespace Nz
{

View File

@@ -0,0 +1,31 @@
// Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Engine - Platform module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Platform/Config.hpp>
#if NAZARA_PLATFORM_MANAGE_MEMORY
#include <Nazara/Core/MemoryManager.hpp>
#include <new> // Needed ?
void* operator new(std::size_t size)
{
return Nz::MemoryManager::Allocate(size, false);
}
void* operator new[](std::size_t size)
{
return Nz::MemoryManager::Allocate(size, true);
}
void operator delete(void* pointer) noexcept
{
Nz::MemoryManager::Free(pointer, false);
}
void operator delete[](void* pointer) noexcept
{
Nz::MemoryManager::Free(pointer, true);
}
#endif // NAZARA_PLATFORM_MANAGE_MEMORY

View File

@@ -1,18 +1,18 @@
// Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Engine - Utility module"
// This file is part of the "Nazara Engine - Platform module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Utility/Icon.hpp>
#include <Nazara/Platform/Icon.hpp>
#if defined(NAZARA_PLATFORM_WINDOWS)
#include <Nazara/Utility/Win32/IconImpl.hpp>
#include <Nazara/Platform/Win32/IconImpl.hpp>
#elif defined(NAZARA_PLATFORM_X11)
#include <Nazara/Utility/X11/IconImpl.hpp>
#include <Nazara/Platform/X11/IconImpl.hpp>
#else
#error Lack of implementation: Icon
#endif
#include <Nazara/Utility/Debug.hpp>
#include <Nazara/Platform/Debug.hpp>
namespace Nz
{

View File

@@ -1,18 +1,18 @@
// Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Engine - Utility module"
// This file is part of the "Nazara Engine - Platform module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Utility/Keyboard.hpp>
#include <Nazara/Platform/Keyboard.hpp>
#if defined(NAZARA_PLATFORM_WINDOWS)
#include <Nazara/Utility/Win32/InputImpl.hpp>
#include <Nazara/Platform/Win32/InputImpl.hpp>
#elif defined(NAZARA_PLATFORM_X11)
#include <Nazara/Utility/X11/InputImpl.hpp>
#include <Nazara/Platform/X11/InputImpl.hpp>
#else
#error Lack of implementation: Keyboard
#endif
#include <Nazara/Utility/Debug.hpp>
#include <Nazara/Platform/Debug.hpp>
namespace Nz
{

View File

@@ -1,19 +1,19 @@
// Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Engine - Utility module"
// This file is part of the "Nazara Engine - Platform module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Utility/Mouse.hpp>
#include <Nazara/Utility/Window.hpp>
#include <Nazara/Platform/Mouse.hpp>
#include <Nazara/Platform/Window.hpp>
#if defined(NAZARA_PLATFORM_WINDOWS)
#include <Nazara/Utility/Win32/InputImpl.hpp>
#include <Nazara/Platform/Win32/InputImpl.hpp>
#elif defined(NAZARA_PLATFORM_X11)
#include <Nazara/Utility/X11/InputImpl.hpp>
#include <Nazara/Platform/X11/InputImpl.hpp>
#else
#error Lack of implementation: Mouse
#endif
#include <Nazara/Utility/Debug.hpp>
#include <Nazara/Platform/Debug.hpp>
namespace Nz
{

View File

@@ -0,0 +1,108 @@
// Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Engine - Platform module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Platform/Platform.hpp>
#include <Nazara/Core/CallOnExit.hpp>
#include <Nazara/Platform/Config.hpp>
#include <Nazara/Platform/Cursor.hpp>
#include <Nazara/Platform/Window.hpp>
#include <Nazara/Utility/Utility.hpp>
#include <Nazara/Platform/Debug.hpp>
namespace Nz
{
/*!
* \ingroup system
* \class Nz::Platform
* \brief Platform class that represents the module initializer of Platform
*/
/*!
* \brief Initializes the Platform module
* \return true if initialization is successful
*
* \remark Produces a NazaraNotice
* \remark Produces a NazaraError if one submodule failed
*/
bool Platform::Initialize()
{
if (s_moduleReferenceCounter > 0)
{
s_moduleReferenceCounter++;
return true; // Already initialized
}
// Initialize module dependencies
if (!Utility::Initialize())
{
NazaraError("Failed to initialize utility module");
return false;
}
s_moduleReferenceCounter++;
// Initialisation of the module
CallOnExit onExit(Platform::Uninitialize);
if (!Window::Initialize())
{
NazaraError("Failed to initialize window's system");
return false;
}
// Must be initialized after Window
if (!Cursor::Initialize())
{
NazaraError("Failed to initialize cursors");
return false;
}
onExit.Reset();
NazaraNotice("Initialized: Platform module");
return true;
}
/*!
* \brief Checks whether the module is initialized
* \return true if module is initialized
*/
bool Platform::IsInitialized()
{
return s_moduleReferenceCounter != 0;
}
/*!
* \brief Uninitializes the Platform module
*
* \remark Produces a NazaraNotice
*/
void Platform::Uninitialize()
{
if (s_moduleReferenceCounter != 1)
{
// The module is still in use, or can not be uninitialized
if (s_moduleReferenceCounter > 1)
s_moduleReferenceCounter--;
return;
}
// Free of module
s_moduleReferenceCounter = 0;
Cursor::Uninitialize(); //< Must be done before Window
Window::Uninitialize();
NazaraNotice("Uninitialized: Platform module");
// Free of dependances
Utility::Uninitialize();
}
unsigned int Platform::s_moduleReferenceCounter = 0;
}

View File

@@ -1,20 +1,20 @@
// Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Engine - Utility module"
// This file is part of the "Nazara Engine - Platform module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Utility/VideoMode.hpp>
#include <Nazara/Platform/VideoMode.hpp>
#include <algorithm>
#include <functional>
#if defined(NAZARA_PLATFORM_WINDOWS)
#include <Nazara/Utility/Win32/VideoModeImpl.hpp>
#include <Nazara/Platform/Win32/VideoModeImpl.hpp>
#elif defined(NAZARA_PLATFORM_X11)
#include <Nazara/Utility/X11/VideoModeImpl.hpp>
#include <Nazara/Platform/X11/VideoModeImpl.hpp>
#else
#error Lack of implementation: Window
#endif
#include <Nazara/Utility/Debug.hpp>
#include <Nazara/Platform/Debug.hpp>
namespace Nz
{

View File

@@ -1,5 +1,5 @@
// Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Engine - Utility module"
// This file is part of the "Nazara Engine - Platform module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once

View File

@@ -1,12 +1,12 @@
// Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Engine - Utility module"
// This file is part of the "Nazara Engine - Platform module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Utility/Win32/CursorImpl.hpp>
#include <Nazara/Platform/Win32/CursorImpl.hpp>
#include <Nazara/Core/Error.hpp>
#include <Nazara/Utility/Image.hpp>
#include <Nazara/Utility/PixelFormat.hpp>
#include <Nazara/Utility/Debug.hpp>
#include <Nazara/Platform/Debug.hpp>
namespace Nz
{

View File

@@ -1,5 +1,5 @@
// Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Engine - Utility module"
// This file is part of the "Nazara Engine - Platform module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
@@ -8,7 +8,7 @@
#define NAZARA_CURSORIMPL_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Utility/Enums.hpp>
#include <Nazara/Platform/Enums.hpp>
#include <array>
#include <windows.h>

View File

@@ -1,11 +1,11 @@
// Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Engine - Utility module"
// This file is part of the "Nazara Engine - Platform module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Utility/Win32/IconImpl.hpp>
#include <Nazara/Platform/Win32/IconImpl.hpp>
#include <Nazara/Utility/Image.hpp>
#include <Nazara/Utility/PixelFormat.hpp>
#include <Nazara/Utility/Debug.hpp>
#include <Nazara/Platform/Debug.hpp>
namespace Nz
{

View File

@@ -1,5 +1,5 @@
// Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Engine - Utility module"
// This file is part of the "Nazara Engine - Platform module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once

View File

@@ -1,12 +1,12 @@
// Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Engine - Utility module"
// This file is part of the "Nazara Engine - Platform module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Utility/Win32/InputImpl.hpp>
#include <Nazara/Platform/Win32/InputImpl.hpp>
#include <Nazara/Core/Error.hpp>
#include <Nazara/Utility/Window.hpp>
#include <Nazara/Platform/Window.hpp>
#include <windows.h>
#include <Nazara/Utility/Debug.hpp>
#include <Nazara/Platform/Debug.hpp>
namespace Nz
{

View File

@@ -1,5 +1,5 @@
// Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Engine - Utility module"
// This file is part of the "Nazara Engine - Platform module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
@@ -9,8 +9,8 @@
#include <Nazara/Math/Vector2.hpp>
#include <Nazara/Core/String.hpp>
#include <Nazara/Utility/Keyboard.hpp>
#include <Nazara/Utility/Mouse.hpp>
#include <Nazara/Platform/Keyboard.hpp>
#include <Nazara/Platform/Mouse.hpp>
namespace Nz
{

View File

@@ -1,12 +1,12 @@
// Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Engine - Utility module"
// This file is part of the "Nazara Engine - Platform module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Utility/Win32/VideoModeImpl.hpp>
#include <Nazara/Utility/VideoMode.hpp>
#include <Nazara/Platform/Win32/VideoModeImpl.hpp>
#include <Nazara/Platform/VideoMode.hpp>
#include <algorithm>
#include <windows.h>
#include <Nazara/Utility/Debug.hpp>
#include <Nazara/Platform/Debug.hpp>
namespace Nz
{

View File

@@ -1,5 +1,5 @@
// Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Engine - Utility module"
// This file is part of the "Nazara Engine - Platform module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
@@ -7,7 +7,7 @@
#ifndef NAZARA_VIDEOMODEIMPL_HPP
#define NAZARA_VIDEOMODEIMPL_HPP
#include <Nazara/Utility/VideoMode.hpp>
#include <Nazara/Platform/VideoMode.hpp>
namespace Nz
{

View File

@@ -1,24 +1,24 @@
// Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Engine - Utility module"
// This file is part of the "Nazara Engine - Platform module"
// For conditions of distribution and use, see copyright notice in Config.hpp
// Un grand merci à Laurent Gomila pour la SFML qui m'aura bien aidé à réaliser cette implémentation
#include <Nazara/Utility/Win32/WindowImpl.hpp>
#include <Nazara/Platform/Win32/WindowImpl.hpp>
#include <Nazara/Core/ConditionVariable.hpp>
#include <Nazara/Core/Error.hpp>
#include <Nazara/Core/Mutex.hpp>
#include <Nazara/Core/Thread.hpp>
#include <Nazara/Utility/Config.hpp>
#include <Nazara/Utility/Cursor.hpp>
#include <Nazara/Platform/Config.hpp>
#include <Nazara/Platform/Cursor.hpp>
#include <Nazara/Platform/Icon.hpp>
#include <Nazara/Platform/Win32/CursorImpl.hpp>
#include <Nazara/Platform/Win32/IconImpl.hpp>
#include <Nazara/Utility/Image.hpp>
#include <Nazara/Utility/Icon.hpp>
#include <Nazara/Utility/Win32/CursorImpl.hpp>
#include <Nazara/Utility/Win32/IconImpl.hpp>
#include <cstdio>
#include <memory>
#include <windowsx.h>
#include <Nazara/Utility/Debug.hpp>
#include <Nazara/Platform/Debug.hpp>
#ifdef _WIN64
#define GCL_HCURSOR GCLP_HCURSOR
@@ -907,7 +907,7 @@ namespace Nz
}
}
#if NAZARA_UTILITY_WINDOWS_DISABLE_MENU_KEYS
#if NAZARA_PLATFORM_WINDOWS_DISABLE_MENU_KEYS
// http://msdn.microsoft.com/en-us/library/windows/desktop/ms646360(v=vs.85).aspx
if (message == WM_SYSCOMMAND && wParam == SC_KEYMENU)
return true;

View File

@@ -1,5 +1,5 @@
// Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Engine - Utility module"
// This file is part of the "Nazara Engine - Platform module"
// For conditions of distribution and use, see copyright notice in Config.hpp
// Interface inspirée de la SFML par Laurent Gomila
@@ -14,11 +14,11 @@
#include <Nazara/Core/Thread.hpp>
#include <Nazara/Math/Rect.hpp>
#include <Nazara/Math/Vector2.hpp>
#include <Nazara/Utility/Config.hpp>
#include <Nazara/Utility/Keyboard.hpp>
#include <Nazara/Utility/Mouse.hpp>
#include <Nazara/Utility/VideoMode.hpp>
#include <Nazara/Utility/Window.hpp>
#include <Nazara/Platform/Config.hpp>
#include <Nazara/Platform/Keyboard.hpp>
#include <Nazara/Platform/Mouse.hpp>
#include <Nazara/Platform/VideoMode.hpp>
#include <Nazara/Platform/Window.hpp>
#include <windows.h>
namespace Nz

View File

@@ -1,26 +1,26 @@
// Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Engine - Utility module"
// This file is part of the "Nazara Engine - Platform module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Utility/Window.hpp>
#include <Nazara/Platform/Window.hpp>
#include <Nazara/Core/CallOnExit.hpp>
#include <Nazara/Core/Error.hpp>
#include <Nazara/Core/ErrorFlags.hpp>
#include <Nazara/Core/LockGuard.hpp>
#include <Nazara/Utility/Cursor.hpp>
#include <Nazara/Platform/Cursor.hpp>
#include <Nazara/Platform/Icon.hpp>
#include <Nazara/Utility/Image.hpp>
#include <Nazara/Utility/Icon.hpp>
#include <stdexcept>
#if defined(NAZARA_PLATFORM_WINDOWS)
#include <Nazara/Utility/Win32/WindowImpl.hpp>
#include <Nazara/Platform/Win32/WindowImpl.hpp>
#elif defined(NAZARA_PLATFORM_X11)
#include <Nazara/Utility/X11/WindowImpl.hpp>
#include <Nazara/Platform/X11/WindowImpl.hpp>
#else
#error Lack of implementation: Window
#endif
#include <Nazara/Utility/Debug.hpp>
#include <Nazara/Platform/Debug.hpp>
namespace Nz
{
@@ -50,7 +50,7 @@ namespace Nz
bool Window::Create(VideoMode mode, const String& title, WindowStyleFlags style)
{
// Si la fenêtre est déjà ouverte, nous conservons sa position
// If the window is already open, we keep its position
bool opened = IsOpen();
Vector2i position;
if (opened)
@@ -58,7 +58,7 @@ namespace Nz
Destroy();
// Inspiré du code de la SFML par Laurent Gomila
// Inspired by the code of the SFML by Laurent Gomila (and its team)
if (style & WindowStyle_Fullscreen)
{
if (fullscreenWindow)
@@ -101,7 +101,7 @@ namespace Nz
return false;
}
// Paramètres par défaut
// Default parameters
m_impl->EnableKeyRepeat(true);
m_impl->EnableSmoothScrolling(false);
m_impl->SetMaximumSize(-1, -1);
@@ -169,7 +169,7 @@ namespace Nz
void Window::EnableKeyRepeat(bool enable)
{
#if NAZARA_UTILITY_SAFE
#if NAZARA_PLATFORM_SAFE
if (!m_impl)
{
NazaraError("Window not created");
@@ -182,7 +182,7 @@ namespace Nz
void Window::EnableSmoothScrolling(bool enable)
{
#if NAZARA_UTILITY_SAFE
#if NAZARA_PLATFORM_SAFE
if (!m_impl)
{
NazaraError("Window not created");
@@ -195,7 +195,7 @@ namespace Nz
WindowHandle Window::GetHandle() const
{
#if NAZARA_UTILITY_SAFE
#if NAZARA_PLATFORM_SAFE
if (!m_impl)
{
NazaraError("Window not created");
@@ -208,7 +208,7 @@ namespace Nz
unsigned int Window::GetHeight() const
{
#if NAZARA_UTILITY_SAFE
#if NAZARA_PLATFORM_SAFE
if (!m_impl)
{
NazaraError("Window not created");
@@ -221,7 +221,7 @@ namespace Nz
Vector2i Window::GetPosition() const
{
#if NAZARA_UTILITY_SAFE
#if NAZARA_PLATFORM_SAFE
if (!m_impl)
{
NazaraError("Window not created");
@@ -234,7 +234,7 @@ namespace Nz
Vector2ui Window::GetSize() const
{
#if NAZARA_UTILITY_SAFE
#if NAZARA_PLATFORM_SAFE
if (!m_impl)
{
NazaraError("Window not created");
@@ -247,7 +247,7 @@ namespace Nz
WindowStyleFlags Window::GetStyle() const
{
#if NAZARA_UTILITY_SAFE
#if NAZARA_PLATFORM_SAFE
if (!m_impl)
{
NazaraError("Window not created");
@@ -260,7 +260,7 @@ namespace Nz
String Window::GetTitle() const
{
#if NAZARA_UTILITY_SAFE
#if NAZARA_PLATFORM_SAFE
if (!m_impl)
{
NazaraError("Window not created");
@@ -273,7 +273,7 @@ namespace Nz
unsigned int Window::GetWidth() const
{
#if NAZARA_UTILITY_SAFE
#if NAZARA_PLATFORM_SAFE
if (!m_impl)
{
NazaraError("Window not created");
@@ -286,7 +286,7 @@ namespace Nz
bool Window::HasFocus() const
{
#if NAZARA_UTILITY_SAFE
#if NAZARA_PLATFORM_SAFE
if (!m_impl)
{
NazaraError("Window not created");
@@ -299,7 +299,7 @@ namespace Nz
bool Window::IsMinimized() const
{
#if NAZARA_UTILITY_SAFE
#if NAZARA_PLATFORM_SAFE
if (!m_impl)
{
NazaraError("Window not created");
@@ -312,7 +312,7 @@ namespace Nz
bool Window::IsVisible() const
{
#if NAZARA_UTILITY_SAFE
#if NAZARA_PLATFORM_SAFE
if (!m_impl)
{
NazaraError("Window not created");
@@ -325,7 +325,7 @@ namespace Nz
bool Window::PollEvent(WindowEvent* event)
{
#if NAZARA_UTILITY_SAFE
#if NAZARA_PLATFORM_SAFE
if (!m_impl)
{
NazaraError("Window not created");
@@ -378,7 +378,7 @@ namespace Nz
void Window::SetEventListener(bool listener)
{
#if NAZARA_UTILITY_SAFE
#if NAZARA_PLATFORM_SAFE
if (!m_impl)
{
NazaraError("Window not created");
@@ -397,7 +397,7 @@ namespace Nz
void Window::SetFocus()
{
#if NAZARA_UTILITY_SAFE
#if NAZARA_PLATFORM_SAFE
if (!m_impl)
{
NazaraError("Window not created");
@@ -419,7 +419,7 @@ namespace Nz
void Window::SetMaximumSize(const Vector2i& maxSize)
{
#if NAZARA_UTILITY_SAFE
#if NAZARA_PLATFORM_SAFE
if (!m_impl)
{
NazaraError("Window not created");
@@ -432,7 +432,7 @@ namespace Nz
void Window::SetMaximumSize(int width, int height)
{
#if NAZARA_UTILITY_SAFE
#if NAZARA_PLATFORM_SAFE
if (!m_impl)
{
NazaraError("Window not created");
@@ -445,7 +445,7 @@ namespace Nz
void Window::SetMinimumSize(const Vector2i& minSize)
{
#if NAZARA_UTILITY_SAFE
#if NAZARA_PLATFORM_SAFE
if (!m_impl)
{
NazaraError("Window not created");
@@ -458,7 +458,7 @@ namespace Nz
void Window::SetMinimumSize(int width, int height)
{
#if NAZARA_UTILITY_SAFE
#if NAZARA_PLATFORM_SAFE
if (!m_impl)
{
NazaraError("Window not created");
@@ -471,7 +471,7 @@ namespace Nz
void Window::SetPosition(const Vector2i& position)
{
#if NAZARA_UTILITY_SAFE
#if NAZARA_PLATFORM_SAFE
if (!m_impl)
{
NazaraError("Window not created");
@@ -484,7 +484,7 @@ namespace Nz
void Window::SetPosition(int x, int y)
{
#if NAZARA_UTILITY_SAFE
#if NAZARA_PLATFORM_SAFE
if (!m_impl)
{
NazaraError("Window not created");
@@ -497,7 +497,7 @@ namespace Nz
void Window::SetSize(const Vector2i& size)
{
#if NAZARA_UTILITY_SAFE
#if NAZARA_PLATFORM_SAFE
if (!m_impl)
{
NazaraError("Window not created");
@@ -510,7 +510,7 @@ namespace Nz
void Window::SetSize(unsigned int width, unsigned int height)
{
#if NAZARA_UTILITY_SAFE
#if NAZARA_PLATFORM_SAFE
if (!m_impl)
{
NazaraError("Window not created");
@@ -523,7 +523,7 @@ namespace Nz
void Window::SetStayOnTop(bool stayOnTop)
{
#if NAZARA_UTILITY_SAFE
#if NAZARA_PLATFORM_SAFE
if (!m_impl)
{
NazaraError("Window not created");
@@ -536,7 +536,7 @@ namespace Nz
void Window::SetTitle(const String& title)
{
#if NAZARA_UTILITY_SAFE
#if NAZARA_PLATFORM_SAFE
if (!m_impl)
{
NazaraError("Window not created");
@@ -549,7 +549,7 @@ namespace Nz
void Window::SetVisible(bool visible)
{
#if NAZARA_UTILITY_SAFE
#if NAZARA_PLATFORM_SAFE
if (!m_impl)
{
NazaraError("Window not created");
@@ -562,7 +562,7 @@ namespace Nz
bool Window::WaitEvent(WindowEvent* event)
{
#if NAZARA_UTILITY_SAFE
#if NAZARA_PLATFORM_SAFE
if (!m_impl)
{
NazaraError("Window not created");
@@ -626,7 +626,7 @@ namespace Nz
void Window::IgnoreNextMouseEvent(int mouseX, int mouseY) const
{
#if NAZARA_UTILITY_SAFE
#if NAZARA_PLATFORM_SAFE
if (!m_impl)
{
NazaraError("Window not created");

View File

@@ -1,13 +1,13 @@
// Copyright (C) 2015 Jérôme Leclercq
// This file is part of the "Nazara Engine - Utility module"
// This file is part of the "Nazara Engine - Platform module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Utility/X11/CursorImpl.hpp>
#include <Nazara/Platform/X11/CursorImpl.hpp>
#include <Nazara/Core/CallOnExit.hpp>
#include <Nazara/Core/Error.hpp>
#include <Nazara/Utility/Image.hpp>
#include <Nazara/Utility/PixelFormat.hpp>
#include <Nazara/Utility/X11/Display.hpp>
#include <Nazara/Platform/X11/Display.hpp>
#include <xcb/xcb_image.h>
// Some older versions of xcb/util-renderutil (notably the one available on Travis CI) use `template` as an argument name
@@ -20,7 +20,7 @@ extern "C"
}
#undef template
#include <Nazara/Utility/Debug.hpp>
#include <Nazara/Platform/Debug.hpp>
namespace Nz
{

View File

@@ -1,5 +1,5 @@
// Copyright (C) 2015 Jérôme Leclercq
// This file is part of the "Nazara Engine - Utility module"
// This file is part of the "Nazara Engine - Platform module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
@@ -8,7 +8,7 @@
#define NAZARA_CURSORIMPL_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Utility/Enums.hpp>
#include <Nazara/Platform/Enums.hpp>
#include <xcb/xcb_cursor.h>
#include <array>

View File

@@ -1,14 +1,14 @@
// Copyright (C) 2015 Jérôme Leclercq
// This file is part of the "Nazara Engine - Utility module"
// This file is part of the "Nazara Engine - Platform module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Utility/X11/Display.hpp>
#include <Nazara/Platform/X11/Display.hpp>
#include <Nazara/Core/Error.hpp>
#include <Nazara/Core/Log.hpp>
#include <Nazara/Core/String.hpp>
#include <xcb/xcb_keysyms.h>
#include <map>
#include <Nazara/Utility/Debug.hpp>
#include <Nazara/Platform/Debug.hpp>
namespace Nz
{

View File

@@ -1,5 +1,5 @@
// Copyright (C) 2015 Jérôme Leclercq
// This file is part of the "Nazara Engine - Utility module"
// This file is part of the "Nazara Engine - Platform module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
@@ -8,8 +8,8 @@
#define NAZARA_X11DISPLAY_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Utility/WindowHandle.hpp>
#include <Nazara/Utility/X11/ScopedXCB.hpp>
#include <Nazara/Platform/WindowHandle.hpp>
#include <Nazara/Platform/X11/ScopedXCB.hpp>
typedef struct _XCBKeySymbols xcb_key_symbols_t;
@@ -17,7 +17,7 @@ namespace Nz
{
class String;
class NAZARA_UTILITY_API X11
class NAZARA_PLATFORM_API X11
{
public:
X11() = delete;

View File

@@ -1,14 +1,14 @@
// Copyright (C) 2015 Jérôme Leclercq
// This file is part of the "Nazara Engine - Utility module"
// This file is part of the "Nazara Engine - Platform module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Utility/X11/IconImpl.hpp>
#include <Nazara/Platform/X11/IconImpl.hpp>
#include <Nazara/Core/CallOnExit.hpp>
#include <Nazara/Core/Error.hpp>
#include <Nazara/Utility/Image.hpp>
#include <Nazara/Utility/PixelFormat.hpp>
#include <Nazara/Utility/X11/Display.hpp>
#include <Nazara/Utility/Debug.hpp>
#include <Nazara/Platform/X11/Display.hpp>
#include <Nazara/Platform/Debug.hpp>
namespace Nz
{

View File

@@ -1,5 +1,5 @@
// Copyright (C) 2015 Jérôme Leclercq
// This file is part of the "Nazara Engine - Utility module"
// This file is part of the "Nazara Engine - Platform module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
@@ -8,7 +8,7 @@
#define NAZARA_ICONIMPL_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Utility/X11/ScopedXCB.hpp>
#include <Nazara/Platform/X11/ScopedXCB.hpp>
namespace Nz
{

View File

@@ -1,16 +1,16 @@
// Copyright (C) 2015 Jérôme Leclercq
// This file is part of the "Nazara Engine - Utility module"
// This file is part of the "Nazara Engine - Platform module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Utility/X11/InputImpl.hpp>
#include <Nazara/Platform/X11/InputImpl.hpp>
#include <Nazara/Core/Error.hpp>
#include <Nazara/Utility/Window.hpp>
#include <Nazara/Utility/X11/Display.hpp>
#include <Nazara/Platform/Window.hpp>
#include <Nazara/Platform/X11/Display.hpp>
#include <X11/keysym.h>
#include <X11/XF86keysym.h>
#include <X11/Xlib.h>
#include <xcb/xcb_keysyms.h>
#include <Nazara/Utility/Debug.hpp>
#include <Nazara/Platform/Debug.hpp>
namespace Nz
{

View File

@@ -1,5 +1,5 @@
// Copyright (C) 2015 Jérôme Leclercq
// This file is part of the "Nazara Engine - Utility module"
// This file is part of the "Nazara Engine - Platform module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
@@ -10,8 +10,8 @@
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/String.hpp>
#include <Nazara/Math/Vector2.hpp>
#include <Nazara/Utility/Keyboard.hpp>
#include <Nazara/Utility/Mouse.hpp>
#include <Nazara/Platform/Keyboard.hpp>
#include <Nazara/Platform/Mouse.hpp>
namespace Nz
{

View File

@@ -1,12 +1,12 @@
// Copyright (C) 2015 Jérôme Leclercq
// This file is part of the "Nazara Engine - Utility module"
// This file is part of the "Nazara Engine - Platform module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Utility/X11/ScopedXCB.hpp>
#include <Nazara/Platform/X11/ScopedXCB.hpp>
#include <Nazara/Core/Error.hpp>
#include <Nazara/Utility/X11/Display.hpp>
#include <Nazara/Platform/X11/Display.hpp>
#include <xcb/xcb_image.h>
#include <Nazara/Utility/Debug.hpp>
#include <Nazara/Platform/Debug.hpp>
namespace Nz
{

View File

@@ -1,5 +1,5 @@
// Copyright (C) 2015 Jérôme Leclercq
// This file is part of the "Nazara Engine - Utility module"
// This file is part of the "Nazara Engine - Platform module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
@@ -95,6 +95,6 @@ namespace Nz
};
}
#include <Nazara/Utility/X11/ScopedXCB.inl>
#include <Nazara/Platform/X11/ScopedXCB.inl>
#endif // NAZARA_SCOPEDXCB_HPP

View File

@@ -1,9 +1,9 @@
// Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Engine - Utility module"
// 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/Error.hpp>
#include <Nazara/Utility/Debug.hpp>
#include <Nazara/Platform/Debug.hpp>
namespace Nz
{
@@ -44,4 +44,4 @@ namespace Nz
}
}
#include <Nazara/Utility/DebugOff.hpp>
#include <Nazara/Platform/DebugOff.hpp>

View File

@@ -1,14 +1,14 @@
// Copyright (C) 2015 Jérôme Leclercq
// This file is part of the "Nazara Engine - Utility module"
// This file is part of the "Nazara Engine - Platform module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Utility/X11/VideoModeImpl.hpp>
#include <Nazara/Platform/X11/VideoModeImpl.hpp>
#include <Nazara/Core/Error.hpp>
#include <Nazara/Utility/VideoMode.hpp>
#include <Nazara/Utility/X11/Display.hpp>
#include <Nazara/Platform/VideoMode.hpp>
#include <Nazara/Platform/X11/Display.hpp>
#include <xcb/randr.h>
#include <algorithm>
#include <Nazara/Utility/Debug.hpp>
#include <Nazara/Platform/Debug.hpp>
namespace Nz
{

View File

@@ -1,5 +1,5 @@
// Copyright (C) 2015 Jérôme Leclercq
// This file is part of the "Nazara Engine - Utility module"
// This file is part of the "Nazara Engine - Platform module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
@@ -8,7 +8,7 @@
#define NAZARA_VIDEOMODEIMPL_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Utility/VideoMode.hpp>
#include <Nazara/Platform/VideoMode.hpp>
namespace Nz
{

View File

@@ -1,26 +1,26 @@
// Copyright (C) 2015 Jérôme Leclercq
// This file is part of the "Nazara Engine - Utility module"
// This file is part of the "Nazara Engine - Platform module"
// For conditions of distribution and use, see copyright notice in Config.hpp
// Un grand merci à Laurent Gomila pour la SFML qui m'aura bien aidé à réaliser cette implémentation
#include <Nazara/Utility/X11/WindowImpl.hpp>
#include <Nazara/Platform/X11/WindowImpl.hpp>
#include <Nazara/Core/CallOnExit.hpp>
#include <Nazara/Core/Error.hpp>
#include <Nazara/Utility/Cursor.hpp>
#include <Nazara/Utility/Event.hpp>
#include <Nazara/Utility/Icon.hpp>
#include <Nazara/Utility/VideoMode.hpp>
#include <Nazara/Utility/Window.hpp>
#include <Nazara/Utility/X11/CursorImpl.hpp>
#include <Nazara/Utility/X11/IconImpl.hpp>
#include <Nazara/Platform/Cursor.hpp>
#include <Nazara/Platform/Event.hpp>
#include <Nazara/Platform/Icon.hpp>
#include <Nazara/Platform/VideoMode.hpp>
#include <Nazara/Platform/Window.hpp>
#include <Nazara/Platform/X11/CursorImpl.hpp>
#include <Nazara/Platform/X11/IconImpl.hpp>
#include <X11/keysym.h>
#include <X11/XF86keysym.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <xcb/xcb_cursor.h>
#include <xcb/xcb_keysyms.h>
#include <Nazara/Utility/Debug.hpp>
#include <Nazara/Platform/Debug.hpp>
/*
Things to do left:

View File

@@ -1,5 +1,5 @@
// Copyright (C) 2015 Jérôme Leclercq
// This file is part of the "Nazara Engine - Utility module"
// This file is part of the "Nazara Engine - Platform module"
// For conditions of distribution and use, see copyright notice in Config.hpp
// Interface inspirée de la SFML par Laurent Gomila
@@ -12,9 +12,9 @@
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/Thread.hpp>
#include <Nazara/Math/Vector2.hpp>
#include <Nazara/Utility/Enums.hpp>
#include <Nazara/Utility/Keyboard.hpp>
#include <Nazara/Utility/X11/Display.hpp>
#include <Nazara/Platform/Enums.hpp>
#include <Nazara/Platform/Keyboard.hpp>
#include <Nazara/Platform/X11/Display.hpp>
#include <xcb/randr.h>
#include <xcb/xcb_icccm.h>

View File

@@ -10,7 +10,7 @@
#include <Nazara/Renderer/Context.hpp>
#include <Nazara/Renderer/RenderTarget.hpp>
#if defined(NAZARA_PLATFORM_GLX)
#include <Nazara/Utility/X11/Display.hpp>
#include <Nazara/Platform/X11/Display.hpp>
#endif // NAZARA_PLATFORM_GLX
#include <cstring>
#include <set>

View File

@@ -25,6 +25,7 @@
#include <Nazara/Utility/Utility.hpp>
#include <Nazara/Utility/VertexBuffer.hpp>
#include <Nazara/Utility/VertexDeclaration.hpp>
#include <Nazara/Platform/Platform.hpp>
#include <map>
#include <memory>
#include <set>
@@ -579,9 +580,9 @@ namespace Nz
}
// Initialisation des dépendances
if (!Utility::Initialize())
if (!Platform::Initialize())
{
NazaraError("Failed to initialize Utility module");
NazaraError("Failed to initialize Platform module");
return false;
}
@@ -1402,7 +1403,7 @@ namespace Nz
NazaraNotice("Uninitialized: Renderer module");
// Libération des dépendances
Utility::Uninitialize();
Platform::Uninitialize();
}
void Renderer::EnableInstancing(bool instancing)

View File

@@ -6,21 +6,15 @@
#include <Nazara/Core/CallOnExit.hpp>
#include <Nazara/Core/Core.hpp>
#include <Nazara/Core/Error.hpp>
#include <Nazara/Core/HardwareInfo.hpp>
#include <Nazara/Core/Log.hpp>
#include <Nazara/Core/TaskScheduler.hpp>
#include <Nazara/Core/Thread.hpp>
#include <Nazara/Utility/Animation.hpp>
#include <Nazara/Utility/Buffer.hpp>
#include <Nazara/Utility/Config.hpp>
#include <Nazara/Utility/Cursor.hpp>
#include <Nazara/Utility/Font.hpp>
#include <Nazara/Utility/Image.hpp>
#include <Nazara/Utility/Mesh.hpp>
#include <Nazara/Utility/PixelFormat.hpp>
#include <Nazara/Utility/Skeleton.hpp>
#include <Nazara/Utility/VertexDeclaration.hpp>
#include <Nazara/Utility/Window.hpp>
#include <Nazara/Utility/Formats/DDSLoader.hpp>
#include <Nazara/Utility/Formats/FreeTypeLoader.hpp>
#include <Nazara/Utility/Formats/MD2Loader.hpp>
@@ -35,15 +29,29 @@
namespace Nz
{
/*!
* \ingroup utility
* \class Nz::Utility
* \brief Utility class that represents the module initializer of Utility
*/
/*!
* \brief Initializes the Utility module
* \return true if initialization is successful
*
* \remark Produces a NazaraNotice
* \remark Produces a NazaraError if one submodule failed
*/
bool Utility::Initialize()
{
if (s_moduleReferenceCounter > 0)
{
s_moduleReferenceCounter++;
return true; // Déjà initiali
return true; // Already initialized
}
// Initialisation des dépendances
// Initialisation of dependencies
if (!Core::Initialize())
{
NazaraError("Failed to initialize core module");
@@ -103,23 +111,6 @@ namespace Nz
return false;
}
bool bParam;
if (!s_initializationParameters.GetBooleanParameter("NoWindowSystem", &bParam) || !bParam)
{
if (!Window::Initialize())
{
NazaraError("Failed to initialize window's system");
return false;
}
// Must be initialized after Window
if (!Cursor::Initialize())
{
NazaraError("Failed to initialize cursors");
return false;
}
}
// On enregistre les loaders pour les extensions
// Il s'agit ici d'une liste LIFO, le dernier loader enregistré possède la priorité
@@ -159,11 +150,6 @@ namespace Nz
return s_moduleReferenceCounter != 0;
}
void Utility::SetParameters(const ParameterList& parameters)
{
s_initializationParameters = parameters;
}
void Utility::Uninitialize()
{
if (s_moduleReferenceCounter != 1)
@@ -188,9 +174,6 @@ namespace Nz
Loaders::UnregisterSTBLoader();
Loaders::UnregisterSTBSaver();
Cursor::Uninitialize(); //< Must be done before Window
Window::Uninitialize();
VertexDeclaration::Uninitialize();
Skeleton::Uninitialize();
PixelFormat::Uninitialize();
@@ -246,6 +229,5 @@ namespace Nz
static_assert(ComponentType_Max+1 == 14, "Component stride array is incomplete");
ParameterList Utility::s_initializationParameters;
unsigned int Utility::s_moduleReferenceCounter = 0;
}