Ejemplo n.º 1
0
 /// <summary>
 /// Constructor of Window class
 /// </summary>
 /// <param name="deviceManager">Graphic device manager used by the window</param>
 /// <param name="renderer">Renderer</param>
 internal Window(GraphicsDeviceManager deviceManager, Renderer renderer)
     : base(deviceManager, renderer)
 {
     PreferredResizeRule = ResizeRule.None;
     Initialize();
     CreateViewport(0);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Constructor of SceneTree class
 /// </summary>
 /// <param name="name">Name of the scene tree</param>
 /// <param name="renderer">Renderer</param>
 /// <param name="assetEngine">AssetEngine</param>
 internal SceneTree(string name, Renderer renderer, AssetEngine assetEngine)
 {
     Name = name;
     _renderer = renderer;
     AssetEngine = assetEngine;
     _camManager = new CameraManager(this);
     _root = CreateNode();
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Constructor of RenderTarget class
        /// </summary>
        /// <param name="deviceManager"></param>
        /// <param name="renderer"></param>
        internal RenderTarget(GraphicsDeviceManager deviceManager, Renderer renderer)
        {
            if (deviceManager == null)
                throw new ArgumentNullException("deviceManager");

            if(renderer == null)
                throw new ArgumentNullException("renderer");

            DeviceManager = deviceManager;
            Renderer = renderer;
            AlwaysClear = true;
            ClearColor = Color.CornflowerBlue;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Disposes resources
        /// </summary>
        /// <param name="disposing">Indicate if the method is called from dispose</param>
        protected virtual void Dispose(bool disposing)
        {
            if (_isDisposed) return;

            try
            {
                for (int i = 0; i < Viewports.Count; i++)
                    Viewports[i].Dispose();

                Target.Dispose();
            }
            finally
            {
                Viewports.Clear();
                Viewports = null;
                Target = null;
                Renderer = null;
                DeviceManager = null;

                _isDisposed = true;
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Initializes resources
 /// </summary>
 private void InitializeResources()
 {
     _renderer = new Renderer(_deviceManager, _assetEngine);
     _window = new Window(_deviceManager, _renderer);
     _prefabFactory = new PrefabFactory(_assetEngine);
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Disposes all resources
        /// </summary>
        public void Dispose()
        {
            if(_isDisposed) return;

            try
            {
                foreach (SceneTree graph in _scenes.Values)
                    graph.Dispose();

                _window.Dispose();
                _renderer.Dispose();
                ReleaseStorage();
            }
            finally
            {
                _scenes.Clear();
                _scenes = null;
                _window = null;
                _renderer = null;

                _assetEngine.DestroyStorage(GraphicsConstant.Storage);
            }
            _isDisposed = true;
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Constructor of InstanceBatchManager class
 /// </summary>
 /// <param name="owner"></param>
 internal InstanceBatchManager(Renderer owner)
 {
     _owner = owner;
 }