Esempio n. 1
0
        /// <summary>
        /// Main constructor. Each instance of this class is a potential 'device', with its own screen size and events
        /// </summary>
        /// <param name="tag">The tag that will be asociated to the log messages of this instance</param>
        public VisualEngine(StringBuilder tag)
        {
            LogTag = tag;

            Log = new Log();

            // Assign InternalPath
            if (InternalPath == null)
            {
                FindInternalDirectory();
            }

            Log.SetFileOutput(InternalPath + "Log\\Log_" + LogTag + ".txt");

            Log.AddInformation(LogTag, new StringBuilder("Creating the device"));

            Device = new GraphicsDevice();

            Device.Initialize(tag.ToString(), InternalPath);

            Log.AddInformation(LogTag, new StringBuilder("Creating the Textures"));

            Textures = new Textures(this);

            RenderTargets = new RenderTargets(this);

            DepthStencils = new DepthStencils(this);

            RenderViews = new RenderViews(this);

            Sprites = new Sprites(this);
        }
Esempio n. 2
0
        /// <summary>
        /// Destroy and free all the resources
        /// </summary>
        public void Destroy()
        {
            DepthStencils.Destroy();

            RenderTargets.Destroy();

            Sprites.Destroy();

            Textures.Destroy();

            Device.Destroy();

            Log.Destroy();
        }
Esempio n. 3
0
        /// <summary>
        /// Creates a <see cref="RenderTarget"/> compatible with DX9 and WPF
        /// </summary>
        /// <param name="width"></param>
        /// <param name="height"></param>
        public RenderTarget CreateSwapChainRenderTarget(string name, IntPtr hwnd)
        {
            _RenderTarget renderTarget = Device.CreateSwapChainRenderTarget(name, (int)hwnd);

            return(RenderTargets.Create(new StringBuilder("DXBackBuffer"), renderTarget));
        }
Esempio n. 4
0
        /// <summary>
        /// Creates a <see cref="RenderTarget"/> compatible with DX9 and WPF
        /// </summary>
        /// <param name="width"></param>
        /// <param name="height"></param>
        public RenderTarget CreateDX9SharedRenderTarget(string name, int width, int height)
        {
            _RenderTarget renderTarget = Device.CreateDX9SharedRenderTarget(name, width, height);

            return(RenderTargets.Create(new StringBuilder(name), renderTarget));
        }