Files
NazaraEngine/src/Nazara/Utility/Utility.cpp
Lynix b442ab0bd2 Refactored mathematics module
Added AABBs
Added code examples
Added experimental support for texture arrays (1D/2D)
Added initialisers (new way of initialising modules)
Added global headers (Plus a global header generator script)
Added pattern support for directory
Added support for spinlocks critical section on Windows
Added NzRenderWindow::SetFramerateLimit
Core project now includes Mathematics files
Fixed color implementation using double
Fixed declaration needing renderer include
Fixed MLT not clearing nextFree(File/Line) after Free
Fixed move operators not being noexcept
Fixed thread-safety (Now working correctly - If I'm lucky)
Moved Resource to core
New interface for modules
New interface for the renderer
Put some global functions to anonymous namespace
Removed empty modules
Renamed ThreadCondition to ConditionVariable
Replaced redirect to cerr log option by duplicate to cout
Setting mouse position relative to a window will make this window ignore
the event
Shaders sending methods no longer takes the uniform variable name (it's
using ID instead)
Using new OpenGL 4.3 header
2012-08-08 04:44:17 +02:00

94 lines
2.1 KiB
C++

// Copyright (C) 2012 Jérôme Leclercq
// This file is part of the "Nazara Engine".
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Utility/Utility.hpp>
#include <Nazara/Core/Core.hpp>
#include <Nazara/Core/Error.hpp>
#include <Nazara/Core/Log.hpp>
#include <Nazara/Utility/Buffer.hpp>
#include <Nazara/Utility/Config.hpp>
#include <Nazara/Utility/Loaders/MD2.hpp>
#include <Nazara/Utility/Loaders/PCX.hpp>
#include <Nazara/Utility/Loaders/STB.hpp>
#include <Nazara/Utility/PixelFormat.hpp>
#include <Nazara/Utility/Window.hpp>
#include <Nazara/Utility/Debug.hpp>
bool NzUtility::Initialize()
{
if (s_moduleReferenceCouter++ != 0)
return true; // Déjà initialisé
// Initialisation des dépendances
if (!NzCore::Initialize())
{
NazaraError("Failed to initialize core module");
return false;
}
// Initialisation du module
if (!NzBuffer::Initialize())
{
NazaraError("Failed to initialize buffers");
return false;
}
if (!NzPixelFormat::Initialize())
{
NazaraError("Failed to initialize pixel formats");
return false;
}
if (!NzWindow::Initialize())
{
NazaraError("Failed to initialize window's system");
NzPixelFormat::Uninitialize();
return false;
}
/// Loaders spécialisés
// Mesh
NzLoaders_MD2_Register(); // Loader de fichiers .MD2 (v8)
// Image
NzLoaders_PCX_Register(); // Loader de fichiers .PCX (1, 4, 8, 24)
/// Loaders génériques (En dernier pour donner la priorité aux loaders spécialisés)
// Image
NzLoaders_STB_Register(); // Loader générique (STB)
NazaraNotice("Initialized: Utility module");
return true;
}
bool NzUtility::IsInitialized()
{
return s_moduleReferenceCouter != 0;
}
void NzUtility::Uninitialize()
{
if (--s_moduleReferenceCouter != 0)
return; // Encore utilisé
// Libération du module
NzLoaders_MD2_Unregister();
NzLoaders_PCX_Unregister();
NzLoaders_STB_Unregister();
NzWindow::Uninitialize();
NzPixelFormat::Uninitialize();
NzBuffer::Uninitialize();
NazaraNotice("Uninitialized: Utility module");
// Libération des dépendances
NzCore::Uninitialize();
}
unsigned int NzUtility::s_moduleReferenceCouter = 0;