--Создание и настройка окна программы
window_handle=WindowsCreate("Example: 'file-example'",WS_OVERLAPPED,WS_SYSMENU,0,0,0,800,600,0)
WindowCenter(window_handle)
WindowSetIcon(window_handle,"Logo.ico")

--Инициализация движков программы
Init_xtreme3d("xtreme3d.dll")--Графический
Init_file_dll("file_dll.dll")--Редактирование файлов

--Настройка компонентов графического движка
xEngineCreate();

bgColor=cDkgray
view1=xViewerCreate(0,0,800,600,window_handle)
xViewerSetBackgroundColor(view1,bgColor)
xViewerSetLighting(view1,False)
xViewerEnableFog(view1,True)
xViewerSetFogColor(view1,bgColor)
xViewerSetFogDistance(view1,50,100)
xViewerSetAntiAliasing(view1,aaNone)

back=xDummycubeCreate(0)
scene=xDummycubeCreate(0)
front=xDummycubeCreate(0)

camPos=xDummycubeCreate(scene)
xObjectSetPosition(camPos,0,0,10)

camera=xCameraCreate(camPos)
xObjectSetPosition(camPos,0,3,5)
xCameraSetViewDepth(camera,500)
xCameraSetFocal(camera,60)
xCameraSetNearPlaneBias(camera,0.2)
xViewerSetCamera(view1,camera)

ftfont=xTTFontCreate('../Examples/data/unicode/NotoSans-Regular.ttf',24)
text=xHUDTextCreate(ftfont,xTextConvertANSIToUTF8("Нажмите пробел для создания 'Configs/Text.txt' файла..."),front)
xHUDTextSetColor(text,cWhite,1.0)
xObjectSetPosition(text,32,32,0)

while WindowsExists(window_handle) do
	WindowsRefresh()
	KeyRefresh()
	fps=CallFps(30)
	dt=1/fps
	
	xUpdate(dt)
	xViewerRender(view1)
	
	if KeyReleased(VK_SPACE) then
		f = fTextOpen('Configs/Text.txt',2);
			fTextWriteWord(f,'ThisIsAWord');
			fTextWriteWord(f,'ThisIsAnotherWord');
			fTextWriteLine(f,1);
			fTextWriteReal(f,12.34);
			fTextWriteReal(f,123456789.123456789);
			fTextWriteLine(f,1);
			fTextWriteString(f,'This is a string.');
			fTextWriteLine(f,1);
		fTextClose(f);
		
		ShowMessage("'Configs/Text.txt' файл сформирован")
	end
	
	if KeyReleased(VK_ESCAPE) then WindowsDestroy(window_handle) end
end

--EngineDestroy()