public TextureAtlas( string[] regionNames, Subtexture[] subtextures, Dictionary<string,Point> spriteAnimationDetails, int animationFPS = 15 ) { this.regionNames = regionNames; this.subtextures = subtextures; _spriteAnimationDetails = spriteAnimationDetails; _animationFPS = animationFPS; }
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; }
public TiledSprite( Subtexture subtexture ) : base( subtexture ) { _sourceRect = subtexture.sourceRect; material = new Material { samplerState = Core.defaultWrappedSamplerState }; }
public void unload() { if( pixelTexture != null ) pixelTexture.texture2D.Dispose(); pixelTexture = null; batcher.Dispose(); batcher = null; }
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 ); }
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; }
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; }
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; }
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; }
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; }
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; }
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; }; }
public SpriteAnimationFrame( Subtexture subtexture, Vector2 origin ) { this.subtexture = subtexture; this.origin = origin; }
public TextureAtlas( string[] regionNames, Subtexture[] subtextures ) : this(regionNames, subtextures, null) { }
public SubtextureDrawable( Subtexture subtexture ) { this.subtexture = subtexture; }
public ScrollingSprite( Subtexture subtexture ) : base( subtexture ) {}
public Image( Subtexture subtexture, Scaling scaling = Scaling.Stretch, int align = AlignInternal.center ) : this( new SubtextureDrawable( subtexture ), scaling, align ) { }
/// <summary> /// adds a frame to this animation /// </summary> /// <param name="subtexture">Subtexture.</param> public SpriteAnimation addFrame( Subtexture subtexture ) { frames.Add( subtexture ); return this; }
public FSCompoundPolygonBody( Subtexture subtexture ) : base( subtexture ) { }
public SpriteAnimationFrame( Subtexture subtexture ) : this(subtexture, subtexture.center) { }
public Sprite( Subtexture subtexture ) { this.subtexture = subtexture; originNormalized = new Vector2( 0.5f, 0.5f ); }
public Sprite( Subtexture subtexture ) { _subtexture = subtexture; _origin = subtexture.center; }
public FSPolygonBody( Subtexture subtexture, List<Vector2> verts ) : base( subtexture ) { _verts = new Vertices( verts ); }
public NinePatchDrawable( Subtexture subtexture, int left, int right, int top, int bottom ) : this( new NinePatchSubtexture( subtexture.texture2D, subtexture.sourceRect, left, right, top, bottom ) ) {}
public FSCircleBody( Subtexture subtexture ) : base( subtexture ) { }
public SpriteAnimation( Subtexture frame ) { addFrame( frame ); }
public NinePatchSubtexture(Subtexture subtexture, int left, int right, int top, int bottom) : this(subtexture, subtexture.sourceRect, left, right, top, bottom) { }
public FSBoxBody( Subtexture subtexture ) : base( subtexture, PolygonTools.createRectangle( subtexture.sourceRect.Width / 2, subtexture.sourceRect.Height / 2 ) ) { }
public NineSliceSprite( Subtexture subtexture, int top, int bottom, int left, int right ) : this(new NinePatchSubtexture( subtexture, top, bottom, left, right )) { }
public TiledDrawable( Subtexture subtexture ) : base( subtexture ) { }
/// <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; }
protected FSRenderableBody( Subtexture subtexture ) { _subtexture = subtexture; }
public NinePatchSubtexture( Subtexture subtexture, int left, int right, int top, int bottom ) : this( subtexture, subtexture.sourceRect, left, right, top, bottom ) {}
public void setTileTextureRegion( int tileId, Rectangle sourceRect ) { _regions[tileId] = new Subtexture( texture, sourceRect ); }