コード例 #1
0
 public override string ToString()
 {
     if (Effect != null)
     {
         return(Effect.Name + blendState.ToString());
     }
     return(blendState.ToString());
 }
コード例 #2
0
        public virtual XmlElement Save(XmlDocument xmlDoc)
        {
            XmlElement xmlNode = xmlDoc.CreateElement(TypeDescriptor.GetClassName(this));

            xmlNode.SetAttribute("Enabled", enabled.ToString());
            xmlNode.SetAttribute("TextureName", textureName);
            xmlNode.SetAttribute("MaxParticles", maxParticles.ToString());
            xmlNode.SetAttribute("Duration", duration.TotalMilliseconds.ToString());
            xmlNode.SetAttribute("DurationRandomness", durationRandomness.ToString());
            xmlNode.SetAttribute("EmitterVelocitySensitivity", emitterVelocitySensitivity.ToString());
            xmlNode.SetAttribute("MinHorizontalVelocity", minHorizontalVelocity.ToString());
            xmlNode.SetAttribute("MaxHorizontalVelocity", maxHorizontalVelocity.ToString());
            xmlNode.SetAttribute("MinVerticalVelocity", minVerticalVelocity.ToString());
            xmlNode.SetAttribute("MaxVerticalVelocity", maxVerticalVelocity.ToString());
            xmlNode.SetAttribute("Gravity", gravity.ToString());
            xmlNode.SetAttribute("EndVelocity", endVelocity.ToString());
            xmlNode.SetAttribute("MinColor", minColor.ToString());
            xmlNode.SetAttribute("MaxColor", maxColor.ToString());
            xmlNode.SetAttribute("MinRotateSpeed", minRotateSpeed.ToString());
            xmlNode.SetAttribute("MaxRotateSpeed", maxRotateSpeed.ToString());
            xmlNode.SetAttribute("MinStartSize", minStartSize.ToString());
            xmlNode.SetAttribute("MaxStartSize", maxStartSize.ToString());
            xmlNode.SetAttribute("MinEndSize", minEndSize.ToString());
            xmlNode.SetAttribute("MaxEndSize", maxEndSize.ToString());
            xmlNode.SetAttribute("BlendState", blendState.ToString());
            xmlNode.SetAttribute("DrawOrder", drawOrder.ToString());
            xmlNode.SetAttribute("Shader", TypeDescriptor.GetClassName(shader));
            if (shaderTechnique.Length > 0)
            {
                xmlNode.SetAttribute("ShaderTechnique", shaderTechnique);
            }

            return(xmlNode);
        }
コード例 #3
0
ファイル: Game1.cs プロジェクト: solsting/XNAUnleashed
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            graphics.GraphicsDevice.Clear(Color.CornflowerBlue);
            spriteBatch.Begin(sortMode, blendState);

            //draw heart
            spriteBatch.Draw(tiledSprite, new Rectangle(64, 64, 256, 256),
                             new Rectangle(256, 256, 256, 256), Color.White, 0, Vector2.Zero,
                             SpriteEffects.None, .10f);

            //draw circle
            spriteBatch.Draw(tiledSprite, new Rectangle(0, 0, 256, 256),
                             new Rectangle(256, 0, 256, 256), Color.White, 0, Vector2.Zero,
                             SpriteEffects.None, .15f);

            //draw shape
            spriteBatch.Draw(tiledSprite, new Rectangle(128, 128, 256, 256),
                             new Rectangle(0, 0, 256, 256), Color.White, 0, Vector2.Zero,
                             SpriteEffects.None, .05f);

            //draw star
            spriteBatch.Draw(tiledSprite, new Rectangle(192, 192, 256, 256),
                             new Rectangle(0, 256, 256, 256), Color.White, 0, Vector2.Zero,
                             SpriteEffects.None, .01f);

            Window.Title = "Sort Order Demo - " + blendState.ToString() + " : " +
                           sortMode.ToString();

            spriteBatch.End();
            base.Draw(gameTime);
        }