represents a single element in a texture atlas consisting of a texture and the source rectangle for the frame
Exemplo n.º 1
0
 public TextureAtlas( string[] regionNames, Subtexture[] subtextures, Dictionary<string,Point> spriteAnimationDetails, int animationFPS = 15 )
 {
     this.regionNames = regionNames;
     this.subtextures = subtextures;
     _spriteAnimationDetails = spriteAnimationDetails;
     _animationFPS = animationFPS;
 }
Exemplo n.º 2
0
		public BitmapFontRegion( Subtexture textureRegion, char character, int xOffset, int yOffset, int xAdvance )
		{
			this.subtexture = textureRegion;
			this.character = character;
			this.xOffset = xOffset;
			this.yOffset = yOffset;
			this.xAdvance = xAdvance;
		}
Exemplo n.º 3
0
		public TiledSprite( Subtexture subtexture ) : base( subtexture )
		{
			_sourceRect = subtexture.sourceRect;
			material = new Material
			{
				samplerState = Core.defaultWrappedSamplerState
			};
		}
Exemplo n.º 4
0
		public void unload()
		{
			if( pixelTexture != null )
				pixelTexture.texture2D.Dispose();
			pixelTexture = null;

			batcher.Dispose();
			batcher = null;
		}
Exemplo n.º 5
0
		public Graphics( BitmapFont font )
		{
			batcher = new Batcher( Core.graphicsDevice );
			bitmapFont = font;

			// the bottom/right pixel is white on the default font so we'll use that for the pixelTexture
			var fontTex = bitmapFont.defaultCharacterRegion.subtexture.texture2D;
			pixelTexture = new Subtexture( fontTex, fontTex.Width - 1, fontTex.Height - 1, 1, 1 );
		}
Exemplo n.º 6
0
		public Subtexture createRegion( string name, int x, int y, int width, int height, float pivotX = 0.5f, float pivotY = 0.5f )
		{
			Assert.isFalse( _subtextureMap.ContainsKey( name ), "Region {0} already exists in the texture atlas", name );

			var region = new Subtexture( texture, new Rectangle( x, y, width, height ), new Vector2( pivotX * width, pivotY * height ) );
			var index = subtextures.Count;
			subtextures.Add( region );
			_subtextureMap.Add( name, index );

			return region;
		}
Exemplo n.º 7
0
        public Arrow()
        {
            id = GameItemId.arrow;
            var texture = Core.content.Load <Texture2D>("Images/Players/Allplayer");

            itemIcon     = new Nez.Textures.Subtexture(texture, new Rectangle(306, 2630 - 1191 - 16, 5, 16));
            name         = "弓箭";
            describetion = "使用弓时所需要的东西";
            properties   = new string[] { "无" };
            saleMoney    = 1;
        }
Exemplo n.º 8
0
        public Subtexture createRegion( string name, int x, int y, int width, int height )
        {
            if( _subtextureMap.ContainsKey( name ) )
                throw new InvalidOperationException( "Region {0} already exists in the texture atlas" );

            var region = new Subtexture( texture, x, y, width, height );
            var index = subtextures.Count;
            subtextures.Add( region );
            _subtextureMap.Add( name, index );

            return region;
        }
Exemplo n.º 9
0
        public TiledSprite( Subtexture subtexture )
            : base(subtexture)
        {
            material = new Material();

            // choose the best fit wrap type based on the defaultSamplerState
            if( Core.defaultSamplerState.Filter == TextureFilter.Point )
                material.samplerState = SamplerState.PointWrap;
            else
                material.samplerState = SamplerState.LinearWrap;
            _sourceRect = subtexture.sourceRect;
        }
Exemplo n.º 10
0
			public void spawn( Vector2 position, Subtexture subtexture, float fadeDuration, float fadeDelay, Color initialColor, Color targetColor )
			{
				this.position = position;
				_subtexture = subtexture;

				_initialColor = initialColor;
				_elapsedTime = 0f;

				_fadeDuration = fadeDuration;
				_fadeDelay = fadeDelay;
				_initialColor = initialColor;
				_targetColor = targetColor;
			}
Exemplo n.º 11
0
 public NormalBowWeapon()
 {
     itemIcon     = new Nez.Textures.Subtexture(Core.content.Load <Texture2D>("Images/ItemsIcon/W_Bow03"));
     name         = "普通的弓";
     maxDamage    = 7;
     minDamage    = 4;
     describetion = "一把普通的弓";
     saleMoney    = 100;
     properties   = new string[] { "伤害 + 7" };
     id           = GameItemId.normalArrow;
     this.equit   = Equit;
     this.tackOff = TackOff;
 }
