//BSD License  
//DXGfx® - http://www.eteractions.com
//Copyright (c) 2005
//by Guillaume Randon
//Permission is hereby granted, free of charge, to any person obtaining a copy of this software
//and associated documentation files (the "Software"), to deal in the Software without restriction,
//including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
//and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
//subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all copies or substantial
//portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 
//INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE 
//AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
//DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.DirectX;
using Microsoft.DirectX.Direct3D;
using Microsoft.Samples.DirectX.UtilityToolkit;
using System.Drawing;

namespace DXGfxLib
{
    /// <summary>
    /// An instance of the cursor class will be used by the editor while editing the scene. Even if an instance of this class
    /// is part of the scene, it won't be displayed while the simulation is running. It will be displayed only while editing
    /// the scene.
    /// </summary>
    public class Cursor : MeshObject
    {
        public Cursor()
        {
            if (DXGfxManager.GetGlobalInstance().d3dDevice == null)
            {
                throw new NullReferenceException("DXGfxManager device not initialized!");
            }

            Init();
        }

        public void Init()
        {
            Init(1.0f);
        }

        public void Init(float size)
        {
            Mesh box = Mesh.Box(DXGfxManager.GetGlobalInstance().d3dDevice, size, size, size);
            Attach(box);

            drawBoundingBox = true;
        }

        public Cursor(float size)
        {
            if (DXGfxManager.GetGlobalInstance().d3dDevice == null)
            {
                throw new NullReferenceException("DXGfxManager device not initialized!");
            }

            Init(size);
        }

        public override void GetPrepared()
        {
            Init();
        }

        public override void Draw(Device device)
        {
            base.Draw(device);
        }

        public override void LoadFromFile(Device d3ddevice, string fileName)
        {
            // We don't do anything here!
        }
    }
}
