///////////////////////////////////////////////////////////////////////////////
/// @file Destiny3D.cpp
///
/// @brief main Destiny3D DLL
///
/// @author Assassin
///
/// This file is the intellectual property of Novus Delta, LLC.. Usage of the
/// contents of this file is subject to the Destiny3D Member License which
/// can be found at http://www.destiny3d.com.  Any other usage is prohibited.
///
/// This file is distributed "AS IS" without warranty of any kind.  Novus
/// Delta, LLC. does not guarantee the fitness of the contents of this file
/// for any particular purpose.
///
/// Copyright (C) 2001-2003 Novus Delta, LLC. All Rights Reserved.
///
/// <hr>
///                                 Change History
/// <hr>
///
/// @date Jul 2003
/// @author Assassin
/// @remarks Initial Creation
///
///////////////////////////////////////////////////////////////////////////////

#include "de2D.hpp"
#include "deAnimatedMesh.hpp"
#include "deBitmap.hpp"
#include "deBrush.hpp"
#include "deCamera.hpp"
#include "deConsole.hpp"
#include "deDriver.hpp"
#include "deFile.hpp"
#include "deFileSystem.hpp"
#include "deFont.hpp"
#include "deIDServer.hpp"
#include "deLine.hpp"
#include "deLog.hpp"
#include "deMath.hpp"
//#include "deMemory.hpp"
#include "deMeshOpt.hpp"
#include "dePlugins.hpp"
#include "dePortal.hpp"
#include "deProfile.hpp"
#include "deRender.hpp"
#include "deRenderStates.hpp"
#include "deResource.hpp"
#include "deScene.hpp"
#include "deSound.hpp"
#include "deString.hpp"
#include "deSurface.hpp"
#include "deWorld.hpp"
#include "deThread.hpp"

#include "Destiny3D.hpp"

#ifndef __GNUC__
#include <crtdbg.h> // dump memory leaks
#endif

#pragma message("Compiling under: " DESTINY3D_COMPILER)
#pragma message("Targeting CPU Architecture: " DE3D_CPU)

/// @todo implement a central factory class to handle initialization and creation
#pragma todo(implement a central factory class to handle initialization and creation)

#pragma todo(decide if this AppName is really necessary)
deBoolean Destiny3D_Init(const char* /*AppName*/)
{
	IdeAnimatedMesh_Initialize();
	IdeBitmap_Initialize();
	IdeBrush_Initialize();
	IdeDriver_Initialize();
	IdeRender_Initialize();
	IdeScene_Initialize();
	IdeProfile_GetTheManager();

	return deTRUE;
}

deBoolean Destiny3D_ShutDown(void)
{
	IdeWorld_ShutDown();

	IdeRender_DestroyDriverLinkages();
	IdeRender_Destroy();

	IdeScene_ShutDown();

	IdeResourceManager* manager = IdeResourceManager_GetManager();
	manager->RemoveAllResources();
	IdeResourceManager_ShutDown();
	IdeThreadPool_Destroy();

	IdeProfile_ShutDown();
	
	deConsole_DestroyConsole();
#ifndef __GNUC__
	_CrtDumpMemoryLeaks();
#endif

	return deTRUE;
}