Exemplo n.º 12
0
        public override void onAddedToScene()
        {
            base.onAddedToScene();
            var texture    = Core.content.Load <Texture2D>("Images/Players/Allplayer");
            var subtexture = new Nez.Textures.Subtexture(texture, new Rectangle(306, 2630 - 1191 - 16, 5, 16));

            addComponent(new Sprite(subtexture)).setLayerDepth(LayerDepthExt.caluelateLayerDepth(this.position.Y));

            addComponent <FSRigidBody>()
            .setBodyType(BodyType.Dynamic);

            var shape = addComponent <SceneObjectTriggerComponent>();

            shape.setRadius(7).setIsSensor(true);
            shape.setCollisionCategories(CollisionSetting.ItemsCategory);
            shape.setCollidesWith(CollisionSetting.playerCategory);
            shape.onAdded = () =>
            {
                shape.GetFixture().onCollision += Body_onCollision;
            };
        }
Exemplo n.º 13
0
 public SpriteAnimationFrame( Subtexture subtexture, Vector2 origin )
 {
     this.subtexture = subtexture;
     this.origin = origin;
 }
Exemplo n.º 14
0
 public TextureAtlas( string[] regionNames, Subtexture[] subtextures )
     : this(regionNames, subtextures, null)
 {
 }
Exemplo n.º 15
0
		public SubtextureDrawable( Subtexture subtexture )
		{
			this.subtexture = subtexture;
		}
Exemplo n.º 16
0
		public ScrollingSprite( Subtexture subtexture ) : base( subtexture )
		{}
Exemplo n.º 17
0
		public Image( Subtexture subtexture, Scaling scaling = Scaling.Stretch, int align = AlignInternal.center ) : this( new SubtextureDrawable( subtexture ), scaling, align )
		{
		}
Exemplo n.º 18
0
		/// <summary>
		/// adds a frame to this animation
		/// </summary>
		/// <param name="subtexture">Subtexture.</param>
		public SpriteAnimation addFrame( Subtexture subtexture )
		{
			frames.Add( subtexture );
			return this;
		}
Exemplo n.º 19
0
		public FSCompoundPolygonBody( Subtexture subtexture ) : base( subtexture )
		{ }
Exemplo n.º 20
0
 public SpriteAnimationFrame( Subtexture subtexture )
     : this(subtexture, subtexture.center)
 {
 }
Exemplo n.º 21
0
 public Sprite( Subtexture subtexture )
 {
     this.subtexture = subtexture;
     originNormalized = new Vector2( 0.5f, 0.5f );
 }
Exemplo n.º 22
0
		public Sprite( Subtexture subtexture )
		{
			_subtexture = subtexture;
			_origin = subtexture.center;
		}
Exemplo n.º 23
0
		public FSPolygonBody( Subtexture subtexture, List<Vector2> verts ) : base( subtexture )
		{			
			_verts = new Vertices( verts );
		}
Exemplo n.º 24
0
		public NinePatchDrawable( Subtexture subtexture, int left, int right, int top, int bottom ) : this( new NinePatchSubtexture( subtexture.texture2D, subtexture.sourceRect, left, right, top, bottom ) )
		{}
Exemplo n.º 25
0
		public FSCircleBody( Subtexture subtexture ) : base( subtexture )
		{ }
Exemplo n.º 26
0
		public SpriteAnimation( Subtexture frame )
		{
			addFrame( frame );
		}
Exemplo n.º 27
0
 public NinePatchSubtexture(Subtexture subtexture, int left, int right, int top, int bottom)
     : this(subtexture, subtexture.sourceRect, left, right, top, bottom)
 {
 }
Exemplo n.º 28
0
		public FSBoxBody( Subtexture subtexture ) : base( subtexture, PolygonTools.createRectangle( subtexture.sourceRect.Width / 2, subtexture.sourceRect.Height / 2 ) )
		{ }
Exemplo n.º 29
0
 public NineSliceSprite( Subtexture subtexture, int top, int bottom, int left, int right )
     : this(new NinePatchSubtexture( subtexture, top, bottom, left, right ))
 {
 }
Exemplo n.º 30
0
		public TiledDrawable( Subtexture subtexture ) : base( subtexture )
		{
		}
Exemplo n.º 31
0
		/// <summary>
		/// sets the Subtexture and updates the origin of the Sprite to match Subtexture.origin. If for whatever reason you need
		/// an origin different from the Subtexture either clone it or set the origin AFTER setting the Subtexture here.
		/// </summary>
		/// <returns>The subtexture.</returns>
		/// <param name="subtexture">Subtexture.</param>
		public Sprite setSubtexture( Subtexture subtexture )
		{
			_subtexture = subtexture;

			if( _subtexture != null )
				_origin = subtexture.origin;
			return this;
		}
Exemplo n.º 32
0
		protected FSRenderableBody( Subtexture subtexture )
		{
			_subtexture = subtexture;
		}
Exemplo n.º 33
0
		public NinePatchSubtexture( Subtexture subtexture, int left, int right, int top, int bottom ) : this( subtexture, subtexture.sourceRect, left, right, top, bottom )
		{}
Exemplo n.º 34
0
		public void setTileTextureRegion( int tileId, Rectangle sourceRect )
		{
			_regions[tileId] = new Subtexture( texture, sourceRect );
		}