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
126 changed files with 1068 additions and 801 deletions

View File

@ -27,17 +27,17 @@
#ifndef NAZARA_CONFIG_MODULENAME_HPP #ifndef NAZARA_CONFIG_MODULENAME_HPP
#define NAZARA_CONFIG_MODULENAME_HPP #define NAZARA_CONFIG_MODULENAME_HPP
/// Chaque modification d'un paramètre du module nécessite une recompilation de celui-ci /// Each modification of a parameter needs a recompilation of the module
// Utilise le MemoryManager pour gérer les allocations dynamiques (détecte les leaks au prix d'allocations/libérations dynamiques plus lentes) // Use the MemoryManager to manage dynamic allocations (can detect memory leak but allocations/frees are slower)
#define NAZARA_MODULENAME_MANAGE_MEMORY 0 #define NAZARA_MODULENAME_MANAGE_MEMORY 0
// Active les tests de sécurité basés sur le code (Conseillé pour le développement) // Activate the security tests based on the code (Advised for development)
#define NAZARA_MODULENAME_SAFE 1 #define NAZARA_MODULENAME_SAFE 1
/// Chaque modification d'un paramètre ci-dessous implique une modification (souvent mineure) du code /// Each modification of a parameter following implies a modification (often minor) of the code
/// Vérification des valeurs et types de certaines constantes /// Checking the values and types of certain constants
#include <Nazara/ModuleName/ConfigCheck.hpp> #include <Nazara/ModuleName/ConfigCheck.hpp>
#if !defined(NAZARA_STATIC) #if !defined(NAZARA_STATIC)

View File

@ -7,13 +7,13 @@
#ifndef NAZARA_CONFIG_CHECK_MODULENAME_HPP #ifndef NAZARA_CONFIG_CHECK_MODULENAME_HPP
#define NAZARA_CONFIG_CHECK_MODULENAME_HPP #define NAZARA_CONFIG_CHECK_MODULENAME_HPP
/// Ce fichier sert à vérifier la valeur des constantes du fichier Config.hpp /// This file is used to check the constant values defined in Config.hpp
#include <type_traits> #include <type_traits>
#define CheckType(name, type, err) static_assert(std::is_ ##type <decltype(name)>::value, #type err) #define CheckType(name, type, err) static_assert(std::is_ ##type <decltype(name)>::value, #type err)
#define CheckTypeAndVal(name, type, op, val, err) static_assert(std::is_ ##type <decltype(name)>::value && name op val, #type err) #define CheckTypeAndVal(name, type, op, val, err) static_assert(std::is_ ##type <decltype(name)>::value && name op val, #type err)
// On force la valeur de MANAGE_MEMORY en mode debug // We force the value of MANAGE_MEMORY in debug
#if defined(NAZARA_DEBUG) && !NAZARA_MODULENAME_MANAGE_MEMORY #if defined(NAZARA_DEBUG) && !NAZARA_MODULENAME_MANAGE_MEMORY
#undef NAZARA_MODULENAME_MANAGE_MEMORY #undef NAZARA_MODULENAME_MANAGE_MEMORY
#define NAZARA_MODULENAME_MANAGE_MEMORY 0 #define NAZARA_MODULENAME_MANAGE_MEMORY 0

View File

@ -2,7 +2,7 @@
// This file is part of the "Nazara Engine - Module name" // This file is part of the "Nazara Engine - Module name"
// For conditions of distribution and use, see copyright notice in Config.hpp // For conditions of distribution and use, see copyright notice in Config.hpp
// On suppose que Debug.hpp a déjà été inclus, tout comme Config.hpp // We suppose that Debug.hpp is already included, same goes for Config.hpp
#if NAZARA_MODULENAME_MANAGE_MEMORY #if NAZARA_MODULENAME_MANAGE_MEMORY
#undef delete #undef delete
#undef new #undef new

View File

@ -22,7 +22,7 @@
#include <Nazara/Lua/LuaInstance.hpp> #include <Nazara/Lua/LuaInstance.hpp>
#include <Nazara/Graphics/TextSprite.hpp> #include <Nazara/Graphics/TextSprite.hpp>
#include <Nazara/Renderer/RenderTarget.hpp> #include <Nazara/Renderer/RenderTarget.hpp>
#include <Nazara/Utility/Window.hpp> #include <Nazara/Platform/Window.hpp>
#endif #endif
namespace Ndk namespace Ndk

View File

@ -12,9 +12,9 @@
#include <NDK/EntityOwner.hpp> #include <NDK/EntityOwner.hpp>
#include <NDK/World.hpp> #include <NDK/World.hpp>
#include <Nazara/Graphics/Sprite.hpp> #include <Nazara/Graphics/Sprite.hpp>
#include <Nazara/Utility/Cursor.hpp> #include <Nazara/Platform/Cursor.hpp>
#include <Nazara/Utility/Event.hpp> #include <Nazara/Platform/Event.hpp>
#include <Nazara/Utility/Mouse.hpp> #include <Nazara/Platform/Mouse.hpp>
#include <Nazara/Utility/Node.hpp> #include <Nazara/Utility/Node.hpp>
#include <limits> #include <limits>

View File

