예제 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DebugSprite"/> class.
 /// </summary>
 /// <param name="world">The <see cref="World" /> in which the instance lives.</param>
 /// <param name="targetSprite">The sprite that we're drawing debug information for.</param>
 public DebugSprite(World world, SpriteBase targetSprite)
     : base(world)
 {
     this.targetSprite         = targetSprite;
     this.lineWidth            = this.World.GetWorldFromPixel(1.0f); // Default to 1 pixel in width
     this.optionMapFlagsShader = new OptionsMapFlagsShader();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DebugSimulatedPostProcess"/> class.
 /// </summary>
 /// <param name="world">The <see cref="World" /> in which the instance lives.</param>
 /// <param name="targetPostProcess">The post process that we're drawing debug information for.</param>
 public DebugSimulatedPostProcess(World world, SimulatedPostProcess targetPostProcess)
     : base(world)
 {
     this.targetPostProcess    = targetPostProcess;
     this.lineWidth            = this.World.GetWorldFromPixel(1.0f); // Default to 1 pixel in width
     this.optionMapFlagsShader = new OptionsMapFlagsShader();
     this.LayerDepth           = float.MaxValue;                     // Arbitrarily large layer depth
 }
예제 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SimpleSprite"/> class.
        /// </summary>
        /// <param name="world">The <see cref="World" /> in which the instance lives.</param>
        /// <param name="spriteTexturePath">The path to the sprite texture.</param>
        /// <param name="spriteNormalTexturePath">The path to the sprite's normal texture (can be null).</param>
        /// <param name="spriteTextureBoundingBox">The bounding box of the sprite within the texture (used with sprite sheets).</param>
        /// <param name="position">The starting position of the object.</param>
        /// <param name="velocity">The starting velocity of the object.</param>
        /// <param name="computeSpriteShape">If true, the sprite's shape is computed based on the sprite data; otherwise, the sprite's bounding box is used.</param>
        public SimpleSprite(World world, string spriteTexturePath, string spriteNormalTexturePath, Rectangle?spriteTextureBoundingBox, Vector2 position, Vector2 velocity, bool computeSpriteShape)
            : base(world, position, velocity)
        {
            if (spriteTexturePath == null)
            {
                throw new ArgumentNullException("spriteTexturePath", "You must specify the texture to render.");
            }

            this.spriteTexturePath        = spriteTexturePath;
            this.spriteNormalTexturePath  = spriteNormalTexturePath;
            this.spriteTextureBoundingBox = spriteTextureBoundingBox;
            this.optionMapFlagsShader     = new OptionsMapFlagsShader();
            this.renderColor        = Color.White;
            this.computeSpriteShape = computeSpriteShape;
        }