/*
* CameraManager.cs
* Authors: Bradley Blankenship
* Copyright (c) 2007-2008 Cornell University
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
namespace tAC_Engine.Graphics.Cameras
{
///
/// Manages all the various cameras that are used
///
public static class CameraManager
{
#region Fields
// The dictionary of all cameras
private static Dictionary mCameras =
new Dictionary();
#endregion
#region Content Tasks
///
/// UnloadCameras - Removes all cameras from the Camera manager.
///
public static void UnloadCameras()
{
// Clear all of the cameras
mCameras.Clear();
}
#endregion
#region Collection Tasks
///
/// RegisterCamera - Registers the given camera with the manager.
///
/// The camera to register
/// The key value to get the camera back
public static int RegisterCamera(Camera camera)
{
// The return value
int retVal = mCameras.Count;
// Register the camera as the next item in the list
mCameras.Add(retVal, camera);
// Return the int value for the key for the camera
return retVal;
}
///
/// RegisterCamera - Registers the given camera with the manager.
///
/// The key to use for the camera
/// The camera to register
public static void RegisterCamera(int key, Camera camera)
{
// Register the camera as the next item in the list
mCameras.Add(key, camera);
}
///
/// UnregisterCamera - Remove the given camera from the manager,
/// using the key
///
/// The key for the camera
/// Whether it was removed or not
public static bool UnregisterCamera(int camKey)
{
// Unregister the camera
return mCameras.Remove(camKey);
}
///
/// GetCamera - Gets the camera that's wanted.
///
/// The key for the required camera
public static Camera GetCamera(int camKey)
{
// The return value
Camera retVal = null;
// Now get the value
if (mCameras.ContainsKey(camKey))
retVal = mCameras[camKey];
// Return the value
return retVal;
}
///
/// CameraCount - Returns the number of cameras
///
/// The number of cameras
public static int CameraCount()
{
// Return the number of cameras
return mCameras.Count;
}
#endregion
}
}