@ -9,8 +9,8 @@
#include <NDK/Prerequesites.hpp> #include <NDK/Prerequesites.hpp>
#include <NDK/BaseWidget.hpp> #include <NDK/BaseWidget.hpp>
#include <Nazara/Utility/CursorController.hpp> #include <Nazara/Platform/CursorController.hpp>
#include <Nazara/Utility/EventHandler.hpp> #include <Nazara/Platform/EventHandler.hpp>
namespace Ndk namespace Ndk
{ {

View File

@ -3,7 +3,7 @@
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp // For conditions of distribution and use, see copyright notice in Prerequesites.hpp
#include <NDK/Canvas.hpp> #include <NDK/Canvas.hpp>
#include <Nazara/Utility/Cursor.hpp> #include <Nazara/Platform/Cursor.hpp>
namespace Ndk namespace Ndk
{ {

View File

@ -12,7 +12,7 @@
#include <Nazara/Core/ObjectHandle.hpp> #include <Nazara/Core/ObjectHandle.hpp>
#include <Nazara/Graphics/Sprite.hpp> #include <Nazara/Graphics/Sprite.hpp>
#include <Nazara/Graphics/TextSprite.hpp> #include <Nazara/Graphics/TextSprite.hpp>
#include <Nazara/Utility/Event.hpp> #include <Nazara/Platform/Event.hpp>
#include <Nazara/Utility/Node.hpp> #include <Nazara/Utility/Node.hpp>
#include <Nazara/Utility/SimpleTextDrawer.hpp> #include <Nazara/Utility/SimpleTextDrawer.hpp>
#include <NDK/EntityOwner.hpp> #include <NDK/EntityOwner.hpp>

View File

@ -36,6 +36,7 @@ namespace Ndk
std::unique_ptr<LuaBinding_Base> audio; std::unique_ptr<LuaBinding_Base> audio;
std::unique_ptr<LuaBinding_Base> graphics; std::unique_ptr<LuaBinding_Base> graphics;
std::unique_ptr<LuaBinding_Base> renderer; std::unique_ptr<LuaBinding_Base> renderer;
std::unique_ptr<LuaBinding_Base> platform;
#endif #endif
private: private:

View File

@ -23,6 +23,7 @@ namespace Ndk
class LuaBinding_Renderer; class LuaBinding_Renderer;
class LuaBinding_SDK; class LuaBinding_SDK;
class LuaBinding_Utility; class LuaBinding_Utility;
class LuaBinding_Platform;
class NDK_API LuaBinding_Base class NDK_API LuaBinding_Base
{ {
@ -43,6 +44,7 @@ namespace Ndk
static std::unique_ptr<LuaBinding_Base> BindAudio(LuaBinding& binding); static std::unique_ptr<LuaBinding_Base> BindAudio(LuaBinding& binding);
static std::unique_ptr<LuaBinding_Base> BindGraphics(LuaBinding& binding); static std::unique_ptr<LuaBinding_Base> BindGraphics(LuaBinding& binding);
static std::unique_ptr<LuaBinding_Base> BindRenderer(LuaBinding& binding); static std::unique_ptr<LuaBinding_Base> BindRenderer(LuaBinding& binding);
static std::unique_ptr<LuaBinding_Base> BindPlatform(LuaBinding& binding);
#endif #endif
protected: protected:

View File

@ -0,0 +1,28 @@
// Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp
#pragma once
#ifndef NDK_LUABINDING_SYSTEM_HPP
#define NDK_LUABINDING_SYSTEM_HPP
#include <Nazara/Platform/Keyboard.hpp>
#include <NDK/Lua/LuaBinding_Base.hpp>
namespace Ndk
{
class NDK_API LuaBinding_Platform : public LuaBinding_Base
{
public:
LuaBinding_Platform(LuaBinding& binding);
~LuaBinding_Platform() = default;
void Register(Nz::LuaState& state) override;
// Platform
Nz::LuaClass<Nz::Keyboard> keyboard;
};
}
#endif // NDK_LUABINDING_SYSTEM_HPP

View File

@ -9,7 +9,6 @@
#include <Nazara/Utility/AbstractImage.hpp> #include <Nazara/Utility/AbstractImage.hpp>
#include <Nazara/Utility/Font.hpp> #include <Nazara/Utility/Font.hpp>
#include <Nazara/Utility/Keyboard.hpp>
#include <Nazara/Utility/Node.hpp> #include <Nazara/Utility/Node.hpp>
#include <NDK/Lua/LuaBinding_Base.hpp> #include <NDK/Lua/LuaBinding_Base.hpp>
@ -26,7 +25,6 @@ namespace Ndk
// Utility // Utility
Nz::LuaClass<Nz::AbstractImageRef> abstractImage; Nz::LuaClass<Nz::AbstractImageRef> abstractImage;
Nz::LuaClass<Nz::FontRef> font; Nz::LuaClass<Nz::FontRef> font;
Nz::LuaClass<Nz::Keyboard> keyboard;
Nz::LuaClass<Nz::Node> node; Nz::LuaClass<Nz::Node> node;
}; };
} }

View File

@ -25,6 +25,7 @@ namespace Ndk
audio = LuaBinding_Base::BindAudio(*this); audio = LuaBinding_Base::BindAudio(*this);
renderer = LuaBinding_Base::BindRenderer(*this); renderer = LuaBinding_Base::BindRenderer(*this);
graphics = LuaBinding_Base::BindGraphics(*this); graphics = LuaBinding_Base::BindGraphics(*this);
platform = LuaBinding_Base::BindPlatform(*this);
#endif #endif
sdk = LuaBinding_Base::BindSDK(*this); sdk = LuaBinding_Base::BindSDK(*this);
@ -48,6 +49,7 @@ namespace Ndk
audio->Register(state); audio->Register(state);
graphics->Register(state); graphics->Register(state);
renderer->Register(state); renderer->Register(state);
platform->Register(state);
#endif #endif
// ComponentType (fake enumeration to expose component indexes) // ComponentType (fake enumeration to expose component indexes)

View File

@ -0,0 +1,133 @@
// This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp
#include <NDK/Lua/LuaBinding_Platform.hpp>
#include <NDK/LuaAPI.hpp>
namespace Ndk
{
std::unique_ptr<LuaBinding_Base> LuaBinding_Base::BindPlatform(LuaBinding& binding)
{
return std::make_unique<LuaBinding_Platform>(binding);
}
LuaBinding_Platform::LuaBinding_Platform(LuaBinding& binding) :
LuaBinding_Base(binding)
{
/*********************************** Nz::Keyboard **********************************/
keyboard.Reset("Keyboard");
{
keyboard.BindStaticMethod("GetKeyName", &Nz::Keyboard::GetKeyName);
keyboard.BindStaticMethod("IsKeyPressed", &Nz::Keyboard::IsKeyPressed);
}
}
/*!
* \brief Registers the classes that will be used by the Lua instance
*
* \param instance Lua instance that will interact with the Utility classes
*/
void LuaBinding_Platform::Register(Nz::LuaState& state)
{
keyboard.Register(state);
keyboard.PushGlobalTable(state);
{
static_assert(Nz::Keyboard::Count == 121, "Nz::Keyboard::Key has been updated but change was not reflected to Lua binding");
state.PushField("Undefined", Nz::Keyboard::Undefined);
// A-Z
for (std::size_t i = 0; i < 26; ++i)
state.PushField(Nz::String('A' + char(i)), Nz::Keyboard::A + i);
// Numerical
for (std::size_t i = 0; i < 10; ++i)
{
state.PushField("Num" + Nz::String::Number(i), Nz::Keyboard::Num0 + i);
state.PushField("Numpad" + Nz::String::Number(i), Nz::Keyboard::Numpad0 + i);
}
// F1-F15
for (std::size_t i = 0; i < 15; ++i)
state.PushField('F' + Nz::String::Number(i+1), Nz::Keyboard::F1 + i);
// And all the others...
state.PushField("Down", Nz::Keyboard::Down);
state.PushField("Left", Nz::Keyboard::Left);
state.PushField("Right", Nz::Keyboard::Right);
state.PushField("Up", Nz::Keyboard::Up);
state.PushField("Add", Nz::Keyboard::Add);
state.PushField("Decimal", Nz::Keyboard::Decimal);
state.PushField("Divide", Nz::Keyboard::Divide);
state.PushField("Multiply", Nz::Keyboard::Multiply);
state.PushField("Subtract", Nz::Keyboard::Subtract);
state.PushField("Backslash", Nz::Keyboard::Backslash);
state.PushField("Backspace", Nz::Keyboard::Backspace);
state.PushField("Clear", Nz::Keyboard::Clear);
state.PushField("Comma", Nz::Keyboard::Comma);
state.PushField("Dash", Nz::Keyboard::Dash);
state.PushField("Delete", Nz::Keyboard::Delete);
state.PushField("End", Nz::Keyboard::End);
state.PushField("Equal", Nz::Keyboard::Equal);
state.PushField("Escape", Nz::Keyboard::Escape);
state.PushField("Home", Nz::Keyboard::Home);
state.PushField("Insert", Nz::Keyboard::Insert);
state.PushField("LAlt", Nz::Keyboard::LAlt);
state.PushField("LBracket", Nz::Keyboard::LBracket);
state.PushField("LControl", Nz::Keyboard::LControl);
state.PushField("LShift", Nz::Keyboard::LShift);
state.PushField("LSystem", Nz::Keyboard::LSystem);
state.PushField("PageDown", Nz::Keyboard::PageDown);
state.PushField("PageUp", Nz::Keyboard::PageUp);
state.PushField("Pause", Nz::Keyboard::Pause);
state.PushField("Period", Nz::Keyboard::Period);
state.PushField("Print", Nz::Keyboard::Print);
state.PushField("PrintScreen", Nz::Keyboard::PrintScreen);
state.PushField("Quote", Nz::Keyboard::Quote);
state.PushField("RAlt", Nz::Keyboard::RAlt);
state.PushField("RBracket", Nz::Keyboard::RBracket);
state.PushField("RControl", Nz::Keyboard::RControl);
state.PushField("Return", Nz::Keyboard::Return);
state.PushField("RShift", Nz::Keyboard::RShift);
state.PushField("RSystem", Nz::Keyboard::RSystem);
state.PushField("Semicolon", Nz::Keyboard::Semicolon);
state.PushField("Slash", Nz::Keyboard::Slash);
state.PushField("Space", Nz::Keyboard::Space);
state.PushField("Tab", Nz::Keyboard::Tab);
state.PushField("Tilde", Nz::Keyboard::Tilde);
state.PushField("Browser_Back", Nz::Keyboard::Browser_Back);
state.PushField("Browser_Favorites", Nz::Keyboard::Browser_Favorites);
state.PushField("Browser_Forward", Nz::Keyboard::Browser_Forward);
state.PushField("Browser_Home", Nz::Keyboard::Browser_Home);
state.PushField("Browser_Refresh", Nz::Keyboard::Browser_Refresh);
state.PushField("Browser_Search", Nz::Keyboard::Browser_Search);
state.PushField("Browser_Stop", Nz::Keyboard::Browser_Stop);
state.PushField("Media_Next", Nz::Keyboard::Media_Next);
state.PushField("Media_Play", Nz::Keyboard::Media_Play);
state.PushField("Media_Previous", Nz::Keyboard::Media_Previous);
state.PushField("Media_Stop", Nz::Keyboard::Media_Stop);
state.PushField("Volume_Down", Nz::Keyboard::Volume_Down);
state.PushField("Volume_Mute", Nz::Keyboard::Volume_Mute);
state.PushField("Volume_Up", Nz::Keyboard::Volume_Up);
state.PushField("CapsLock", Nz::Keyboard::CapsLock);
state.PushField("NumLock", Nz::Keyboard::NumLock);
state.PushField("ScrollLock", Nz::Keyboard::ScrollLock);
}
state.Pop();
static_assert(Nz::WindowStyle_Max + 1 == 6, "Nz::WindowStyle has been updated but change was not reflected to Lua binding");
state.PushTable(0, Nz::WindowStyle_Max + 1);
{
state.PushField("None", Nz::WindowStyle_None);
state.PushField("Fullscreen", Nz::WindowStyle_Fullscreen);
state.PushField("Closable", Nz::WindowStyle_Closable);
state.PushField("Resizable", Nz::WindowStyle_Resizable);
state.PushField("Titlebar", Nz::WindowStyle_Titlebar);
state.PushField("Threaded", Nz::WindowStyle_Threaded);
}
state.SetGlobal("WindowStyle");
}
}

View File

@ -161,13 +161,6 @@ namespace Ndk
font.BindStaticMethod("SetDefaultMinimumStepSize", &Nz::Font::SetDefaultMinimumStepSize); font.BindStaticMethod("SetDefaultMinimumStepSize", &Nz::Font::SetDefaultMinimumStepSize);
} }
/*********************************** Nz::Keyboard **********************************/
keyboard.Reset("Keyboard");
{
keyboard.BindStaticMethod("GetKeyName", &Nz::Keyboard::GetKeyName);
keyboard.BindStaticMethod("IsKeyPressed", &Nz::Keyboard::IsKeyPressed);
}
/*********************************** Nz::Node **********************************/ /*********************************** Nz::Node **********************************/
node.Reset("Node"); node.Reset("Node");
{ {
@ -339,106 +332,6 @@ namespace Ndk
{ {
abstractImage.Register(state); abstractImage.Register(state);
font.Register(state); font.Register(state);
keyboard.Register(state);
node.Register(state); node.Register(state);
keyboard.PushGlobalTable(state);
{
static_assert(Nz::Keyboard::Count == 121, "Nz::Keyboard::Key has been updated but change was not reflected to Lua binding");
state.PushField("Undefined", Nz::Keyboard::Undefined);
// A-Z
for (std::size_t i = 0; i < 26; ++i)
state.PushField(Nz::String('A' + char(i)), Nz::Keyboard::A + i);
// Numerical
for (std::size_t i = 0; i < 10; ++i)
{
state.PushField("Num" + Nz::String::Number(i), Nz::Keyboard::Num0 + i);
state.PushField("Numpad" + Nz::String::Number(i), Nz::Keyboard::Numpad0 + i);
}
// F1-F15
for (std::size_t i = 0; i < 15; ++i)
state.PushField('F' + Nz::String::Number(i+1), Nz::Keyboard::F1 + i);
// And all the others...
state.PushField("Down", Nz::Keyboard::Down);
state.PushField("Left", Nz::Keyboard::Left);
state.PushField("Right", Nz::Keyboard::Right);
state.PushField("Up", Nz::Keyboard::Up);
state.PushField("Add", Nz::Keyboard::Add);
state.PushField("Decimal", Nz::Keyboard::Decimal);
state.PushField("Divide", Nz::Keyboard::Divide);
state.PushField("Multiply", Nz::Keyboard::Multiply);
state.PushField("Subtract", Nz::Keyboard::Subtract);
state.PushField("Backslash", Nz::Keyboard::Backslash);
state.PushField("Backspace", Nz::Keyboard::Backspace);
state.PushField("Clear", Nz::Keyboard::Clear);
state.PushField("Comma", Nz::Keyboard::Comma);
state.PushField("Dash", Nz::Keyboard::Dash);
state.PushField("Delete", Nz::Keyboard::Delete);
state.PushField("End", Nz::Keyboard::End);
state.PushField("Equal", Nz::Keyboard::Equal);
state.PushField("Escape", Nz::Keyboard::Escape);
state.PushField("Home", Nz::Keyboard::Home);
state.PushField("Insert", Nz::Keyboard::Insert);
state.PushField("LAlt", Nz::Keyboard::LAlt);
state.PushField("LBracket", Nz::Keyboard::LBracket);
state.PushField("LControl", Nz::Keyboard::LControl);
state.PushField("LShift", Nz::Keyboard::LShift);
state.PushField("LSystem", Nz::Keyboard::LSystem);
state.PushField("PageDown", Nz::Keyboard::PageDown);
state.PushField("PageUp", Nz::Keyboard::PageUp);
state.PushField("Pause", Nz::Keyboard::Pause);
state.PushField("Period", Nz::Keyboard::Period);
state.PushField("Print", Nz::Keyboard::Print);
state.PushField("PrintScreen", Nz::Keyboard::PrintScreen);
state.PushField("Quote", Nz::Keyboard::Quote);
state.PushField("RAlt", Nz::Keyboard::RAlt);
state.PushField("RBracket", Nz::Keyboard::RBracket);
state.PushField("RControl", Nz::Keyboard::RControl);
state.PushField("Return", Nz::Keyboard::Return);
state.PushField("RShift", Nz::Keyboard::RShift);
state.PushField("RSystem", Nz::Keyboard::RSystem);
state.PushField("Semicolon", Nz::Keyboard::Semicolon);
state.PushField("Slash", Nz::Keyboard::Slash);
state.PushField("Space", Nz::Keyboard::Space);
state.PushField("Tab", Nz::Keyboard::Tab);
state.PushField("Tilde", Nz::Keyboard::Tilde);
state.PushField("Browser_Back", Nz::Keyboard::Browser_Back);
state.PushField("Browser_Favorites", Nz::Keyboard::Browser_Favorites);
state.PushField("Browser_Forward", Nz::Keyboard::Browser_Forward);
state.PushField("Browser_Home", Nz::Keyboard::Browser_Home);
state.PushField("Browser_Refresh", Nz::Keyboard::Browser_Refresh);
state.PushField("Browser_Search", Nz::Keyboard::Browser_Search);
state.PushField("Browser_Stop", Nz::Keyboard::Browser_Stop);
state.PushField("Media_Next", Nz::Keyboard::Media_Next);
state.PushField("Media_Play", Nz::Keyboard::Media_Play);
state.PushField("Media_Previous", Nz::Keyboard::Media_Previous);
state.PushField("Media_Stop", Nz::Keyboard::Media_Stop);
state.PushField("Volume_Down", Nz::Keyboard::Volume_Down);
state.PushField("Volume_Mute", Nz::Keyboard::Volume_Mute);
state.PushField("Volume_Up", Nz::Keyboard::Volume_Up);
state.PushField("CapsLock", Nz::Keyboard::CapsLock);
state.PushField("NumLock", Nz::Keyboard::NumLock);
state.PushField("ScrollLock", Nz::Keyboard::ScrollLock);
}
state.Pop();
static_assert(Nz::WindowStyle_Max + 1 == 6, "Nz::WindowStyle has been updated but change was not reflected to Lua binding");
state.PushTable(0, Nz::WindowStyle_Max + 1);
{
state.PushField("None", Nz::WindowStyle_None);
state.PushField("Fullscreen", Nz::WindowStyle_Fullscreen);
state.PushField("Closable", Nz::WindowStyle_Closable);
state.PushField("Resizable", Nz::WindowStyle_Resizable);
state.PushField("Titlebar", Nz::WindowStyle_Titlebar);
state.PushField("Threaded", Nz::WindowStyle_Threaded);
}
state.SetGlobal("WindowStyle");
} }
} }

View File

@ -6,11 +6,13 @@
#include <Nazara/Audio/Audio.hpp> #include <Nazara/Audio/Audio.hpp>
#include <Nazara/Core/ErrorFlags.hpp> #include <Nazara/Core/ErrorFlags.hpp>
#include <Nazara/Core/Log.hpp> #include <Nazara/Core/Log.hpp>
#include <Nazara/Core/ParameterList.hpp>
#include <Nazara/Graphics/Graphics.hpp> #include <Nazara/Graphics/Graphics.hpp>
#include <Nazara/Lua/Lua.hpp> #include <Nazara/Lua/Lua.hpp>
#include <Nazara/Noise/Noise.hpp> #include <Nazara/Noise/Noise.hpp>
#include <Nazara/Physics2D/Physics2D.hpp> #include <Nazara/Physics2D/Physics2D.hpp>
#include <Nazara/Physics3D/Physics3D.hpp> #include <Nazara/Physics3D/Physics3D.hpp>
#include <Nazara/Platform/Platform.hpp>
#include <Nazara/Utility/Utility.hpp> #include <Nazara/Utility/Utility.hpp>
#include <NDK/Algorithm.hpp> #include <NDK/Algorithm.hpp>
#include <NDK/BaseSystem.hpp> #include <NDK/BaseSystem.hpp>
@ -63,13 +65,6 @@ namespace Ndk
// Initialize the engine first // Initialize the engine first
// Shared modules // Shared modules
#ifdef NDK_SERVER
Nz::ParameterList parameters;
parameters.SetParameter("NoWindowSystem", true);
Nz::Utility::SetParameters(parameters);
#endif
Nz::Lua::Initialize(); Nz::Lua::Initialize();
Nz::Noise::Initialize(); Nz::Noise::Initialize();
Nz::Physics2D::Initialize(); Nz::Physics2D::Initialize();

View File

@ -3,5 +3,6 @@ MODULE.Name = "Graphics"
MODULE.Libraries = { MODULE.Libraries = {
"NazaraCore", "NazaraCore",
"NazaraUtility", "NazaraUtility",
"NazaraPlatform",
"NazaraRenderer" "NazaraRenderer"
} }

View File

