Updated module template
This commit is contained in:
parent
cef402c8a5
commit
47cdbbcdb0
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
Nazara Engine
|
Nazara Engine
|
||||||
|
|
||||||
Copyright (C) 2012 Jérôme "Lynix" Leclercq (Lynix680@gmail.com)
|
Copyright (C) 2012 AUTHORS (EMAIL)
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
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
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
|
@ -32,4 +32,7 @@
|
||||||
// Utilise un tracker pour repérer les éventuels leaks (Ralentit l'exécution)
|
// Utilise un tracker pour repérer les éventuels leaks (Ralentit l'exécution)
|
||||||
#define NAZARA_MODULENAME_MEMORYLEAKTRACKER 0
|
#define NAZARA_MODULENAME_MEMORYLEAKTRACKER 0
|
||||||
|
|
||||||
|
// Active les tests de sécurité basés sur le code (Conseillé pour le développement)
|
||||||
|
#define NAZARA_MODULENAME_SAFE 1
|
||||||
|
|
||||||
#endif // NAZARA_CONFIG_MODULENAME_HPP
|
#endif // NAZARA_CONFIG_MODULENAME_HPP
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2012 Jérôme Leclercq
|
// Copyright (C) 2012 AUTHORS
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine".
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2012 Jérôme Leclercq
|
// Copyright (C) 2012 AUTHORS
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine".
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
// Copyright (C) 2012 AUTHORS
|
||||||
|
// This file is part of the "Nazara Engine".
|
||||||
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef NAZARA_MODULENAME_HPP
|
||||||
|
#define NAZARA_MODULENAME_HPP
|
||||||
|
|
||||||
|
#include <Nazara/Prerequesites.hpp>
|
||||||
|
|
||||||
|
class NAZARA_API NzModuleName
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
NzModuleName();
|
||||||
|
~NzModuleName();
|
||||||
|
|
||||||
|
bool Initialize();
|
||||||
|
void Uninitialize();
|
||||||
|
|
||||||
|
static bool IsInitialized();
|
||||||
|
|
||||||
|
private:
|
||||||
|
static bool s_initialized;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // NAZARA_MODULENAME_HPP
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2012 Jérôme Leclercq
|
// Copyright (C) 2012 AUTHORS
|
||||||
// This file is part of the "Nazara Engine".
|
// This file is part of the "Nazara Engine".
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
// Copyright (C) 2012 AUTHORS
|
||||||
|
// This file is part of the "Nazara Engine".
|
||||||
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
#include <Nazara/ModuleName/ModuleName.hpp>
|
||||||
|
#include <Nazara/Core/Error.hpp>
|
||||||
|
#include <Nazara/ModuleName/Config.hpp>
|
||||||
|
|
||||||
|
NzModuleName::NzModuleName()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
NzModuleName::~NzModuleName()
|
||||||
|
{
|
||||||
|
if (s_initialized)
|
||||||
|
Uninitialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NzModuleName::Initialize()
|
||||||
|
{
|
||||||
|
#if NAZARA_MODULENAME_SAFE
|
||||||
|
if (s_initialized)
|
||||||
|
{
|
||||||
|
NazaraError("ModuleName already initialized");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void NzModuleName::Uninitialize()
|
||||||
|
{
|
||||||
|
#if NAZARA_MODULENAME_SAFE
|
||||||
|
if (!s_initialized)
|
||||||
|
{
|
||||||
|
NazaraError("ModuleName not initialized");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NzModuleName::IsInitialized()
|
||||||
|
{
|
||||||
|
return s_initialized;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NzModuleName::s_initialized = false;
|
||||||
Loading…
Reference in New Issue