Esempio n. 1
0
        public void OnDeviceReset(object sender, EventArgs e)
        {
            if (dds == null)
            {
                return;
            }
            free();

            SlimDXControl control = surface.m_slimDXControl;

            sprite       = new Sprite(control.Device);
            dds.Position = 0;
            texture      = Texture.FromStream(control.Device, dds, Usage.None, Pool.Default);
        }
Esempio n. 2
0
        public MyDataModel(SlimDXControl slimDXControl, string imageName, Color color)
        {
            _control = slimDXControl;

            Name = imageName;
            Uri uri = new Uri("pack://application:,,,/Resources/" + imageName + ".png");

            using (Stream s = Application.GetResourceStream(uri).Stream)
            {
                _buffer = new byte[s.Length];
                s.Read(_buffer, 0, (int)s.Length);
            }

            Color = color;
        }
Esempio n. 3
0
        /// <summary>
        /// Implements the creation of the effect and the sets up the vertices.
        /// </summary>
        /// <param name="control">the associated SlimDXControl object</param>
        public override void Initialize(SlimDXControl control)
        {
            base.Initialize(control);

            try
            {
                m_effect = Effect.FromFile(Device, "pipeline.fx", "fx_4_0", ShaderFlags.None, EffectFlags.None, null, null);
            }
            catch (SlimDX.CompilationException)
            {
                // handy spot for a breakpoint to catch shader syntax errors
                throw;
            }

            Device.Flush();

            return;
        }
Esempio n. 4
0
        public void OnDeviceReset(object sender, EventArgs e)
        {
            SlimDXControl control = sender as SlimDXControl;

            if (control == null)
            {
                throw new ArgumentNullException("sender");
            }

            if (_sprite != null)
            {
                _sprite.Dispose();
            }
            _sprite = new Sprite(control.Device);

            if (_texture == null)
            {
                _texture = Texture.FromStream(control.Device, _dataModel.Stream, Usage.None, Pool.Default);
            }

            return;
        }
Esempio n. 5
0
        /// <summary>
        /// Implements the creation of the effect and the sets up the vertices.
        /// </summary>
        /// <param name="control">the associated SlimDXControl object</param>
        public override void Initialize(SlimDXControl control)
        {
            base.Initialize(control);

            try
            {
                m_effect = Effect.FromFile(Device, "pipeline.fx", "fx_4_0", ShaderFlags.None, EffectFlags.None, null, null);
            }
            catch (SlimDX.CompilationException)
            {
                // handy spot for a breakpoint to catch shader syntax errors
                throw;
            }

            Device.Flush();

            return;
        }