@ -0,0 +1,31 @@
MODULE.Name = "Platform"
MODULE.Libraries = {
"NazaraCore",
"NazaraUtility"
}
MODULE.OsFiles.Windows = {
"../src/Nazara/Platform/Win32/**.hpp",
"../src/Nazara/Platform/Win32/**.cpp"
}
MODULE.OsFiles.Posix = {
"../src/Nazara/Platform/X11/**.hpp",
"../src/Nazara/Platform/X11/**.cpp"
}
MODULE.OsLibraries.Windows = {
"gdi32"
}
MODULE.OsLibraries.Posix = {
"X11",
"xcb",
"xcb-cursor",
"xcb-ewmh",
"xcb-icccm",
"xcb-keysyms",
"xcb-randr"
}

View File

@ -8,7 +8,8 @@ MODULE.Defines = {
MODULE.Libraries = { MODULE.Libraries = {
"NazaraCore", "NazaraCore",
"NazaraUtility" "NazaraUtility",
"NazaraPlatform"
} }
MODULE.OsFiles.Windows = { MODULE.OsFiles.Windows = {

View File

@ -5,29 +5,11 @@ MODULE.Libraries = {
"stb_image" "stb_image"
} }
MODULE.OsFiles.Windows = {
"../src/Nazara/Utility/Win32/**.hpp",
"../src/Nazara/Utility/Win32/**.cpp"
}
MODULE.OsFiles.Posix = {
"../src/Nazara/Utility/X11/**.hpp",
"../src/Nazara/Utility/X11/**.cpp"
}
MODULE.OsLibraries.Windows = { MODULE.OsLibraries.Windows = {
"freetype-s", "freetype-s"
"gdi32"
} }
MODULE.OsLibraries.Posix = { MODULE.OsLibraries.Posix = {
"freetype", "freetype"
"X11",
"xcb",
"xcb-cursor",
"xcb-ewmh",
"xcb-icccm",
"xcb-keysyms",
"xcb-randr"
} }

View File

@ -37,7 +37,8 @@ TOOL.FilesExcluded = {
"../SDK/**/*Widget*.*", "../SDK/**/*Widget*.*",
"../SDK/**/LuaBinding_Audio.*", "../SDK/**/LuaBinding_Audio.*",
"../SDK/**/LuaBinding_Graphics.*", "../SDK/**/LuaBinding_Graphics.*",
"../SDK/**/LuaBinding_Renderer.*" "../SDK/**/LuaBinding_Renderer.*",
"../SDK/**/LuaBinding_Platform.*"
} }

View File

@ -25,7 +25,7 @@ TOOL.Files = {
TOOL.FilesExcluded = { TOOL.FilesExcluded = {
"../tests/Engine/Audio/**", "../tests/Engine/Audio/**",
"../tests/Engine/Graphics/**", "../tests/Engine/Graphics/**",
"../tests/Engine/Utility/**", "../tests/Engine/Platform/**",
"../tests/SDK/NDK/Application.cpp", "../tests/SDK/NDK/Application.cpp",
"../tests/SDK/NDK/Systems/ListenerSystem.cpp", "../tests/SDK/NDK/Systems/ListenerSystem.cpp",
"../tests/SDK/NDK/Systems/RenderSystem.cpp" "../tests/SDK/NDK/Systems/RenderSystem.cpp"

View File

@ -9,5 +9,6 @@ EXAMPLE.Files = {
EXAMPLE.Libraries = { EXAMPLE.Libraries = {
"NazaraAudio", "NazaraAudio",
"NazaraCore", "NazaraCore",
"NazaraPlatform",
"NazaraUtility" "NazaraUtility"
} }

View File

@ -12,14 +12,14 @@
#include <Nazara/Core/Clock.hpp> #include <Nazara/Core/Clock.hpp>
#include <Nazara/Core/Thread.hpp> // Thread::Sleep #include <Nazara/Core/Thread.hpp> // Thread::Sleep
#include <Nazara/Math/Vector3.hpp> #include <Nazara/Math/Vector3.hpp>
#include <Nazara/Utility/Keyboard.hpp> #include <Nazara/Platform/Keyboard.hpp>
#include <Nazara/Utility/Utility.hpp> #include <Nazara/Platform/Platform.hpp>
#include <iostream> #include <iostream>
int main() int main()
{ {
// NzKeyboard nécessite l'initialisation du module Utilitaire // NzKeyboard nécessite l'initialisation du module Utilitaire
Nz::Initializer<Nz::Audio, Nz::Utility> audio; Nz::Initializer<Nz::Audio, Nz::Platform> audio;
if (!audio) if (!audio)
{ {
std::cout << "Failed to initialize audio module" << std::endl; std::cout << "Failed to initialize audio module" << std::endl;

View File

@ -12,6 +12,7 @@ EXAMPLE.Files = {
EXAMPLE.Libraries = { EXAMPLE.Libraries = {
"NazaraCore", "NazaraCore",
"NazaraPlatform",
"NazaraRenderer", "NazaraRenderer",
"NazaraUtility" "NazaraUtility"
} }

View File

@ -8,6 +8,7 @@ EXAMPLE.Files = {
EXAMPLE.Libraries = { EXAMPLE.Libraries = {
"NazaraCore", "NazaraCore",
"NazaraPlatform",
"NazaraUtility" "NazaraUtility"
} }

View File

@ -2,6 +2,7 @@
#include <Nazara/Audio/Sound.hpp> #include <Nazara/Audio/Sound.hpp>
#include <Nazara/Core/OffsetOf.hpp> #include <Nazara/Core/OffsetOf.hpp>
#include <Nazara/Graphics.hpp> #include <Nazara/Graphics.hpp>
#include <Nazara/Platform.hpp>
#include <Nazara/Utility.hpp> #include <Nazara/Utility.hpp>
#include <NDK/Components.hpp> #include <NDK/Components.hpp>
#include <NDK/Systems.hpp> #include <NDK/Systems.hpp>

View File

@ -10,7 +10,7 @@
#include <Nazara/Graphics/ParticleStruct.hpp> #include <Nazara/Graphics/ParticleStruct.hpp>
#include <Nazara/Graphics/SkyboxBackground.hpp> #include <Nazara/Graphics/SkyboxBackground.hpp>
#include <Nazara/Math/Vector2.hpp> #include <Nazara/Math/Vector2.hpp>
#include <Nazara/Utility/EventHandler.hpp> #include <Nazara/Platform/EventHandler.hpp>
#include <NDK/Entity.hpp> #include <NDK/Entity.hpp>
#include <NDK/State.hpp> #include <NDK/State.hpp>
#include <vector> #include <vector>

View File

@ -15,6 +15,7 @@ EXAMPLE.Libraries = {
"NazaraNoise", "NazaraNoise",
"NazaraPhysics2D", "NazaraPhysics2D",
"NazaraPhysics3D", "NazaraPhysics3D",
"NazaraPlatform",
"NazaraRenderer", "NazaraRenderer",
"NazaraUtility", "NazaraUtility",
"NazaraSDK" "NazaraSDK"

View File

@ -12,7 +12,7 @@
#include <type_traits> #include <type_traits>
#define NazaraCheckTypeAndVal(name, type, op, val, err) static_assert(std::is_ ##type <decltype(name)>::value && name op val, #type err) #define NazaraCheckTypeAndVal(name, type, op, val, err) static_assert(std::is_ ##type <decltype(name)>::value && name op val, #type err)
// We fore the value of MANAGE_MEMORY in debug // We force the value of MANAGE_MEMORY in debug
#if defined(NAZARA_DEBUG) && !NAZARA_GRAPHICS_MANAGE_MEMORY #if defined(NAZARA_DEBUG) && !NAZARA_GRAPHICS_MANAGE_MEMORY
#undef NAZARA_GRAPHICS_MANAGE_MEMORY #undef NAZARA_GRAPHICS_MANAGE_MEMORY
#define NAZARA_GRAPHICS_MANAGE_MEMORY 0 #define NAZARA_GRAPHICS_MANAGE_MEMORY 0

View File

@ -0,0 +1,48 @@
// This file was automatically generated
/*
Nazara Engine - Platform module
Copyright (C) 2015 Jérôme "Lynix" Leclercq (Lynix680@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#pragma once
#ifndef NAZARA_GLOBAL_PLATFORM_HPP
#define NAZARA_GLOBAL_PLATFORM_HPP
#include <Nazara/Platform/Config.hpp>
#include <Nazara/Platform/Cursor.hpp>
#include <Nazara/Platform/CursorController.hpp>
#include <Nazara/Platform/Enums.hpp>
#include <Nazara/Platform/Event.hpp>
#include <Nazara/Platform/EventHandler.hpp>
#include <Nazara/Platform/Icon.hpp>
#include <Nazara/Platform/Joystick.hpp>
#include <Nazara/Platform/Keyboard.hpp>
#include <Nazara/Platform/Mouse.hpp>
#include <Nazara/Platform/Platform.hpp>
#include <Nazara/Platform/VideoMode.hpp>
#include <Nazara/Platform/Window.hpp>
#include <Nazara/Platform/WindowHandle.hpp>
#endif // NAZARA_GLOBAL_PLATFORM_HPP

View File

@ -0,0 +1,54 @@
/*
Nazara Engine - Platform module
Copyright (C) 2015 Jérôme "Lynix" Leclercq (Lynix680@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#pragma once
#ifndef NAZARA_CONFIG_PLATFORM_HPP
#define NAZARA_CONFIG_PLATFORM_HPP
/// Each modification of a parameter needs a recompilation of the module
// Use the MemoryManager to manage dynamic allocations (can detect memory leak but allocations/frees are slower)
#define NAZARA_PLATFORM_MANAGE_MEMORY 0
// Activate the security tests based on the code (Advised for development)
#define NAZARA_PLATFORM_SAFE 1
// Protect the classes against data race
//#define NAZARA_PLATFORM_THREADSAFE 1
// On Windows, ALT and F10 keys do not activate the window menu
#define NAZARA_PLATFORM_WINDOWS_DISABLE_MENU_KEYS 1
#if defined(NAZARA_STATIC)
#define NAZARA_PLATFORM_API
#else
#ifdef NAZARA_PLATFORM_BUILD
#define NAZARA_PLATFORM_API NAZARA_EXPORT
#else
#define NAZARA_PLATFORM_API NAZARA_IMPORT
#endif
#endif
#endif // NAZARA_CONFIG_PLATFORM_HPP

View File

@ -0,0 +1,23 @@
// 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
#pragma once
#ifndef NAZARA_CONFIG_CHECK_PLATFORM_HPP
#define NAZARA_CONFIG_CHECK_PLATFORM_HPP
/// This file is used to check the constant values defined in Config.hpp
#include <type_traits>
#define NazaraCheckTypeAndVal(name, type, op, val, err) static_assert(std::is_ ##type <decltype(name)>::value && name op val, #type err)
// We force the value of MANAGE_MEMORY in debug
#if defined(NAZARA_DEBUG) && !NAZARA_PLATFORM_MANAGE_MEMORY
#undef NAZARA_PLATFORM_MANAGE_MEMORY
#define NAZARA_PLATFORM_MANAGE_MEMORY 0
#endif
#undef NazaraCheckTypeAndVal
#endif // NAZARA_CONFIG_CHECK_PLATFORM_HPP

View File

@ -1,5 +1,5 @@
// Copyright (C) 2017 Jérôme Leclercq // 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 // For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once #pragma once
@ -10,7 +10,8 @@
#include <Nazara/Prerequesites.hpp> #include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/ObjectRef.hpp> #include <Nazara/Core/ObjectRef.hpp>
#include <Nazara/Math/Vector2.hpp> #include <Nazara/Math/Vector2.hpp>
#include <Nazara/Utility/Config.hpp> #include <Nazara/Platform/Config.hpp>
#include <Nazara/Platform/Enums.hpp>
#include <Nazara/Utility/Image.hpp> #include <Nazara/Utility/Image.hpp>
#include <array> #include <array>
@ -23,9 +24,9 @@ namespace Nz
using CursorConstRef = ObjectRef<const Cursor>; using CursorConstRef = ObjectRef<const Cursor>;
using CursorRef = ObjectRef<Cursor>; using CursorRef = ObjectRef<Cursor>;
class NAZARA_UTILITY_API Cursor : public RefCounted class NAZARA_PLATFORM_API Cursor : public RefCounted
{ {
friend class Utility; friend class Platform;
friend class WindowImpl; friend class WindowImpl;
public: public:
@ -66,6 +67,6 @@ namespace Nz
}; };
} }
#include <Nazara/Utility/Cursor.inl> #include <Nazara/Platform/Cursor.inl>
#endif // NAZARA_CURSOR_HPP #endif // NAZARA_CURSOR_HPP

View File

@ -1,10 +1,10 @@
// Copyright (C) 2017 Jérôme Leclercq // 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 // For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Utility/Cursor.hpp> #include <Nazara/Platform/Cursor.hpp>
#include <Nazara/Core/ErrorFlags.hpp> #include <Nazara/Core/ErrorFlags.hpp>
#include <Nazara/Utility/Debug.hpp> #include <Nazara/Platform/Debug.hpp>
namespace Nz namespace Nz
{ {
@ -66,4 +66,4 @@ namespace Nz
} }
} }
#include <Nazara/Utility/DebugOff.hpp> #include <Nazara/Platform/DebugOff.hpp>

View File

@ -1,5 +1,5 @@
// Copyright (C) 2017 Jérôme Leclercq // 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 // For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once #pragma once
@ -11,8 +11,8 @@
#include <Nazara/Core/HandledObject.hpp> #include <Nazara/Core/HandledObject.hpp>
#include <Nazara/Core/ObjectHandle.hpp> #include <Nazara/Core/ObjectHandle.hpp>
#include <Nazara/Core/Signal.hpp> #include <Nazara/Core/Signal.hpp>
#include <Nazara/Utility/Cursor.hpp> #include <Nazara/Platform/Cursor.hpp>
#include <Nazara/Utility/Enums.hpp> #include <Nazara/Platform/Enums.hpp>
namespace Nz namespace Nz
{ {
@ -37,6 +37,6 @@ namespace Nz
}; };
} }
#include <Nazara/Utility/CursorController.inl> #include <Nazara/Platform/CursorController.inl>
#endif // NAZARA_CURSORCONTROLLER_HPP #endif // NAZARA_CURSORCONTROLLER_HPP

View File

@ -1,9 +1,9 @@
// Copyright (C) 2017 Jérôme Leclercq // 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 // For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Utility/CursorController.hpp> #include <Nazara/Platform/CursorController.hpp>
#include <Nazara/Utility/Debug.hpp> #include <Nazara/Platform/Debug.hpp>
namespace Nz namespace Nz
{ {
@ -13,4 +13,4 @@ namespace Nz
} }
} }
#include <Nazara/Utility/DebugOff.hpp> #include <Nazara/Platform/DebugOff.hpp>

View File

@ -0,0 +1,8 @@
// 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/Debug/NewRedefinition.hpp>
#endif

View File

@ -0,0 +1,9 @@
// 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
// We suppose that Debug.hpp is already included, same goes for Config.hpp
#if NAZARA_PLATFORM_MANAGE_MEMORY
#undef delete
#undef new
#endif

View File

@ -0,0 +1,85 @@
// 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
#pragma once
#ifndef NAZARA_ENUMS_PLATFORM_HPP
#define NAZARA_ENUMS_PLATFORM_HPP
#include <Nazara/Core/Flags.hpp>
namespace Nz
{
enum SystemCursor
{
SystemCursor_Crosshair,
SystemCursor_Default,
SystemCursor_Hand,
SystemCursor_Help,
SystemCursor_Move,
SystemCursor_None,
SystemCursor_Pointer,
SystemCursor_Progress,
SystemCursor_ResizeE,
SystemCursor_ResizeN,
SystemCursor_ResizeNE,
SystemCursor_ResizeNW,
SystemCursor_ResizeS,
SystemCursor_ResizeSE,
SystemCursor_ResizeSW,
SystemCursor_ResizeW,
SystemCursor_Text,
SystemCursor_Wait,
SystemCursor_Max = SystemCursor_Wait
};
enum WindowEventType
{
WindowEventType_GainedFocus,
WindowEventType_LostFocus,
WindowEventType_KeyPressed,
WindowEventType_KeyReleased,
WindowEventType_MouseButtonDoubleClicked,
WindowEventType_MouseButtonPressed,
WindowEventType_MouseButtonReleased,
WindowEventType_MouseEntered,
WindowEventType_MouseLeft,
WindowEventType_MouseMoved,
WindowEventType_MouseWheelMoved,
WindowEventType_Moved,
WindowEventType_Quit,
WindowEventType_Resized,
WindowEventType_TextEntered,
WindowEventType_Max = WindowEventType_TextEntered
};
enum WindowStyle
{
WindowStyle_None, ///< Window has no border nor titlebar.
WindowStyle_Fullscreen, ///< At the window creation, the OS tries to set it in fullscreen.
WindowStyle_Closable, ///< Allows the window to be closed by a button in the titlebar, generating a Quit event.
WindowStyle_Resizable, ///< Allows the window to be resized by dragging its corners or by a button of the titlebar.
WindowStyle_Titlebar, ///< Adds a titlebar to the window, this option is automatically enabled if buttons of the titlebar are enabled.
WindowStyle_Threaded, ///< Runs the window into a thread, allowing the application to keep updating while resizing/dragging the window.
WindowStyle_Max = WindowStyle_Threaded
};
template<>
struct EnumAsFlags<WindowStyle>
{
static constexpr bool value = true;
static constexpr int max = WindowStyle_Max;
};
using WindowStyleFlags = Flags<WindowStyle>;
constexpr WindowStyleFlags WindowStyle_Default = WindowStyle_Closable | WindowStyle_Resizable | WindowStyle_Titlebar;
}
#endif // NAZARA_ENUMS_PLATFORM_HPP

View File

@ -1,23 +1,23 @@
// Copyright (C) 2017 Jérôme Leclercq // 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 // For conditions of distribution and use, see copyright notice in Config.hpp
// Interface inspirée de la SFML par Laurent Gomila // Interface inspired by the SFML of Laurent Gomila (and its team)
#pragma once #pragma once
#ifndef NAZARA_EVENT_HPP #ifndef NAZARA_EVENT_HPP
#define NAZARA_EVENT_HPP #define NAZARA_EVENT_HPP
#include <Nazara/Utility/Enums.hpp> #include <Nazara/Platform/Enums.hpp>
#include <Nazara/Utility/Keyboard.hpp> #include <Nazara/Platform/Keyboard.hpp>
#include <Nazara/Utility/Mouse.hpp> #include <Nazara/Platform/Mouse.hpp>
namespace Nz namespace Nz
{ {
struct WindowEvent struct WindowEvent
{ {
// Utilisé par: // Used by:
// -WindowEventType_KeyPressed // -WindowEventType_KeyPressed
// -WindowEventType_KeyReleased // -WindowEventType_KeyReleased
struct KeyEvent struct KeyEvent
@ -30,7 +30,7 @@ namespace Nz
bool system; bool system;
}; };
// Utilisé par: // Used by:
// -WindowEventType_MouseButtonDoubleClicked // -WindowEventType_MouseButtonDoubleClicked
// -WindowEventType_MouseButtonPressed // -WindowEventType_MouseButtonPressed
struct MouseButtonEvent struct MouseButtonEvent
@ -40,7 +40,7 @@ namespace Nz
unsigned int y; unsigned int y;
}; };
// Utilisé par: // Used by:
// -WindowEventType_MouseMoved // -WindowEventType_MouseMoved
struct MouseMoveEvent struct MouseMoveEvent
{ {
@ -50,14 +50,14 @@ namespace Nz
unsigned int y; unsigned int y;
}; };
// Utilisé par: // Used by:
// -WindowEventType_MouseWheelMoved // -WindowEventType_MouseWheelMoved
struct MouseWheelEvent struct MouseWheelEvent
{ {
float delta; float delta;
}; };
// Utilisé par: // Used by:
// -WindowEventType_Moved // -WindowEventType_Moved
struct PositionEvent struct PositionEvent
{ {
@ -65,7 +65,7 @@ namespace Nz
int y; int y;
}; };
// Utilisé par: // Used by:
// -WindowEventType_Resized // -WindowEventType_Resized
struct SizeEvent struct SizeEvent
{ {
@ -73,7 +73,7 @@ namespace Nz
unsigned int width; unsigned int width;
}; };
// Utilisé par: // Used by:
// -WindowEventType_TextEntered // -WindowEventType_TextEntered
struct TextEvent struct TextEvent
{ {
@ -85,33 +85,33 @@ namespace Nz
union union
{ {
// Utilisé par: // Used by:
// -WindowEventType_KeyPressed // -WindowEventType_KeyPressed
// -WindowEventType_KeyReleased // -WindowEventType_KeyReleased
KeyEvent key; KeyEvent key;
// Utilisé par: // Used by:
// -WindowEventType_MouseButtonDoubleClicked // -WindowEventType_MouseButtonDoubleClicked
// -WindowEventType_MouseButtonPressed // -WindowEventType_MouseButtonPressed
MouseButtonEvent mouseButton; MouseButtonEvent mouseButton;
// Utilisé par: // Used by:
// -WindowEventType_MouseMoved // -WindowEventType_MouseMoved
MouseMoveEvent mouseMove; MouseMoveEvent mouseMove;
// Utilisé par: // Used by:
// -WindowEventType_MouseWheelMoved // -WindowEventType_MouseWheelMoved
MouseWheelEvent mouseWheel; MouseWheelEvent mouseWheel;
// Utilisé par: // Used by:
// -WindowEventType_Moved // -WindowEventType_Moved
PositionEvent position; PositionEvent position;
// Utilisé par: // Used by:
// -WindowEventType_Resized // -WindowEventType_Resized
SizeEvent size; SizeEvent size;
// Utilisé par: // Used by:
// -WindowEventType_TextEntered // -WindowEventType_TextEntered
TextEvent text; TextEvent text;
}; };

View File

@ -1,5 +1,5 @@
// Copyright (C) 2017 Jérôme Leclercq // 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 // For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once #pragma once
@ -11,8 +11,8 @@
#include <Nazara/Core/HandledObject.hpp> #include <Nazara/Core/HandledObject.hpp>
#include <Nazara/Core/ObjectHandle.hpp> #include <Nazara/Core/ObjectHandle.hpp>
#include <Nazara/Core/Signal.hpp> #include <Nazara/Core/Signal.hpp>
#include <Nazara/Utility/Config.hpp> #include <Nazara/Platform/Config.hpp>
#include <Nazara/Utility/Event.hpp> #include <Nazara/Platform/Event.hpp>
namespace Nz namespace Nz
{ {
@ -52,6 +52,6 @@ namespace Nz
}; };
} }
#include <Nazara/Utility/EventHandler.inl> #include <Nazara/Platform/EventHandler.inl>
#endif // NAZARA_EVENTHANDLER_HPP #endif // NAZARA_EVENTHANDLER_HPP

View File

@ -1,10 +1,10 @@
// Copyright (C) 2017 Jérôme Leclercq // 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 // For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Utility/EventHandler.hpp> #include <Nazara/Platform/EventHandler.hpp>
#include <memory> #include <memory>
#include <Nazara/Utility/Debug.hpp> #include <Nazara/Platform/Debug.hpp>
namespace Nz namespace Nz
{ {
@ -82,4 +82,4 @@ namespace Nz
} }
} }
#include <Nazara/Utility/DebugOff.hpp> #include <Nazara/Platform/DebugOff.hpp>

View File

@ -1,5 +1,5 @@
// Copyright (C) 2017 Jérôme Leclercq // 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 // For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once #pragma once
@ -10,7 +10,7 @@
#include <Nazara/Prerequesites.hpp> #include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/ObjectRef.hpp> #include <Nazara/Core/ObjectRef.hpp>
#include <Nazara/Math/Vector2.hpp> #include <Nazara/Math/Vector2.hpp>
#include <Nazara/Utility/Config.hpp> #include <Nazara/Platform/Config.hpp>
namespace Nz namespace Nz
{ {
@ -21,7 +21,7 @@ namespace Nz
using IconRef = ObjectRef<Icon>; using IconRef = ObjectRef<Icon>;
class NAZARA_UTILITY_API Icon : public RefCounted class NAZARA_PLATFORM_API Icon : public RefCounted
{ {
friend class WindowImpl; friend class WindowImpl;
@ -42,6 +42,6 @@ namespace Nz
}; };
} }
#include <Nazara/Utility/Icon.inl> #include <Nazara/Platform/Icon.inl>
#endif // NAZARA_ICON_HPP #endif // NAZARA_ICON_HPP

View File

@ -1,10 +1,10 @@
// Copyright (C) 2017 Jérôme Leclercq // 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 // For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Utility/Cursor.hpp> #include <Nazara/Platform/Cursor.hpp>
#include <Nazara/Core/ErrorFlags.hpp> #include <Nazara/Core/ErrorFlags.hpp>
#include <Nazara/Utility/Debug.hpp> #include <Nazara/Platform/Debug.hpp>
namespace Nz namespace Nz
{ {
@ -39,4 +39,4 @@ namespace Nz
} }
} }
#include <Nazara/Utility/DebugOff.hpp> #include <Nazara/Platform/DebugOff.hpp>

View File

@ -1,5 +1,5 @@
// Copyright (C) 2017 Jérôme Leclercq // 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 // For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once #pragma once
@ -12,7 +12,7 @@
namespace Nz namespace Nz
{ {
class NAZARA_UTILITY_API Joystick class NAZARA_PLATFORM_API Joystick
{ {
public: public:
Joystick() = delete; Joystick() = delete;

View File

@ -1,8 +1,8 @@
// Copyright (C) 2017 Jérôme Leclercq // 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 // For conditions of distribution and use, see copyright notice in Config.hpp
// Interface inspirée de la SFML par Laurent Gomila // Interface inspired by the SFML of Laurent Gomila (and its team)
#pragma once #pragma once
@ -11,11 +11,11 @@
#include <Nazara/Prerequesites.hpp> #include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/String.hpp> #include <Nazara/Core/String.hpp>
#include <Nazara/Utility/Config.hpp> #include <Nazara/Platform/Config.hpp>
namespace Nz namespace Nz
{ {
class NAZARA_UTILITY_API Keyboard class NAZARA_PLATFORM_API Keyboard
{ {
public: public:
enum Key enum Key
@ -50,7 +50,7 @@ namespace Nz
Y, Y,
Z, Z,
// Touches de fonction // Functional keys
F1, F1,
F2, F2,
F3, F3,
@ -67,13 +67,13 @@ namespace Nz
F14, F14,
F15, F15,
// Flèches directionnelles // Directional keys
Down, Down,
Left, Left,
Right, Right,
Up, Up,
// Pavé numérique // Numerical pad
Add, Add,
Decimal, Decimal,
Divide, Divide,
@ -90,7 +90,7 @@ namespace Nz
Numpad9, Numpad9,
Subtract, Subtract,
// Divers // Various
Backslash, Backslash,
Backspace, Backspace,
Clear, Clear,
@ -136,7 +136,7 @@ namespace Nz
Tab, Tab,
Tilde, Tilde,
// Touches navigateur // Navigator keys
Browser_Back, Browser_Back,
Browser_Favorites, Browser_Favorites,
Browser_Forward, Browser_Forward,
@ -145,18 +145,18 @@ namespace Nz
Browser_Search, Browser_Search,
Browser_Stop, Browser_Stop,
// Touches de contrôle de lecture // Lecture control keys
Media_Next, Media_Next,
Media_Play, Media_Play,
Media_Previous, Media_Previous,
Media_Stop, Media_Stop,
// Touches de contrôle du volume // Volume control keys
Volume_Down, Volume_Down,
Volume_Mute, Volume_Mute,
Volume_Up, Volume_Up,
// Touches à verrouillage // Locking keys
CapsLock, CapsLock,
NumLock, NumLock,
ScrollLock, ScrollLock,

View File

@ -1,8 +1,8 @@
// Copyright (C) 2017 Jérôme Leclercq // 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 // For conditions of distribution and use, see copyright notice in Config.hpp
// Interface inspirée de la SFML par Laurent Gomila // Interface inspired by the SFML of Laurent Gomila (and its team)
#pragma once #pragma once
@ -11,13 +11,13 @@
#include <Nazara/Prerequesites.hpp> #include <Nazara/Prerequesites.hpp>
#include <Nazara/Math/Vector2.hpp> #include <Nazara/Math/Vector2.hpp>
#include <Nazara/Utility/Config.hpp> #include <Nazara/Platform/Config.hpp>
namespace Nz namespace Nz
{ {
class Window; class Window;
class NAZARA_UTILITY_API Mouse class NAZARA_PLATFORM_API Mouse
{ {
public: public:
enum Button enum Button

View File

@ -0,0 +1,33 @@
// 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
#pragma once
#ifndef NAZARA_PLATFORM_HPP
#define NAZARA_PLATFORM_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/Initializer.hpp>
#include <Nazara/Platform/Config.hpp>
namespace Nz
{
class NAZARA_PLATFORM_API Platform
{
public:
Platform() = delete;
~Platform() = delete;
static bool Initialize();
static bool IsInitialized();
static void Uninitialize();
private:
static unsigned int s_moduleReferenceCounter;
};
}
#endif // NAZARA_PLATFORM_HPP

View File

@ -1,5 +1,5 @@
// Copyright (C) 2017 Jérôme Leclercq // 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 // For conditions of distribution and use, see copyright notice in Config.hpp
// Interface inspirée de la SFML par Laurent Gomila // Interface inspirée de la SFML par Laurent Gomila
@ -10,12 +10,12 @@
#define NAZARA_VIDEOMODE_HPP #define NAZARA_VIDEOMODE_HPP
#include <Nazara/Prerequesites.hpp> #include <Nazara/Prerequesites.hpp>
#include <Nazara/Utility/Config.hpp> #include <Nazara/Platform/Config.hpp>
#include <vector> #include <vector>
namespace Nz namespace Nz
{ {
class NAZARA_UTILITY_API VideoMode class NAZARA_PLATFORM_API VideoMode
{ {
public: public:
VideoMode(); VideoMode();

View File

@ -1,5 +1,5 @@
// Copyright (C) 2017 Jérôme Leclercq // 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 // For conditions of distribution and use, see copyright notice in Config.hpp
// Interface inspirée de la SFML par Laurent Gomila // Interface inspirée de la SFML par Laurent Gomila
@ -14,14 +14,14 @@
#include <Nazara/Core/Mutex.hpp> #include <Nazara/Core/Mutex.hpp>
#include <Nazara/Core/String.hpp> #include <Nazara/Core/String.hpp>
#include <Nazara/Math/Vector2.hpp> #include <Nazara/Math/Vector2.hpp>
#include <Nazara/Utility/Config.hpp> #include <Nazara/Platform/Config.hpp>
#include <Nazara/Utility/Cursor.hpp> #include <Nazara/Platform/Cursor.hpp>
#include <Nazara/Utility/CursorController.hpp> #include <Nazara/Platform/CursorController.hpp>
#include <Nazara/Utility/Enums.hpp> #include <Nazara/Platform/Enums.hpp>
#include <Nazara/Utility/EventHandler.hpp> #include <Nazara/Platform/EventHandler.hpp>
#include <Nazara/Utility/Icon.hpp> #include <Nazara/Platform/Icon.hpp>
#include <Nazara/Utility/VideoMode.hpp> #include <Nazara/Platform/VideoMode.hpp>
#include <Nazara/Utility/WindowHandle.hpp> #include <Nazara/Platform/WindowHandle.hpp>
#include <queue> #include <queue>
namespace Nz namespace Nz
@ -29,11 +29,11 @@ namespace Nz
class Image; class Image;
class WindowImpl; class WindowImpl;
class NAZARA_UTILITY_API Window class NAZARA_PLATFORM_API Window
{ {
friend WindowImpl; friend WindowImpl;
friend class Mouse; friend class Mouse;
friend class Utility; friend class Platform;
public: public:
Window(); Window();
@ -138,6 +138,6 @@ namespace Nz
}; };
} }
#include <Nazara/Utility/Window.inl> #include <Nazara/Platform/Window.inl>
#endif // NAZARA_WINDOW_HPP #endif // NAZARA_WINDOW_HPP

View File

@ -1,11 +1,11 @@
// Copyright (C) 2017 Jérôme Leclercq // Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Engine - Core module" // This file is part of the "Nazara Engine - Platform module"
// For conditions of distribution and use, see copyright notice in Config.hpp // 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/ErrorFlags.hpp> #include <Nazara/Core/ErrorFlags.hpp>
#include <Nazara/Core/LockGuard.hpp> #include <Nazara/Core/LockGuard.hpp>
#include <Nazara/Utility/Debug.hpp> #include <Nazara/Platform/Debug.hpp>
namespace Nz namespace Nz
{ {
@ -173,4 +173,4 @@ namespace Nz
} }
} }
#include <Nazara/Utility/DebugOff.hpp> #include <Nazara/Platform/DebugOff.hpp>

View File

@ -1,5 +1,5 @@
// Copyright (C) 2017 Jérôme Leclercq // 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 // For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once #pragma once

View File

@ -9,8 +9,8 @@
#include <Nazara/Renderer/Config.hpp> #include <Nazara/Renderer/Config.hpp>
#include <Nazara/Renderer/RenderTargetParameters.hpp> #include <Nazara/Renderer/RenderTargetParameters.hpp>
#include <Nazara/Utility/VideoMode.hpp> #include <Nazara/Platform/VideoMode.hpp>
#include <Nazara/Utility/WindowHandle.hpp> #include <Nazara/Platform/WindowHandle.hpp>
namespace Nz namespace Nz
{ {

View File

@ -16,7 +16,7 @@
#include <Nazara/Renderer/Config.hpp> #include <Nazara/Renderer/Config.hpp>
#include <Nazara/Renderer/ContextParameters.hpp> #include <Nazara/Renderer/ContextParameters.hpp>
#include <Nazara/Renderer/RenderTarget.hpp> #include <Nazara/Renderer/RenderTarget.hpp>
#include <Nazara/Utility/Window.hpp> #include <Nazara/Platform/Window.hpp>
#include <vector> #include <vector>
namespace Nz namespace Nz

View File

@ -39,27 +39,19 @@
#include <Nazara/Utility/BufferMapper.hpp> #include <Nazara/Utility/BufferMapper.hpp>
#include <Nazara/Utility/Config.hpp> #include <Nazara/Utility/Config.hpp>
#include <Nazara/Utility/CubemapParams.hpp> #include <Nazara/Utility/CubemapParams.hpp>
#include <Nazara/Utility/Cursor.hpp>
#include <Nazara/Utility/CursorController.hpp>
#include <Nazara/Utility/Enums.hpp> #include <Nazara/Utility/Enums.hpp>
#include <Nazara/Utility/Event.hpp>
#include <Nazara/Utility/EventHandler.hpp>
#include <Nazara/Utility/Font.hpp> #include <Nazara/Utility/Font.hpp>
#include <Nazara/Utility/FontData.hpp> #include <Nazara/Utility/FontData.hpp>
#include <Nazara/Utility/FontGlyph.hpp> #include <Nazara/Utility/FontGlyph.hpp>
#include <Nazara/Utility/GuillotineImageAtlas.hpp> #include <Nazara/Utility/GuillotineImageAtlas.hpp>
#include <Nazara/Utility/Icon.hpp>
#include <Nazara/Utility/Image.hpp> #include <Nazara/Utility/Image.hpp>
#include <Nazara/Utility/IndexBuffer.hpp> #include <Nazara/Utility/IndexBuffer.hpp>
#include <Nazara/Utility/IndexIterator.hpp> #include <Nazara/Utility/IndexIterator.hpp>
#include <Nazara/Utility/IndexMapper.hpp> #include <Nazara/Utility/IndexMapper.hpp>
#include <Nazara/Utility/Joint.hpp> #include <Nazara/Utility/Joint.hpp>
#include <Nazara/Utility/Joystick.hpp>
#include <Nazara/Utility/Keyboard.hpp>
#include <Nazara/Utility/MaterialData.hpp> #include <Nazara/Utility/MaterialData.hpp>
#include <Nazara/Utility/Mesh.hpp> #include <Nazara/Utility/Mesh.hpp>
#include <Nazara/Utility/MeshData.hpp> #include <Nazara/Utility/MeshData.hpp>
#include <Nazara/Utility/Mouse.hpp>
#include <Nazara/Utility/Node.hpp> #include <Nazara/Utility/Node.hpp>
#include <Nazara/Utility/PixelFormat.hpp> #include <Nazara/Utility/PixelFormat.hpp>
#include <Nazara/Utility/Sequence.hpp> #include <Nazara/Utility/Sequence.hpp>
@ -75,8 +67,5 @@
#include <Nazara/Utility/VertexDeclaration.hpp> #include <Nazara/Utility/VertexDeclaration.hpp>
#include <Nazara/Utility/VertexMapper.hpp> #include <Nazara/Utility/VertexMapper.hpp>
#include <Nazara/Utility/VertexStruct.hpp> #include <Nazara/Utility/VertexStruct.hpp>
#include <Nazara/Utility/VideoMode.hpp>
#include <Nazara/Utility/Window.hpp>
#include <Nazara/Utility/WindowHandle.hpp>
#endif // NAZARA_GLOBAL_UTILITY_HPP #endif // NAZARA_GLOBAL_UTILITY_HPP

View File

@ -27,32 +27,29 @@
#ifndef NAZARA_CONFIG_UTILITY_HPP #ifndef NAZARA_CONFIG_UTILITY_HPP
#define NAZARA_CONFIG_UTILITY_HPP #define NAZARA_CONFIG_UTILITY_HPP
/// Chaque modification d'un paramètre du module nécessite une recompilation de celui-ci /// Each modification of a parameter needs a recompilation of the module
// Utilise un manager de mémoire pour gérer les allocations dynamiques (détecte les leaks au prix d'allocations/libérations dynamiques plus lentes) // Use the MemoryManager to manage dynamic allocations (can detect memory leak but allocations/frees are slower)
#define NAZARA_UTILITY_MANAGE_MEMORY 0 #define NAZARA_UTILITY_MANAGE_MEMORY 0
// Active les tests de sécurité basés sur le code (Conseillé pour le développement) // Activate the security tests based on the code (Advised for development)
#define NAZARA_UTILITY_SAFE 1 #define NAZARA_UTILITY_SAFE 1
// Lors du parsage d'une ressource, déclenche un avertissement si une erreur non-critique est repérée dans une ressource (Plus lent) // When a resource is being parsed, it triggers a warning if a non-critical error is found in the resource (Slower)
#define NAZARA_UTILITY_STRICT_RESOURCE_PARSING 1 #define NAZARA_UTILITY_STRICT_RESOURCE_PARSING 1
// Protège les classes des accès concurrentiels // Protect the classes against data race
//#define NAZARA_UTILITY_THREADSAFE 1 //#define NAZARA_UTILITY_THREADSAFE 1
// Force les buffers à posséder un stride multiple de 32 bytes (Gain de performances sur certaines cartes/plus de consommation mémoire) // Force the buffers to have a stride which is a multiple of 32 bytes (Gain of performances on certain cards/more memory consumption)
#define NAZARA_UTILITY_VERTEX_DECLARATION_FORCE_STRIDE_MULTIPLE_OF_32 0 ///FIXME: Ne peut pas être utilisé pour l'instant #define NAZARA_UTILITY_VERTEX_DECLARATION_FORCE_STRIDE_MULTIPLE_OF_32 0 ///FIXME: Can not be used for the moment
// Sous Windows, fait en sorte que les touches ALT et F10 n'activent pas le menu de la fenêtre /// Each modification of a parameter following implies a modification (often minor) of the code
#define NAZARA_UTILITY_WINDOWS_DISABLE_MENU_KEYS 1
/// Chaque modification d'un paramètre ci-dessous implique une modification (souvent mineure) du code // The maximal number of weights acting on a vertex (In case of overflow, the surnumerous weights would be ignored and the others renormalized)
// Le nombre maximum de poids affectant un sommet (En cas de dépassement, les poids supplémentaires seront ignorés et les autres renormalisés)
#define NAZARA_UTILITY_SKINNING_MAX_WEIGHTS 4 #define NAZARA_UTILITY_SKINNING_MAX_WEIGHTS 4
/// Vérification des valeurs et types de certaines constantes /// Checking the values and types of certain constants
#include <Nazara/Utility/ConfigCheck.hpp> #include <Nazara/Utility/ConfigCheck.hpp>
#if defined(NAZARA_STATIC) #if defined(NAZARA_STATIC)

View File

@ -7,12 +7,12 @@
#ifndef NAZARA_CONFIG_CHECK_UTILITY_HPP #ifndef NAZARA_CONFIG_CHECK_UTILITY_HPP
#define NAZARA_CONFIG_CHECK_UTILITY_HPP #define NAZARA_CONFIG_CHECK_UTILITY_HPP
/// Ce fichier sert à vérifier la valeur des constantes du fichier Config.hpp /// This file is used to check the constant values defined in Config.hpp
#include <type_traits> #include <type_traits>
#define NazaraCheckTypeAndVal(name, type, op, val, err) static_assert(std::is_ ##type <decltype(name)>::value && name op val, #type err) #define NazaraCheckTypeAndVal(name, type, op, val, err) static_assert(std::is_ ##type <decltype(name)>::value && name op val, #type err)
// On force la valeur de MANAGE_MEMORY en mode debug // We force the value of MANAGE_MEMORY in debug
#if defined(NAZARA_DEBUG) && !NAZARA_UTILITY_MANAGE_MEMORY #if defined(NAZARA_DEBUG) && !NAZARA_UTILITY_MANAGE_MEMORY
#undef NAZARA_UTILITY_MANAGE_MEMORY #undef NAZARA_UTILITY_MANAGE_MEMORY
#define NAZARA_UTILITY_MANAGE_MEMORY 0 #define NAZARA_UTILITY_MANAGE_MEMORY 0

View File

@ -92,8 +92,8 @@ namespace Nz
enum CubemapFace enum CubemapFace
{ {
// Cette énumération est prévue pour remplacer l'argument "z" des méthodes de Image contenant un cubemap // This enumeration is intended to replace the "z" argument of Image's methods containing cubemap
// L'ordre est X, -X, Y, -Y, Z, -Z // The order is X, -X, Y, -Y, Z, -Z
CubemapFace_PositiveX = 0, CubemapFace_PositiveX = 0,
CubemapFace_PositiveY = 2, CubemapFace_PositiveY = 2,
CubemapFace_PositiveZ = 4, CubemapFace_PositiveZ = 4,
@ -307,30 +307,6 @@ namespace Nz
SamplerWrap_Max = SamplerWrap_Repeat SamplerWrap_Max = SamplerWrap_Repeat
}; };
enum SystemCursor
{
SystemCursor_Crosshair,
SystemCursor_Default,
SystemCursor_Hand,
SystemCursor_Help,
SystemCursor_Move,
SystemCursor_None,
SystemCursor_Pointer,
SystemCursor_Progress,
SystemCursor_ResizeE,
SystemCursor_ResizeN,
SystemCursor_ResizeNE,
SystemCursor_ResizeNW,
SystemCursor_ResizeS,
SystemCursor_ResizeSE,
SystemCursor_ResizeSW,
SystemCursor_ResizeW,
SystemCursor_Text,
SystemCursor_Wait,
SystemCursor_Max = SystemCursor_Wait
};
enum StencilOperation enum StencilOperation
{ {
StencilOperation_Decrement, StencilOperation_Decrement,
@ -370,7 +346,7 @@ namespace Nz
{ {
VertexComponent_Unused = -1, VertexComponent_Unused = -1,
// Nous nous limitons à 16 composants de sommets car c'est le minimum supporté par le GPU // We limit to 16 components by vertex since it's the minimal number supported by the GPU
VertexComponent_InstanceData0, VertexComponent_InstanceData0,
VertexComponent_InstanceData1, VertexComponent_InstanceData1,
VertexComponent_InstanceData2, VertexComponent_InstanceData2,
@ -398,7 +374,7 @@ namespace Nz
enum VertexLayout enum VertexLayout
{ {
// Déclarations destinées au rendu // Declarations meant for the rendering
VertexLayout_XY, VertexLayout_XY,
VertexLayout_XY_Color, VertexLayout_XY_Color,
VertexLayout_XY_UV, VertexLayout_XY_UV,
@ -411,57 +387,11 @@ namespace Nz
VertexLayout_XYZ_Normal_UV_Tangent_Skinning, VertexLayout_XYZ_Normal_UV_Tangent_Skinning,
VertexLayout_XYZ_UV, VertexLayout_XYZ_UV,
// Déclarations destinées à l'instancing // Declarations meant for the instancing
VertexLayout_Matrix4, VertexLayout_Matrix4,
VertexLayout_Max = VertexLayout_Matrix4 VertexLayout_Max = VertexLayout_Matrix4
}; };
enum WindowEventType
{
WindowEventType_GainedFocus,
WindowEventType_LostFocus,
WindowEventType_KeyPressed,
WindowEventType_KeyReleased,
WindowEventType_MouseButtonDoubleClicked,
WindowEventType_MouseButtonPressed,
WindowEventType_MouseButtonReleased,
WindowEventType_MouseEntered,
WindowEventType_MouseLeft,
WindowEventType_MouseMoved,
WindowEventType_MouseWheelMoved,
WindowEventType_Moved,
WindowEventType_Quit,
WindowEventType_Resized,
WindowEventType_TextEntered,
WindowEventType_Max = WindowEventType_TextEntered
};
enum WindowStyle
{
WindowStyle_None, ///< Window has no border nor titlebar.
WindowStyle_Fullscreen, ///< At the window creation, the OS tries to set it in fullscreen.
WindowStyle_Closable, ///< Allows the window to be closed by a button in the titlebar, generating a Quit event.
WindowStyle_Resizable, ///< Allows the window to be resized by dragging its corners or by a button of the titlebar.
WindowStyle_Titlebar, ///< Adds a titlebar to the window, this option is automatically enabled if buttons of the titlebar are enabled.
WindowStyle_Threaded, ///< Runs the window into a thread, allowing the application to keep updating while resizing/dragging the window.
WindowStyle_Max = WindowStyle_Threaded
};
template<>
struct EnumAsFlags<WindowStyle>
{
static constexpr bool value = true;
static constexpr int max = WindowStyle_Max;
};
using WindowStyleFlags = Flags<WindowStyle>;
constexpr WindowStyleFlags WindowStyle_Default = WindowStyle_Closable | WindowStyle_Resizable | WindowStyle_Titlebar;
} }
#endif // NAZARA_ENUMS_UTILITY_HPP #endif // NAZARA_ENUMS_UTILITY_HPP

View File

@ -9,7 +9,6 @@
#include <Nazara/Prerequesites.hpp> #include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/Initializer.hpp> #include <Nazara/Core/Initializer.hpp>
#include <Nazara/Core/ParameterList.hpp>
#include <Nazara/Utility/Config.hpp> #include <Nazara/Utility/Config.hpp>
#include <Nazara/Utility/Enums.hpp> #include <Nazara/Utility/Enums.hpp>
@ -25,15 +24,12 @@ namespace Nz
static bool IsInitialized(); static bool IsInitialized();
static void SetParameters(const ParameterList& parameters);
static void Uninitialize(); static void Uninitialize();
static unsigned int ComponentCount[ComponentType_Max+1]; static unsigned int ComponentCount[ComponentType_Max+1];
static std::size_t ComponentStride[ComponentType_Max+1]; static std::size_t ComponentStride[ComponentType_Max+1];
private: private:
static ParameterList s_initializationParameters;
static unsigned int s_moduleReferenceCounter; static unsigned int s_moduleReferenceCounter;
}; };
} }

View File

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

View File

@ -1,18 +1,18 @@
// Copyright (C) 2017 Jérôme Leclercq // 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 // 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) #if defined(NAZARA_PLATFORM_WINDOWS)
#include <Nazara/Utility/Win32/CursorImpl.hpp> #include <Nazara/Platform/Win32/CursorImpl.hpp>
#elif defined(NAZARA_PLATFORM_X11) #elif defined(NAZARA_PLATFORM_X11)
#include <Nazara/Utility/X11/CursorImpl.hpp> #include <Nazara/Platform/X11/CursorImpl.hpp>
#else #else
#error Lack of implementation: Cursor #error Lack of implementation: Cursor
#endif #endif
#include <Nazara/Utility/Debug.hpp> #include <Nazara/Platform/Debug.hpp>
namespace Nz 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 // 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 // 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) #if defined(NAZARA_PLATFORM_WINDOWS)
#include <Nazara/Utility/Win32/IconImpl.hpp> #include <Nazara/Platform/Win32/IconImpl.hpp>
#elif defined(NAZARA_PLATFORM_X11) #elif defined(NAZARA_PLATFORM_X11)
#include <Nazara/Utility/X11/IconImpl.hpp> #include <Nazara/Platform/X11/IconImpl.hpp>
#else #else
#error Lack of implementation: Icon #error Lack of implementation: Icon
#endif #endif
#include <Nazara/Utility/Debug.hpp> #include <Nazara/Platform/Debug.hpp>
namespace Nz namespace Nz
{ {

View File

@ -1,18 +1,18 @@
// Copyright (C) 2017 Jérôme Leclercq // 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 // 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) #if defined(NAZARA_PLATFORM_WINDOWS)
#include <Nazara/Utility/Win32/InputImpl.hpp> #include <Nazara/Platform/Win32/InputImpl.hpp>
#elif defined(NAZARA_PLATFORM_X11) #elif defined(NAZARA_PLATFORM_X11)
#include <Nazara/Utility/X11/InputImpl.hpp> #include <Nazara/Platform/X11/InputImpl.hpp>
#else #else
#error Lack of implementation: Keyboard #error Lack of implementation: Keyboard
#endif #endif
#include <Nazara/Utility/Debug.hpp> #include <Nazara/Platform/Debug.hpp>
namespace Nz namespace Nz
{ {

View File

@ -1,19 +1,19 @@
// Copyright (C) 2017 Jérôme Leclercq // 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 // For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Utility/Mouse.hpp> #include <Nazara/Platform/Mouse.hpp>
#include <Nazara/Utility/Window.hpp> #include <Nazara/Platform/Window.hpp>
#if defined(NAZARA_PLATFORM_WINDOWS) #if defined(NAZARA_PLATFORM_WINDOWS)
#include <Nazara/Utility/Win32/InputImpl.hpp> #include <Nazara/Platform/Win32/InputImpl.hpp>
#elif defined(NAZARA_PLATFORM_X11) #elif defined(NAZARA_PLATFORM_X11)
#include <Nazara/Utility/X11/InputImpl.hpp> #include <Nazara/Platform/X11/InputImpl.hpp>
#else #else
#error Lack of implementation: Mouse #error Lack of implementation: Mouse
#endif #endif
#include <Nazara/Utility/Debug.hpp> #include <Nazara/Platform/Debug.hpp>
namespace Nz 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 // 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 // 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 <algorithm>
#include <functional> #include <functional>
#if defined(NAZARA_PLATFORM_WINDOWS) #if defined(NAZARA_PLATFORM_WINDOWS)
#include <Nazara/Utility/Win32/VideoModeImpl.hpp> #include <Nazara/Platform/Win32/VideoModeImpl.hpp>
#elif defined(NAZARA_PLATFORM_X11) #elif defined(NAZARA_PLATFORM_X11)
#include <Nazara/Utility/X11/VideoModeImpl.hpp> #include <Nazara/Platform/X11/VideoModeImpl.hpp>
#else #else
#error Lack of implementation: Window #error Lack of implementation: Window
#endif #endif
#include <Nazara/Utility/Debug.hpp> #include <Nazara/Platform/Debug.hpp>
namespace Nz namespace Nz
{ {

View File

@ -1,5 +1,5 @@
// Copyright (C) 2017 Jérôme Leclercq // 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 // For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once #pragma once

View File

@ -1,12 +1,12 @@
// Copyright (C) 2017 Jérôme Leclercq // 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 // 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/Core/Error.hpp>
#include <Nazara/Utility/Image.hpp> #include <Nazara/Utility/Image.hpp>
#include <Nazara/Utility/PixelFormat.hpp> #include <Nazara/Utility/PixelFormat.hpp>
#include <Nazara/Utility/Debug.hpp> #include <Nazara/Platform/Debug.hpp>
namespace Nz namespace Nz
{ {

View File

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

View File

@ -1,11 +1,11 @@
// Copyright (C) 2017 Jérôme Leclercq // 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 // 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/Image.hpp>
#include <Nazara/Utility/PixelFormat.hpp> #include <Nazara/Utility/PixelFormat.hpp>
#include <Nazara/Utility/Debug.hpp> #include <Nazara/Platform/Debug.hpp>
namespace Nz namespace Nz
{ {

View File

@ -1,5 +1,5 @@
// Copyright (C) 2017 Jérôme Leclercq // 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 // For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once #pragma once

View File

@ -1,12 +1,12 @@
// Copyright (C) 2017 Jérôme Leclercq // 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 // 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/Core/Error.hpp>
#include <Nazara/Utility/Window.hpp> #include <Nazara/Platform/Window.hpp>
#include <windows.h> #include <windows.h>
#include <Nazara/Utility/Debug.hpp> #include <Nazara/Platform/Debug.hpp>
namespace Nz namespace Nz
{ {

View File

@ -1,5 +1,5 @@
// Copyright (C) 2017 Jérôme Leclercq // 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 // For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once #pragma once
@ -9,8 +9,8 @@
#include <Nazara/Math/Vector2.hpp> #include <Nazara/Math/Vector2.hpp>
#include <Nazara/Core/String.hpp> #include <Nazara/Core/String.hpp>
#include <Nazara/Utility/Keyboard.hpp> #include <Nazara/Platform/Keyboard.hpp>
#include <Nazara/Utility/Mouse.hpp> #include <Nazara/Platform/Mouse.hpp>
namespace Nz namespace Nz
{ {

View File

@ -1,12 +1,12 @@
// Copyright (C) 2017 Jérôme Leclercq // 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 // For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Utility/Win32/VideoModeImpl.hpp> #include <Nazara/Platform/Win32/VideoModeImpl.hpp>
#include <Nazara/Utility/VideoMode.hpp> #include <Nazara/Platform/VideoMode.hpp>
#include <algorithm> #include <algorithm>
#include <windows.h> #include <windows.h>
#include <Nazara/Utility/Debug.hpp> #include <Nazara/Platform/Debug.hpp>
namespace Nz namespace Nz
{ {

View File

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

View File

@ -1,24 +1,24 @@
// Copyright (C) 2017 Jérôme Leclercq // 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 // 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 // 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/ConditionVariable.hpp>
#include <Nazara/Core/Error.hpp> #include <Nazara/Core/Error.hpp>
#include <Nazara/Core/Mutex.hpp> #include <Nazara/Core/Mutex.hpp>
#include <Nazara/Core/Thread.hpp> #include <Nazara/Core/Thread.hpp>
#include <Nazara/Utility/Config.hpp> #include <Nazara/Platform/Config.hpp>
#include <Nazara/Utility/Cursor.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/Image.hpp>
#include <Nazara/Utility/Icon.hpp>
#include <Nazara/Utility/Win32/CursorImpl.hpp>
#include <Nazara/Utility/Win32/IconImpl.hpp>
#include <cstdio> #include <cstdio>
#include <memory> #include <memory>
#include <windowsx.h> #include <windowsx.h>
#include <Nazara/Utility/Debug.hpp> #include <Nazara/Platform/Debug.hpp>
#ifdef _WIN64 #ifdef _WIN64
#define GCL_HCURSOR GCLP_HCURSOR #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 // http://msdn.microsoft.com/en-us/library/windows/desktop/ms646360(v=vs.85).aspx
if (message == WM_SYSCOMMAND && wParam == SC_KEYMENU) if (message == WM_SYSCOMMAND && wParam == SC_KEYMENU)
return true; return true;

View File

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

View File

@ -1,26 +1,26 @@
// Copyright (C) 2017 Jérôme Leclercq // 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 // 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/CallOnExit.hpp>
#include <Nazara/Core/Error.hpp> #include <Nazara/Core/Error.hpp>
#include <Nazara/Core/ErrorFlags.hpp> #include <Nazara/Core/ErrorFlags.hpp>
#include <Nazara/Core/LockGuard.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/Image.hpp>
#include <Nazara/Utility/Icon.hpp>
#include <stdexcept> #include <stdexcept>
#if defined(NAZARA_PLATFORM_WINDOWS) #if defined(NAZARA_PLATFORM_WINDOWS)
#include <Nazara/Utility/Win32/WindowImpl.hpp> #include <Nazara/Platform/Win32/WindowImpl.hpp>
#elif defined(NAZARA_PLATFORM_X11) #elif defined(NAZARA_PLATFORM_X11)
#include <Nazara/Utility/X11/WindowImpl.hpp> #include <Nazara/Platform/X11/WindowImpl.hpp>
#else #else
#error Lack of implementation: Window #error Lack of implementation: Window
#endif #endif
#include <Nazara/Utility/Debug.hpp> #include <Nazara/Platform/Debug.hpp>
namespace Nz namespace Nz
{ {
@ -50,7 +50,7 @@ namespace Nz
bool Window::Create(VideoMode mode, const String& title, WindowStyleFlags style) 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(); bool opened = IsOpen();
Vector2i position; Vector2i position;
if (opened) if (opened)
@ -58,7 +58,7 @@ namespace Nz
Destroy(); 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 (style & WindowStyle_Fullscreen)
{ {
if (fullscreenWindow) if (fullscreenWindow)
@ -101,7 +101,7 @@ namespace Nz
return false; return false;
} }
// Paramètres par défaut // Default parameters
m_impl->EnableKeyRepeat(true); m_impl->EnableKeyRepeat(true);
m_impl->EnableSmoothScrolling(false); m_impl->EnableSmoothScrolling(false);
m_impl->SetMaximumSize(-1, -1); m_impl->SetMaximumSize(-1, -1);
@ -169,7 +169,7 @@ namespace Nz
void Window::EnableKeyRepeat(bool enable) void Window::EnableKeyRepeat(bool enable)
{ {
#if NAZARA_UTILITY_SAFE #if NAZARA_PLATFORM_SAFE
if (!m_impl) if (!m_impl)
{ {
NazaraError("Window not created"); NazaraError("Window not created");
@ -182,7 +182,7 @@ namespace Nz
void Window::EnableSmoothScrolling(bool enable) void Window::EnableSmoothScrolling(bool enable)
{ {
#if NAZARA_UTILITY_SAFE #if NAZARA_PLATFORM_SAFE
if (!m_impl) if (!m_impl)
{ {
NazaraError("Window not created"); NazaraError("Window not created");
@ -195,7 +195,7 @@ namespace Nz
WindowHandle Window::GetHandle() const WindowHandle Window::GetHandle() const
{ {
#if NAZARA_UTILITY_SAFE #if NAZARA_PLATFORM_SAFE
if (!m_impl) if (!m_impl)
{ {
NazaraError("Window not created"); NazaraError("Window not created");
@ -208,7 +208,7 @@ namespace Nz
unsigned int Window::GetHeight() const unsigned int Window::GetHeight() const
{ {
#if NAZARA_UTILITY_SAFE #if NAZARA_PLATFORM_SAFE
if (!m_impl) if (!m_impl)
{ {
NazaraError("Window not created"); NazaraError("Window not created");
@ -221,7 +221,7 @@ namespace Nz
Vector2i Window::GetPosition() const Vector2i Window::GetPosition() const
{ {
#if NAZARA_UTILITY_SAFE #if NAZARA_PLATFORM_SAFE
if (!m_impl) if (!m_impl)
{ {
NazaraError("Window not created"); NazaraError("Window not created");
@ -234,7 +234,7 @@ namespace Nz
Vector2ui Window::GetSize() const Vector2ui Window::GetSize() const
{ {
#if NAZARA_UTILITY_SAFE #if NAZARA_PLATFORM_SAFE
if (!m_impl) if (!m_impl)
{ {
NazaraError("Window not created"); NazaraError("Window not created");
@ -247,7 +247,7 @@ namespace Nz
WindowStyleFlags Window::GetStyle() const WindowStyleFlags Window::GetStyle() const
{ {
#if NAZARA_UTILITY_SAFE #if NAZARA_PLATFORM_SAFE
if (!m_impl) if (!m_impl)
{ {
NazaraError("Window not created"); NazaraError("Window not created");
@ -260,7 +260,7 @@ namespace Nz
String Window::GetTitle() const String Window::GetTitle() const
{ {
#if NAZARA_UTILITY_SAFE #if NAZARA_PLATFORM_SAFE
if (!m_impl) if (!m_impl)
{ {
NazaraError("Window not created"); NazaraError("Window not created");
@ -273,7 +273,7 @@ namespace Nz
unsigned int Window::GetWidth() const unsigned int Window::GetWidth() const
{ {
#if NAZARA_UTILITY_SAFE #if NAZARA_PLATFORM_SAFE
if (!m_impl) if (!m_impl)
{ {
NazaraError("Window not created"); NazaraError("Window not created");
@ -286,7 +286,7 @@ namespace Nz
bool Window::HasFocus() const bool Window::HasFocus() const
{ {
#if NAZARA_UTILITY_SAFE #if NAZARA_PLATFORM_SAFE
if (!m_impl) if (!m_impl)
{ {
NazaraError("Window not created"); NazaraError("Window not created");
@ -299,7 +299,7 @@ namespace Nz
bool Window::IsMinimized() const bool Window::IsMinimized() const
{ {
#if NAZARA_UTILITY_SAFE #if NAZARA_PLATFORM_SAFE
if (!m_impl) if (!m_impl)
{ {
NazaraError("Window not created"); NazaraError("Window not created");
@ -312,7 +312,7 @@ namespace Nz
bool Window::IsVisible() const bool Window::IsVisible() const
{ {
#if NAZARA_UTILITY_SAFE #if NAZARA_PLATFORM_SAFE
if (!m_impl) if (!m_impl)
{ {
NazaraError("Window not created"); NazaraError("Window not created");
@ -325,7 +325,7 @@ namespace Nz
bool Window::PollEvent(WindowEvent* event) bool Window::PollEvent(WindowEvent* event)
{ {
#if NAZARA_UTILITY_SAFE #if NAZARA_PLATFORM_SAFE
if (!m_impl) if (!m_impl)
{ {
NazaraError("Window not created"); NazaraError("Window not created");
@ -378,7 +378,7 @@ namespace Nz
void Window::SetEventListener(bool listener) void Window::SetEventListener(bool listener)
{ {
#if NAZARA_UTILITY_SAFE #if NAZARA_PLATFORM_SAFE
if (!m_impl) if (!m_impl)
{ {
NazaraError("Window not created"); NazaraError("Window not created");
@ -397,7 +397,7 @@ namespace Nz
void Window::SetFocus() void Window::SetFocus()
{ {
#if NAZARA_UTILITY_SAFE #if NAZARA_PLATFORM_SAFE
if (!m_impl) if (!m_impl)
{ {
NazaraError("Window not created"); NazaraError("Window not created");
@ -419,7 +419,7 @@ namespace Nz
void Window::SetMaximumSize(const Vector2i& maxSize) void Window::SetMaximumSize(const Vector2i& maxSize)
{ {
#if NAZARA_UTILITY_SAFE #if NAZARA_PLATFORM_SAFE
if (!m_impl) if (!m_impl)
{ {
NazaraError("Window not created"); NazaraError("Window not created");
@ -432,7 +432,7 @@ namespace Nz
void Window::SetMaximumSize(int width, int height) void Window::SetMaximumSize(int width, int height)
{ {
#if NAZARA_UTILITY_SAFE #if NAZARA_PLATFORM_SAFE
if (!m_impl) if (!m_impl)
{ {
NazaraError("Window not created"); NazaraError("Window not created");
@ -445,7 +445,7 @@ namespace Nz
void Window::SetMinimumSize(const Vector2i& minSize) void Window::SetMinimumSize(const Vector2i& minSize)
{ {
#if NAZARA_UTILITY_SAFE #if NAZARA_PLATFORM_SAFE
if (!m_impl) if (!m_impl)
{ {
NazaraError("Window not created"); NazaraError("Window not created");
@ -458,7 +458,7 @@ namespace Nz
void Window::SetMinimumSize(int width, int height) void Window::SetMinimumSize(int width, int height)
{ {
#if NAZARA_UTILITY_SAFE #if NAZARA_PLATFORM_SAFE
if (!m_impl) if (!m_impl)
{ {
NazaraError("Window not created"); NazaraError("Window not created");
@ -471,7 +471,7 @@ namespace Nz
void Window::SetPosition(const Vector2i& position) void Window::SetPosition(const Vector2i& position)
{ {
#if NAZARA_UTILITY_SAFE #if NAZARA_PLATFORM_SAFE
if (!m_impl) if (!m_impl)
{ {
NazaraError("Window not created"); NazaraError("Window not created");
@ -484,7 +484,7 @@ namespace Nz
void Window::SetPosition(int x, int y) void Window::SetPosition(int x, int y)
{ {
#if NAZARA_UTILITY_SAFE #if NAZARA_PLATFORM_SAFE
if (!m_impl) if (!m_impl)
{ {
NazaraError("Window not created"); NazaraError("Window not created");
@ -497,7 +497,7 @@ namespace Nz
void Window::SetSize(const Vector2i& size) void Window::SetSize(const Vector2i& size)
{ {
#if NAZARA_UTILITY_SAFE #if NAZARA_PLATFORM_SAFE
if (!m_impl) if (!m_impl)
{ {
NazaraError("Window not created"); NazaraError("Window not created");
@ -510,7 +510,7 @@ namespace Nz
void Window::SetSize(unsigned int width, unsigned int height) void Window::SetSize(unsigned int width, unsigned int height)
{ {
#if NAZARA_UTILITY_SAFE #if NAZARA_PLATFORM_SAFE
if (!m_impl) if (!m_impl)
{ {
NazaraError("Window not created"); NazaraError("Window not created");
@ -523,7 +523,7 @@ namespace Nz
void Window::SetStayOnTop(bool stayOnTop) void Window::SetStayOnTop(bool stayOnTop)
{ {
#if NAZARA_UTILITY_SAFE #if NAZARA_PLATFORM_SAFE
if (!m_impl) if (!m_impl)
{ {
NazaraError("Window not created"); NazaraError("Window not created");
@ -536,7 +536,7 @@ namespace Nz
void Window::SetTitle(const String& title) void Window::SetTitle(const String& title)
{ {
#if NAZARA_UTILITY_SAFE #if NAZARA_PLATFORM_SAFE
if (!m_impl) if (!m_impl)
{ {
NazaraError("Window not created"); NazaraError("Window not created");
@ -549,7 +549,7 @@ namespace Nz
void Window::SetVisible(bool visible) void Window::SetVisible(bool visible)
{ {
#if NAZARA_UTILITY_SAFE #if NAZARA_PLATFORM_SAFE
if (!m_impl) if (!m_impl)
{ {
NazaraError("Window not created"); NazaraError("Window not created");
@ -562,7 +562,7 @@ namespace Nz
bool Window::WaitEvent(WindowEvent* event) bool Window::WaitEvent(WindowEvent* event)
{ {
#if NAZARA_UTILITY_SAFE #if NAZARA_PLATFORM_SAFE
if (!m_impl) if (!m_impl)
{ {
NazaraError("Window not created"); NazaraError("Window not created");
@ -626,7 +626,7 @@ namespace Nz
void Window::IgnoreNextMouseEvent(int mouseX, int mouseY) const void Window::IgnoreNextMouseEvent(int mouseX, int mouseY) const
{ {
#if NAZARA_UTILITY_SAFE #if NAZARA_PLATFORM_SAFE
if (!m_impl) if (!m_impl)
{ {
NazaraError("Window not created"); NazaraError("Window not created");

View File

@ -1,13 +1,13 @@
// Copyright (C) 2015 Jérôme Leclercq // 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 // 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/CallOnExit.hpp>
#include <Nazara/Core/Error.hpp> #include <Nazara/Core/Error.hpp>
#include <Nazara/Utility/Image.hpp> #include <Nazara/Utility/Image.hpp>
#include <Nazara/Utility/PixelFormat.hpp> #include <Nazara/Utility/PixelFormat.hpp>
#include <Nazara/Utility/X11/Display.hpp> #include <Nazara/Platform/X11/Display.hpp>
#include <xcb/xcb_image.h> #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 // 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 #undef template
#include <Nazara/Utility/Debug.hpp> #include <Nazara/Platform/Debug.hpp>
namespace Nz namespace Nz
{ {

View File

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

View File

@ -1,14 +1,14 @@
// Copyright (C) 2015 Jérôme Leclercq // 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 // 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/Error.hpp>
#include <Nazara/Core/Log.hpp> #include <Nazara/Core/Log.hpp>
#include <Nazara/Core/String.hpp> #include <Nazara/Core/String.hpp>
#include <xcb/xcb_keysyms.h> #include <xcb/xcb_keysyms.h>
#include <map> #include <map>
#include <Nazara/Utility/Debug.hpp> #include <Nazara/Platform/Debug.hpp>
namespace Nz namespace Nz
{ {

View File

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

View File

@ -1,14 +1,14 @@
// Copyright (C) 2015 Jérôme Leclercq // 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 // 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/CallOnExit.hpp>
#include <Nazara/Core/Error.hpp> #include <Nazara/Core/Error.hpp>
#include <Nazara/Utility/Image.hpp> #include <Nazara/Utility/Image.hpp>
#include <Nazara/Utility/PixelFormat.hpp> #include <Nazara/Utility/PixelFormat.hpp>
#include <Nazara/Utility/X11/Display.hpp> #include <Nazara/Platform/X11/Display.hpp>
#include <Nazara/Utility/Debug.hpp> #include <Nazara/Platform/Debug.hpp>
namespace Nz namespace Nz
{ {

View File

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

View File

@ -1,16 +1,16 @@
// Copyright (C) 2015 Jérôme Leclercq // 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 // 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/Core/Error.hpp>
#include <Nazara/Utility/Window.hpp> #include <Nazara/Platform/Window.hpp>
#include <Nazara/Utility/X11/Display.hpp> #include <Nazara/Platform/X11/Display.hpp>
#include <X11/keysym.h> #include <X11/keysym.h>
#include <X11/XF86keysym.h> #include <X11/XF86keysym.h>
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <xcb/xcb_keysyms.h> #include <xcb/xcb_keysyms.h>
#include <Nazara/Utility/Debug.hpp> #include <Nazara/Platform/Debug.hpp>
namespace Nz namespace Nz
{ {

View File

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

View File

@ -1,12 +1,12 @@
// Copyright (C) 2015 Jérôme Leclercq // 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 // 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/Core/Error.hpp>
#include <Nazara/Utility/X11/Display.hpp> #include <Nazara/Platform/X11/Display.hpp>
#include <xcb/xcb_image.h> #include <xcb/xcb_image.h>
#include <Nazara/Utility/Debug.hpp> #include <Nazara/Platform/Debug.hpp>
namespace Nz namespace Nz
{ {

View File

@ -1,5 +1,5 @@
// Copyright (C) 2015 Jérôme Leclercq // 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 // For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once #pragma once
@ -95,6 +95,6 @@ namespace Nz
}; };
} }
#include <Nazara/Utility/X11/ScopedXCB.inl> #include <Nazara/Platform/X11/ScopedXCB.inl>
#endif // NAZARA_SCOPEDXCB_HPP #endif // NAZARA_SCOPEDXCB_HPP

View File

@ -1,9 +1,9 @@
// Copyright (C) 2017 Jérôme Leclercq // 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 // For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Core/Error.hpp> #include <Nazara/Core/Error.hpp>
#include <Nazara/Utility/Debug.hpp> #include <Nazara/Platform/Debug.hpp>
namespace Nz 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 // 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 // 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/Core/Error.hpp>
#include <Nazara/Utility/VideoMode.hpp> #include <Nazara/Platform/VideoMode.hpp>
#include <Nazara/Utility/X11/Display.hpp> #include <Nazara/Platform/X11/Display.hpp>
#include <xcb/randr.h> #include <xcb/randr.h>
#include <algorithm> #include <algorithm>
#include <Nazara/Utility/Debug.hpp> #include <Nazara/Platform/Debug.hpp>
namespace Nz namespace Nz
{ {

View File

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

View File

@ -1,26 +1,26 @@
// Copyright (C) 2015 Jérôme Leclercq // 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 // 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 // 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/CallOnExit.hpp>
#include <Nazara/Core/Error.hpp> #include <Nazara/Core/Error.hpp>
#include <Nazara/Utility/Cursor.hpp> #include <Nazara/Platform/Cursor.hpp>
#include <Nazara/Utility/Event.hpp> #include <Nazara/Platform/Event.hpp>
#include <Nazara/Utility/Icon.hpp> #include <Nazara/Platform/Icon.hpp>
#include <Nazara/Utility/VideoMode.hpp> #include <Nazara/Platform/VideoMode.hpp>
#include <Nazara/Utility/Window.hpp> #include <Nazara/Platform/Window.hpp>
#include <Nazara/Utility/X11/CursorImpl.hpp> #include <Nazara/Platform/X11/CursorImpl.hpp>
#include <Nazara/Utility/X11/IconImpl.hpp> #include <Nazara/Platform/X11/IconImpl.hpp>
#include <X11/keysym.h> #include <X11/keysym.h>
#include <X11/XF86keysym.h> #include <X11/XF86keysym.h>
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xutil.h> #include <X11/Xutil.h>
#include <xcb/xcb_cursor.h> #include <xcb/xcb_cursor.h>
#include <xcb/xcb_keysyms.h> #include <xcb/xcb_keysyms.h>
#include <Nazara/Utility/Debug.hpp> #include <Nazara/Platform/Debug.hpp>
/* /*
Things to do left: Things to do left:

View File

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

View File

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

View File

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

View File

@ -6,21 +6,15 @@
#include <Nazara/Core/CallOnExit.hpp> #include <Nazara/Core/CallOnExit.hpp>
#include <Nazara/Core/Core.hpp> #include <Nazara/Core/Core.hpp>
#include <Nazara/Core/Error.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/Animation.hpp>
#include <Nazara/Utility/Buffer.hpp> #include <Nazara/Utility/Buffer.hpp>
#include <Nazara/Utility/Config.hpp> #include <Nazara/Utility/Config.hpp>
#include <Nazara/Utility/Cursor.hpp>
#include <Nazara/Utility/Font.hpp> #include <Nazara/Utility/Font.hpp>
#include <Nazara/Utility/Image.hpp> #include <Nazara/Utility/Image.hpp>
#include <Nazara/Utility/Mesh.hpp> #include <Nazara/Utility/Mesh.hpp>
#include <Nazara/Utility/PixelFormat.hpp> #include <Nazara/Utility/PixelFormat.hpp>
#include <Nazara/Utility/Skeleton.hpp> #include <Nazara/Utility/Skeleton.hpp>
#include <Nazara/Utility/VertexDeclaration.hpp> #include <Nazara/Utility/VertexDeclaration.hpp>
#include <Nazara/Utility/Window.hpp>
#include <Nazara/Utility/Formats/DDSLoader.hpp> #include <Nazara/Utility/Formats/DDSLoader.hpp>
#include <Nazara/Utility/Formats/FreeTypeLoader.hpp> #include <Nazara/Utility/Formats/FreeTypeLoader.hpp>
#include <Nazara/Utility/Formats/MD2Loader.hpp> #include <Nazara/Utility/Formats/MD2Loader.hpp>
@ -35,15 +29,29 @@
namespace Nz 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() bool Utility::Initialize()
{ {
if (s_moduleReferenceCounter > 0) if (s_moduleReferenceCounter > 0)
{ {
s_moduleReferenceCounter++; s_moduleReferenceCounter++;
return true; // Déjà initialisé return true; // Already initialized
} }
// Initialisation des dépendances // Initialisation of dependencies
if (!Core::Initialize()) if (!Core::Initialize())
{ {
NazaraError("Failed to initialize core module"); NazaraError("Failed to initialize core module");
@ -103,23 +111,6 @@ namespace Nz
return false; 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 // On enregistre les loaders pour les extensions
// Il s'agit ici d'une liste LIFO, le dernier loader enregistré possède la priorité // 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; return s_moduleReferenceCounter != 0;
} }
void Utility::SetParameters(const ParameterList& parameters)
{
s_initializationParameters = parameters;
}
void Utility::Uninitialize() void Utility::Uninitialize()
{ {
if (s_moduleReferenceCounter != 1) if (s_moduleReferenceCounter != 1)
@ -188,9 +174,6 @@ namespace Nz
Loaders::UnregisterSTBLoader(); Loaders::UnregisterSTBLoader();
Loaders::UnregisterSTBSaver(); Loaders::UnregisterSTBSaver();
Cursor::Uninitialize(); //< Must be done before Window
Window::Uninitialize();
VertexDeclaration::Uninitialize(); VertexDeclaration::Uninitialize();
Skeleton::Uninitialize(); Skeleton::Uninitialize();
PixelFormat::Uninitialize(); PixelFormat::Uninitialize();
@ -246,6 +229,5 @@ namespace Nz
static_assert(ComponentType_Max+1 == 14, "Component stride array is incomplete"); static_assert(ComponentType_Max+1 == 14, "Component stride array is incomplete");
ParameterList Utility::s_initializationParameters;
unsigned int Utility::s_moduleReferenceCounter = 0; unsigned int Utility::s_moduleReferenceCounter = 0;
} }

View File

@ -25,7 +25,7 @@ Ndk::EntityHandle AddCamera(Ndk::World& world, Nz::RenderWindow& window);
- Text entered is never repeated - Text entered is never repeated
*/ */
SCENARIO("EventHandler", "[UTILITY][EVENTHANDLER][INTERACTIVE][.]") SCENARIO("EventHandler", "[PLATFORM][EVENTHANDLER][INTERACTIVE][.]")
{ {
GIVEN("An application") GIVEN("An application")
{ {

View File

@ -0,0 +1,39 @@
#include "BaseState.hpp"
#include "StateContext.hpp"
#include "StateFactory.hpp"
#include <Nazara/Renderer/RenderWindow.hpp>
#include <NDK/StateMachine.hpp>
BaseState::BaseState(StateContext& context) :
State(),
m_context(context),
m_text(context)
{
}
BaseState::~BaseState()
{
}
void BaseState::Enter(Ndk::StateMachine& fsm)
{
m_text.SetVisible(true);
DrawMenu();
}
void BaseState::Leave(Ndk::StateMachine& /*fsm*/)
{
m_text.SetVisible(false);
}
bool BaseState::Update(Ndk::StateMachine& /*fsm*/, float /*elapsedTime*/)
{
return true;
}
void BaseState::DrawMenu()
{
m_text.SetContent("This shouldn't be visible\nM for Menu");
}

Some files were not shown because too many files have changed in this diff Show More