/*
 * $Id$
 *
 * $Date$
 * $Revision$
 *
 * (C) 1999 by Hyperion
 * All rights reserved
 *
 * This file is part of the MiniGL library project
 * See the file Licence.txt for more details
 *
 */

#include "sysinc.h"
static char rcsid[] = "$Id$";


struct Library *UtilityBase;
struct IntuitionBase *IntuitionBase;
struct GfxBase *GfxBase;
#ifndef __PPC__
struct Device *TimerBase = 0;
extern struct DosLibrary *DOSBase;
extern struct ExecBase *SysBase;
#endif
#ifdef __PPC__
struct Library *Warp3DPPCBase = NULL;
#else
struct Library *Warp3DBase = NULL;
#endif
struct Library *CyberGfxBase = NULL;


void MGLInit(void)
{
	IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library", 0L);
	GfxBase = (struct GfxBase *)OpenLibrary("graphics.library", 0L);
	UtilityBase = OpenLibrary("utility.library", 0L);
#ifdef __PPC__
	Warp3DPPCBase = OpenLibrary("Warp3DPPC.library", 2L);
#else
	Warp3DBase = OpenLibrary("Warp3D.library", 2L);
#endif
	CyberGfxBase = OpenLibrary("cybergraphics.library", 0L);

}

void MGLTerm(void)
{
	if (CyberGfxBase)       CloseLibrary(CyberGfxBase);
	CyberGfxBase = NULL;

	#ifdef __PPC__
	if (Warp3DPPCBase)      CloseLibrary(Warp3DPPCBase);
	Warp3DPPCBase = NULL;

	#else
	if (Warp3DBase)         CloseLibrary(Warp3DBase);
	Warp3DBase = NULL;
	#endif

	if (IntuitionBase)      CloseLibrary((struct Library *)IntuitionBase);
	IntuitionBase = NULL;

	if (GfxBase)            CloseLibrary((struct Library *)GfxBase);
	GfxBase = NULL;

	if (UtilityBase)        CloseLibrary(UtilityBase);
	UtilityBase = NULL;
}
