//********************************************************************
// Ninfa3D Engine 
// copyright 2008-2009
// By Viz_Fuerte
// VC: 9.0
// Write
//********************************************************************

/*--------------------------------------------------------------------
Includos*/

	#include "..\..\..\Header Files\Ninfa3D.h"

/*--------------------------------------------------------------------
Variables externas*/

	extern IFileSystem* filesy;

/*--------------------------------------------------------------------
Declaration global de funciones*/

extern "C"
{

	/*====================================================================
	Carga un archivo para escribir*/

	DLL_EXPORT void* DLL_APIENTRY CreateWriteFile(const char* file)
	{
		IWriteFile* write = filesy->createAndWriteFile(file,false);
		return (void*)write;
	}

	/*====================================================================
	Escribe una variable INT

	DLL_EXPORT void DLL_APIENTRY WriteINT(IWriteFile* file,int string)
	{
		stringw TextoString(L"");
		TextoString.append(string);
		int TamanoChar;
		TamanoChar = TextoString.size();

		file->write(&string,TamanoChar);
	}*/

	/*====================================================================
	Escribe una variable FLOAT

	DLL_EXPORT void DLL_APIENTRY WriteFLOAT(IWriteFile* file,float string)
	{
		stringw TextoString(L"");
		TextoString.append(string);
		int TamanoChar;
		TamanoChar = TextoString.size();
		file->write(reinterpret_cast<const float*>(&string),TamanoChar);
	}*/

	/*====================================================================
	Escribe una variable CHAR*/
	DLL_EXPORT void DLL_APIENTRY WriteCHAR(IWriteFile* file,const char* string)
	{
		stringw TextoString(L"");
		TextoString.append(string);
		int TamanoChar;
		TamanoChar = TextoString.size();

		file->write(string,TamanoChar);
		file->seek(file->getPos(),false);
	}

	/*====================================================================
	Cierra el archivo*/

	DLL_EXPORT void DLL_APIENTRY CloseWrite(IWriteFile* file)
	{
		file->drop();
	}

}