/** Creates a sprite with width, height, and texture region equal to the specified size. * @param srcWidth The width of the texture region. May be negative to flip the sprite when drawn. * @param srcHeight The height of the texture region. May be negative to flip the sprite when drawn. */ public Sprite (Texture texture, int srcX, int srcY, int srcWidth, int srcHeight) { if (texture == null) throw new IllegalArgumentException("texture cannot be null."); this.texture = texture; setRegion(srcX, srcY, srcWidth, srcHeight); setColor(1, 1, 1, 1); setSize(Math.abs(srcWidth), Math.abs(srcHeight)); setOrigin(width / 2, height / 2); }
/** Creates a sprite with width, height, and texture region equal to the specified size. * @param srcWidth The width of the texture region. May be negative to flip the sprite when drawn. * @param srcHeight The height of the texture region. May be negative to flip the sprite when drawn. */ public Sprite (Texture texture, int srcX, int srcY, int srcWidth, int srcHeight) { if (texture == null) throw new IllegalArgumentException("texture cannot be null."); this.texture = texture; setRegion(srcX, srcY, srcWidth, srcHeight); setColor(1, 1, 1, 1); setSize(Math.abs(srcWidth), Math.abs(srcHeight)); setOrigin(width / 2, height / 2); }
/** Creates a sprite with width, height, and texture region equal to the specified size, relative to specified sprite's texture * region. * @param srcWidth The width of the texture region. May be negative to flip the sprite when drawn. * @param srcHeight The height of the texture region. May be negative to flip the sprite when drawn. */ public Sprite (TextureRegion region, int srcX, int srcY, int srcWidth, int srcHeight) { setRegion(region, srcX, srcY, srcWidth, srcHeight); setColor(1, 1, 1, 1); setSize(Math.abs(srcWidth), Math.abs(srcHeight)); setOrigin(width / 2, height / 2); }
/** Creates a sprite with width, height, and texture region equal to the specified size, relative to specified sprite's texture * region. * @param srcWidth The width of the texture region. May be negative to flip the sprite when drawn. * @param srcHeight The height of the texture region. May be negative to flip the sprite when drawn. */ public Sprite (TextureRegion region, int srcX, int srcY, int srcWidth, int srcHeight) { setRegion(region, srcX, srcY, srcWidth, srcHeight); setColor(1, 1, 1, 1); setSize(Math.abs(srcWidth), Math.abs(srcHeight)); setOrigin(width / 2, height / 2); }
/** Creates a sprite based on a specific TextureRegion, the new sprite's region is a copy of the parameter region - altering one * does not affect the other */ public Sprite (TextureRegion region) { setRegion(region); setColor(1, 1, 1, 1); setSize(region.getRegionWidth(), region.getRegionHeight()); setOrigin(width / 2, height / 2); }
/** Creates a sprite based on a specific TextureRegion, the new sprite's region is a copy of the parameter region - altering one * does not affect the other */ public Sprite (TextureRegion region) { setRegion(region); setColor(1, 1, 1, 1); setSize(region.getRegionWidth(), region.getRegionHeight()); setOrigin(width / 2, height / 2); }
public void setRegion(TextureRegion textureRegion) { sprite.setRegion(textureRegion); }
/** Creates a sprite with width, height, and texture region equal to the specified size. * @param srcWidth The width of the texture region. May be negative to flip the sprite when drawn. * @param srcHeight The height of the texture region. May be negative to flip the sprite when drawn. */ public Sprite (Texture texture, int srcX, int srcY, int srcWidth, int srcHeight) { if (texture == null) throw new IllegalArgumentException("texture cannot be null."); this.texture = texture; setRegion(srcX, srcY, srcWidth, srcHeight); setColor(1, 1, 1, 1); setSize(Math.abs(srcWidth), Math.abs(srcHeight)); setOrigin(width / 2, height / 2); }
/** Creates a sprite with width, height, and texture region equal to the specified size, relative to specified sprite's texture * region. * @param srcWidth The width of the texture region. May be negative to flip the sprite when drawn. * @param srcHeight The height of the texture region. May be negative to flip the sprite when drawn. */ public Sprite (TextureRegion region, int srcX, int srcY, int srcWidth, int srcHeight) { setRegion(region, srcX, srcY, srcWidth, srcHeight); setColor(1, 1, 1, 1); setSize(Math.abs(srcWidth), Math.abs(srcHeight)); setOrigin(width / 2, height / 2); }
protected Sprite createGroundSprite() { TextureRegion textureRegion = tileTextureAtlas.findRegion("ground"); Sprite sprite = new Sprite(); sprite.setRegion(textureRegion); sprite.setBounds(0, 0, 1, 1); return sprite; } }
/** Creates a sprite based on a specific TextureRegion, the new sprite's region is a copy of the parameter region - altering one * does not affect the other */ public Sprite (TextureRegion region) { setRegion(region); setColor(1, 1, 1, 1); setSize(region.getRegionWidth(), region.getRegionHeight()); setOrigin(width / 2, height / 2); }
public void setup (float carWidthPx, float carLengthPx) { front.setRegion(Art.skidMarksFront); front.setSize(carWidthPx, carLengthPx); front.setOrigin(front.getWidth() / 2, front.getHeight() / 2); front.setColor(1, 1, 1, 1); rear.setRegion(Art.skidMarksRear); rear.setSize(carWidthPx, carLengthPx); rear.setOrigin(rear.getWidth() / 2, rear.getHeight() / 2 + 7); // adjust for rear axis in 3d model (pretty distant) rear.setColor(1, 1, 1, 1); }
bigBombermanSprite.setRegion(bigBombermanAnimation.getKeyFrame(stateTime)); bombSprite.setRegion(new TextureRegion(textureAtlas.findRegion("Bomb"), 16 * 3, 0, 16, 16)); } else { bombSprite.setRegion(new TextureRegion(textureAtlas.findRegion("Bomb"), 16 * 3, 16 * 1, 16, 16)); bombSprite.setRegion(new TextureRegion(textureAtlas.findRegion("Bomb"), 0, 0, 16, 16)); } else { bombSprite.setRegion(new TextureRegion(textureAtlas.findRegion("Bomb"), 0, 16 * 1, 16, 16));
public CarHighlighter () { sprite = new Sprite(); sprite.setRegion(Art.cars.findRegion("selector")); isBusy = false; isActive = false; followedCar = null; isTracking = false; alpha = 1; bfScale = new BoxedFloat(1); bfRot = new BoxedFloat(0); bfAlpha = new BoxedFloat(0); bfGreen = new BoxedFloat(1); bfRed = new BoxedFloat(1); bfBlue = new BoxedFloat(1); bfRenderState = new BoxedFloat(0); prevState = null; renderState = null; interpolateState = false; }