Java 类com.badlogic.gdx.graphics.g2d.TextureRegion 实例源码

项目:Tower-Defense-Galaxy    文件:GameScreen.java   
private void pauseGame() {
    if (paused)
        return;
    paused = true;

    final Window.WindowStyle pauseWindowStyle = new Window.WindowStyle();
    pauseWindowStyle.titleFont = game.getFonts().get("moonhouse64");
    pauseWindowStyle.background = new TextureRegionDrawable(new TextureRegion(background));

    pauseWindow = new PauseWindow(pauseWindowStyle, game.getFonts().get("moonhouse64"), new Runnable() {
        @Override
        public void run() {
            unpauseGame();
        }
    }, new Runnable() {
        @Override
        public void run() {
            save();
        }
    }, game, uiAssets, button);
    pauseWindow.setBounds(viewport.getWorldWidth() / 2 - viewport.getWorldWidth() / 3, viewport.getWorldHeight() / 2 - viewport.getWorldHeight() / 3, viewport.getWorldWidth() / 3 * 2, viewport.getWorldHeight() / 3 * 2);
    stage.addActor(pauseWindow);
}
项目:enklave    文件:ScreenSetting.java   
private void addChangeFaction(){
    groupChangeFaction = new Group();
    Image background = new Image(new TextureRegion(manager.getAssetsSettings().getTexture(NameFiles.extensionImgBackground)));
    background.setSize(Width - Width * 0.03f, Height * 0.1f);
    background.setPosition(Width / 2 - background.getWidth() / 2, Height * 0.3f);
    groupChangeFaction.addActor(background);
    Label labelFac = new Label("Change Faction",new Label.LabelStyle(Font.getFont((int)(Height*0.025f)),Color.WHITE));
    labelFac.setPosition(background.getX()+background.getWidth()*0.05f,background.getY()+background.getHeight()/2-labelFac.getHeight()/2);
    labelFac.addListener(new ClickListener(){
        @Override
        public void clicked(InputEvent event, float x, float y) {
            manager.loadAssetsChoiceFaction();
            gameManager.setScreen(new ScreenCircleLoading(gameManager,new ScreenChoiceFaction(gameManager),manager.getAssetsChoiceFaction()));
        }
    });
    groupChangeFaction.addActor(labelFac);
}
项目:MMORPG_Prototype    文件:GameObjectHighlightGraphic.java   
private Texture createHighlightingGraphic(TextureRegion textureRegion)
{
    TextureData textureData = textureRegion.getTexture().getTextureData();
    textureData.prepare();
    Pixmap sourcePixmap = textureData.consumePixmap();
    Pixmap destinationPixmap = new Pixmap(textureRegion.getRegionWidth(), textureRegion.getRegionHeight(), Format.RGBA8888);
    Color color = new Color();

    for (int x = 0; x < textureRegion.getRegionWidth(); x++)
    {
        for (int y = 0; y < textureRegion.getRegionHeight(); y++)
        {
            int colorInt = sourcePixmap.getPixel(textureRegion.getRegionX() + x, textureRegion.getRegionY() + y);
            Color.rgba8888ToColor(color, colorInt);
            destinationPixmap.setColor(1.0f, 1f, 1.0f, 1);
            if (color.a > 0.004f)
                destinationPixmap.drawPixel(x, y);
        }
    }
    Texture result = new Texture(destinationPixmap);
    textureData.disposePixmap();
    destinationPixmap.dispose();
    return result;
}
项目:miniventure    文件:TileTouchCheck.java   
private TileTouchCheck(Pixmap pixelMap, TextureRegion region) {
    this.width = region.getRegionWidth();
    this.height = region.getRegionHeight();
    map = new int[width * height];
    int i = -1;
    // pixmap coordinates have the origin in the top left corner; shift it so it goes from the bottom left instead
    for (int x = 0; x < width; x++) {
        for (int y = height-1; y >= 0; y--) {
            Color color = new Color(pixelMap.getPixel(region.getRegionX() + x, region.getRegionY() + y));

            i++;
            if(color.a == 0) continue; // set to zero, tile doesn't matter

            if(color.equals(Color.WHITE)) // the tile must be different from the center tile
                map[i] = WHITE;
            else if(color.equals(Color.BLACK)) // the tile must be equal to the center tile
                map[i] = BLACK;
        }
    }
}
项目:Mindustry    文件:BackgroundFragment.java   
@Override
public void build() {

    Core.scene.table().addRect((a, b, w, h) -> {
        Draw.color();

        TextureRegion back = Draw.region("background");
        float backscl = Unit.dp.scl(5f);

        Draw.alpha(0.7f);
        Core.batch.draw(back, w/2 - back.getRegionWidth()*backscl/2 +240f, h/2 - back.getRegionHeight()*backscl/2 + 250f,
                back.getRegionWidth()*backscl, back.getRegionHeight()*backscl);

        float logoscl = (int)Unit.dp.scl(7);
        TextureRegion logo = Core.skin.getRegion("logotext");
        float logow = logo.getRegionWidth()*logoscl;
        float logoh = logo.getRegionHeight()*logoscl;

        Draw.color();
        Core.batch.draw(logo, w/2 - logow/2, h - logoh + 15, logow, logoh);
    }).visible(() -> GameState.is(State.menu)).grow();
}
项目:Cubes_2    文件:AmbientOcclusion.java   
private static TextureRegion y(Area area, int x_y, int y_y, int z_y) {
    int i = 0;
    if (exists(area, x_y + 1, y_y, z_y - 1))
        i |= A;
    if (exists(area, x_y + 1, y_y, z_y))
        i |= B;
    if (exists(area, x_y + 1, y_y, z_y + 1))
        i |= C;

    if (exists(area, x_y, y_y, z_y - 1))
        i |= D;
    if (exists(area, x_y, y_y, z_y + 1))
        i |= E;

    y_1(area, x_y, y_y, z_y, i);

    return loadedRegions[i];
}
项目:Tower-Defense-Galaxy    文件:VRCamera.java   
public VRCamera(int width, int height, int viewportWidth, int viewportHeight) {
    leftCamera = new PerspectiveCamera(90, viewportWidth, viewportHeight);
    rightCamera = new PerspectiveCamera(90, viewportWidth, viewportHeight);
    leftBuffer = new FrameBuffer(Pixmap.Format.RGBA8888, width, height, true);
    rightBuffer = new FrameBuffer(Pixmap.Format.RGBA8888, width, height, true);
    leftTexture = new TextureRegion();
    rightTexture = new TextureRegion();
    batch = new SpriteBatch();
    this.width = width;
    this.height = height;
    this.viewportWidth = viewportWidth;
    this.viewportHeight = viewportHeight;
    tmpVector3 = new Vector3();
    position = new Vector3(250, 20, 250);
    positionLeft = new Vector3(249.5f, 20, 250);
    positionRight = new Vector3(250.5f, 20, 250);
    direction = new Vector3();
    up = new Vector3(0, 1, 0);
    eyeDistance = 0.5f;
}
项目:SpaceChaos    文件:DrawTextureRegionComponent.java   
public void setTextureRegion(TextureRegion textureRegion, boolean setNewDimension) {
    TextureRegion oldTextureRegion = this.textureRegion;
    this.textureRegion = textureRegion;

    if (oldTextureRegion == this.textureRegion) {
        // we dont need to notify listeners
        return;
    }

    if (setNewDimension) {
        // set new width and height
        this.positionComponent.setDimension(textureRegion.getRegionWidth(), textureRegion.getRegionHeight());
    }

    this.textureRegionChangedListenerList.stream().forEach(listener -> {
        // check if dev mode is enabled
        /*
         * if (DevMode.isEnabled()) { //log listener
         * System.out.println("DrawTextureRegionComponent call listener: " +
         * listener.getClass().getName()); }
         */

        listener.onTextureRegionChanged(oldTextureRegion, this.textureRegion);
    });
}
项目:Climatar    文件:DrawableMap.java   
public void draw(Coordinates<Integer> coords, Pixmap map) {
    int terrainID = world.get(coords.y).get(coords.x);

    // tileID runs 0 through 8, conveniently in the
    // same order as our split tiles texture...
    int ty = (int) terrainID / 3;
    int tx = terrainID % 3;

    TextureRegion tileRegion = tileRegions[ty][tx];

    map.drawPixmap(tilesPixmap,
                   coords.x * tileSize,
                   coords.y * tileSize,
                   tileRegion.getRegionX(),
                   tileRegion.getRegionY(),
                   tileRegion.getRegionWidth(),
                   tileRegion.getRegionHeight());
}
项目:fluffybalance    文件:Balanceball.java   
private void initBall() {
    float radius = 26;

    mBall = new Circle(0.f, 0.f, radius);

    mBallTextureRegion = new TextureRegion(new Texture(Gdx.files.internal("ball.png")));

    // create physics body
    BodyDef bodyDef = new BodyDef();
    bodyDef.type = BodyDef.BodyType.DynamicBody;
    bodyDef.position.set(mBall.x, mBall.y);

    CircleShape ballShape = new CircleShape();
    ballShape.setRadius(mBall.radius - 2.f);

    mBallBody = mWorld.createBody(bodyDef);
    mBallBody.setUserData(new BodyUserDate(BODY_USER_DATA_TYPE_BALL));
    Fixture fixture = mBallBody.createFixture(ballShape, 0.5f);
    fixture.setFriction(BALL_FRICTION_BASE);
    fixture.setRestitution(0.4f);

    ballShape.dispose();
}
项目:penguins-in-space    文件:RenderSystem.java   
@Override
protected void processEntity(Entity entity, float deltaTime) {
    TransformComponent transform = transformMapper.get(entity);
    DrawableComponent drawable = drawableMapper.get(entity);
    TextureRegion region = drawable.texture;
    float width = region.getRegionWidth();
    float height = region.getRegionHeight();
    float originX = width * 0.5f;
    float originY = height * 0.5f;
    float x = transform.position.x - originX;
    float y = transform.position.y - originY;
    if (debug) drawBounds(entity);

    batch.draw(drawable.texture, x, y, originX, originY, width, height, transform.scale.x, transform.scale.y, transform.rotation.angle());
    PlayerClass playerClass = playerMapper.get(entity);
    if (playerClass != null && !playerClass.isSelf) {
        font.draw(batch, playerClass.displayName, x, y, width, -1, true);
    }
}
项目:enklave    文件:ScreenRaider.java   
private void addBackground(){
        decalBackground = Decal.newDecal(new TextureRegion(managerAssets.getAssetsCrafting().getTexture(NameFiles.backgroundCrafting)));
        decalBackground.setDimensions(100,200);
        decalBackground.setPosition(0,0,0);
        environment = new Environment();
//        environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 1f, 1f, 1f, 1f));
        environment.set(new ColorAttribute(ColorAttribute.Diffuse));
        environment.set(new ColorAttribute(ColorAttribute.Specular));
        environment.set(new ColorAttribute(ColorAttribute.Reflection));
        environment.add(new DirectionalLight().set(0.51f, 0.5f, 0.5f, 0f, -2f, -30f));
        Model model = managerAssets.getAssetsRaider().getModel(NameFiles.raiderFull);
        model.nodes.get(2).translation.set(-12,28.6f,-5.5f);
//        model.nodes.get(0).translation.set(0,28f,29.2f);
//        model.nodes.get(2).translation.set(0,13,-1);
        instance = new ModelInstance(model);
        instance.transform.trn(0,-20,25).rotate(0,1,0,-25);
        instance.transform.scale(1.5f,1.5f,1.5f);
    }
项目:enklave    文件:ScreenSetting.java   
private void addTestCombat(){
    groupTestCombat = new Group();
    Image background = new Image(new TextureRegion(manager.getAssetsSettings().getTexture(NameFiles.extensionImgBackground)));
    background.setSize(Width - Width * 0.03f, Height * 0.1f);
    background.setPosition(Width / 2 - background.getWidth() / 2, Height * 0.15f);
    groupChangeFaction.addActor(background);
    Label labelFac = new Label("Combat Training",new Label.LabelStyle(Font.getFont((int)(Height*0.025f)),Color.WHITE));
    labelFac.setPosition(background.getX()+background.getWidth()*0.05f,background.getY()+background.getHeight()/2-labelFac.getHeight()/2);
    labelFac.addListener(new ClickListener(){
        @Override
        public void clicked(InputEvent event, float x, float y) {
            manager.loadAssetsEnklaveScreen();
            new GetEnklaveDetails().makeRequest(16066, manager);
            gameManager.screenEnklave.setEnklave3D(new Vector2(0,0));
            gameManager.setScreen(new ScreenCircleLoading(gameManager,gameManager.screenEnklave,manager.getAssertEnklaveScreen()));;
        }
    });
    groupChangeFaction.addActor(labelFac);
}
项目:Hexpert    文件:ObjectiveDialog.java   
public void setObjectives(Objective[] objectives, boolean[] objectiveStatus)
{
    this.objectives = objectives;
    this.objectiveStatus = objectiveStatus;

    if(objectives.length != objectiveStatus.length)
        throw new IllegalArgumentException();

    getContentTable().clearChildren();
    getBackground().setMinHeight(200 + 100 * objectives.length);
    getContentTable().setDebug(false);
    for(int i = 0; i < objectives.length; i++)
    {
        ImageButton imgCheck = new ImageButton(new TextureRegionDrawable(
                new TextureRegion((Texture)
                        hexpert.assetManager.get(objectiveStatus[i] ? TEXTURE_CORRECT : TEXTURE_BAD
                ))));

        Label labelObjective = new Label(objectives[i].toString(hexpert.i18NBundle), getSkin());

        getContentTable().add(imgCheck).width(100).height(80);
        imgCheck.getImageCell().expand().fill();
        getContentTable().add(labelObjective);
        getContentTable().row();
    }
}
项目:project-divine-intervention    文件:CharacterSheet.java   
public CharacterSheet(TextureRegion[] idle, TextureRegion[] forward, TextureRegion[] backward, TextureRegion[] attack, TextureRegion[] in, TextureRegion[] out) {
    this.idle = idle;
    this.forward = forward;
    this.backward = backward;
    this.attack = attack;
    this.in = in;
    this.out = out;
}
项目:cocos2d-java    文件:Sprite.java   
/**set a new textureRegion to the Sprite 
 * @param reset true 会重置尺寸/中心点数据 */
public void setSpriteFrame(TextureRegion newFrame, boolean reset) {
    _sprite.setRegion(newFrame);
    if(reset) {
        super.setAnchorPoint(0.5f, 0.5f);
        super.setContentSize(newFrame.getRegionWidth(), newFrame.getRegionHeight());
        SET_DIRTY_RECURSIVELY();
    }
}
项目:savethebunny    文件:PhaseItem.java   
public PhaseItem(TextureRegion textureRegion, int phaseNum, String title, String subtitle, float positionX, float positionY) {
    super(textureRegion);
    this.phaseNum = phaseNum;
    this.position.x = positionX;
    this.position.y = positionY;
    this.title = title;
    this.subtitle = subtitle;
    this.titleX = this.position.x + (this.dimension.x / 2) - (title.length() * 10);
    this.titleY = this.position.y + this.dimension.y - 10;

    this.subtitleX = this.position.x + (this.dimension.x / 2) - (subtitle.length() * 10);
    this.subtitleY = this.position.y + 50;
}
项目:gdx-cclibs    文件:CompliantBatch.java   
@Override
public void draw (TextureRegion region, float width, float height, Affine2 transform) {
    float[] vertices = tempVertices;

    vertices[U1] = region.getU();
    vertices[V1] = region.getV2();
    vertices[U2] = region.getU();
    vertices[V2] = region.getV();
    vertices[U3] = region.getU2();
    vertices[V3] = region.getV();
    vertices[U4] = region.getU2();
    vertices[V4] = region.getV2();

    float color = this.color;
    vertices[C1] = color;
    vertices[C2] = color;
    vertices[C3] = color;
    vertices[C4] = color;

    // construct corner points
    vertices[X1] = transform.m02;
    vertices[Y1] = transform.m12;
    vertices[X2] = transform.m01 * height + transform.m02;
    vertices[Y2] = transform.m11 * height + transform.m12;
    vertices[X3] = transform.m00 * width + transform.m01 * height + transform.m02;
    vertices[Y3] = transform.m10 * width + transform.m11 * height + transform.m12;
    vertices[X4] = transform.m00 * width + transform.m02;
    vertices[Y4] = transform.m10 * width + transform.m12;

    draw(region.getTexture(), vertices, 0, 20);
}
项目:Mindustry    文件:Sorter.java   
@Override
public void buildTable(Tile tile, Table table){
    SorterEntity entity = tile.entity();

    Array<Item> items = Item.getAllItems();

    ButtonGroup<ImageButton> group = new ButtonGroup<>();
    Table cont = new Table();
    cont.margin(4);
    cont.marginBottom(5);

    cont.add().colspan(4).height(105f);
    cont.row();

    for(int i = 0; i < items.size; i ++){
        final int f = i;
        ImageButton button = cont.addImageButton("white", "toggle", 24, () -> {
            entity.sortItem = items.get(f);
            setConfigure(tile, (byte)f);
        }).size(38, 42).padBottom(-5.1f).group(group).get();
        button.getStyle().imageUp = new TextureRegionDrawable(new TextureRegion(Draw.region("icon-"+items.get(i).name)));
        button.setChecked(entity.sortItem.id == f);

        if(i%4 == 3){
            cont.row();
        }
    }

    table.add(cont);
}
项目:GDX-Engine    文件:Bird.java   
public Bird(IGameService services, TextureRegion tr, Sling sling) {
super(services, tr);

float ratio = (RADIUS * 2f) / getRegionWidth();
setScale(ratio);
this.sling = sling;
   }
项目:GDX-Engine    文件:GameService.java   
@Override
   public void draw(TextureRegion region, Vector2 position, Vector2 origin,
    Vector2 size, Vector2 scale, float rotation) {
batch.draw(region, position.x, position.y, origin.x, origin.y, size.x,
    size.y, scale.x, scale.y, rotation);

   }
项目:Planet-Generator    文件:PixelBuffer.java   
public PixelBuffer() {
    super(Pixmap.Format.RGBA8888, Scene.BUFFER_WIDTH, Scene.BUFFER_HEIGHT, false);
    getColorBufferTexture().setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest);

    pixelBufferRegion = new TextureRegion(getColorBufferTexture(), 0, 0, Scene.BUFFER_WIDTH, Scene.BUFFER_HEIGHT);
    pixelBufferRegion.flip(false, true);
}
项目:feup-lpoo-armadillo    文件:PowerUpView.java   
/**
 * Creates the animation used for this PowerUp Type.
 *
 * @param game the game this view belongs to. Needed to access the
 *             asset manager to get textures.
 * @param fileName the path to the file that contains the animation sheet.
 * @return the animation used for this PowerUp
 */
private Animation<TextureRegion> createAnimation(Armadillo game, String fileName) {
    Texture texture = game.getAssetManager().get(fileName);
    TextureRegion[][] regions = TextureRegion.split(texture, texture.getWidth() / NUM_FRAMES, texture.getHeight());

    TextureRegion[] frames = new TextureRegion[NUM_FRAMES];
    System.arraycopy(regions[0], 0, frames, 0, NUM_FRAMES);

    return new Animation<>(FRAME_TIME, frames);
}
项目:enklave    文件:ScreenRooms.java   
private void addtimerbuildroom(){
    grouptimerbuild = new Group();
    Image bg = new Image(new TextureRegion(manager.getAssetsRooms().getTexture(NameFiles.extensionImgBackground)));
    bg.setSize(Gdx.graphics.getWidth() / 2.75f, Gdx.graphics.getHeight() *0.32f);
    bg.setPosition(Gdx.graphics.getWidth() / 2 - bg.getWidth() / 2, Gdx.graphics.getHeight() / 5f);
    grouptimerbuild.addActor(bg);
    Label labelBuildingRoom = new Label("Building Room",new Label.LabelStyle(Font.getFont((int)(Gdx.graphics.getHeight()*0.025)), Color.WHITE));
    labelBuildingRoom.setPosition(Gdx.graphics.getWidth() / 2 - labelBuildingRoom.getWidth() / 2, Gdx.graphics.getHeight() / 2.2f);
    grouptimerbuild.addActor(labelBuildingRoom);
    labelprocent = new Label("0%",new Label.LabelStyle(new Label.LabelStyle(Font.getFont((int)(Gdx.graphics.getHeight()*0.03)),Color.WHITE)));
    labelprocent.setPosition(Gdx.graphics.getWidth() / 2 - labelprocent.getWidth() / 2, Gdx.graphics.getHeight() / 3.1f);
    grouptimerbuild.addActor(labelprocent);
    grouptimerbuild.setVisible(false);
}
项目:libgdx-learnlib    文件:Clouds.java   
private void init() {
    dimension.set(3.0f, 1.5f);
    regClouds = new Array<TextureRegion>();
    regClouds.add(Assets.instance.levelDecoration.cloud01);
    regClouds.add(Assets.instance.levelDecoration.cloud02);
    regClouds.add(Assets.instance.levelDecoration.cloud03);
    int distFac = 5;
    int numClouds = (int) (length / distFac);
    clouds = new Array<Cloud>(2 * numClouds);
    for (int i = 0; i < numClouds; i++) {
        Cloud cloud = spawnCloud();
        cloud.position.x = i * distFac;
        clouds.add(cloud);
    }
}
项目:MMORPG_Prototype    文件:Monster.java   
public Monster(long id, CustomAnimation<TextureRegion> moveLeftAnimation,
        CustomAnimation<TextureRegion> moveRightAnimation, CustomAnimation<TextureRegion> moveDownAnimation,
        CustomAnimation<TextureRegion> moveUpAnimation, MonsterProperties properties, CollisionMap<GameObject> collisionMap)
{
    super(id, moveLeftAnimation, moveRightAnimation, moveDownAnimation, moveUpAnimation, collisionMap);
    this.properties = properties;
}
项目:libgdx-learnlib    文件:Feather.java   
@Override
public void render(SpriteBatch spriteBatch) {
    if (collected) {
        return;
    }

    TextureRegion reg = null;
    reg = regGoldCoin;
    spriteBatch.draw(reg.getTexture(), position.x, position.y, origin.x, origin.y,
            dimension.x, dimension.y, scale.x, scale.y, rotation,
            reg.getRegionX(), reg.getRegionY(), reg.getRegionWidth(), reg.getRegionHeight(), false, false);

}
项目:MyRoom    文件:AssetLoader.java   
public static void load() {

        texture = new Texture(Gdx.files.internal("data/texture.png"));
        texture.setFilter(TextureFilter.Nearest, TextureFilter.Nearest);

        bg = new TextureRegion(texture, 0, 0, 136, 43);
        bg.flip(false, true);

        grass = new TextureRegion(texture, 0, 43, 143, 11);
        grass.flip(false, true);

        birdDown = new TextureRegion(texture, 136, 0, 17, 12);
        birdDown.flip(false, true);

        bird= new TextureRegion(texture,153,0,17,12);
        bird.flip(false,true);

        birdUp=new TextureRegion(texture,170,0,17,12);
        birdUp.flip(false,true);

        TextureRegion[] birds = {birdDown, bird, birdUp};
        birdAnimation=new Animation(0.06f,birds);
        birdAnimation.setPlayMode(Animation.PlayMode.LOOP_PINGPONG);

        skullUp =new TextureRegion(texture,192,0,24,14);
        skullDown = new TextureRegion(skullUp);
        skullDown.flip(false,true);

        bar = new TextureRegion(texture, 136, 16, 22, 3);
        bar.flip(false,true);

    }
项目:penguins-in-space    文件:AnimationFactory.java   
private Array<TextureRegion> createShortExplosion() {
    Array<TextureRegion> explosions = new Array<>();
    Texture texture = assetService.getTexture(AssetService.TextureAsset.BOMB_EXPLOSION);
    TextureRegion[][] split = TextureRegion.split(texture, 128, 128);
    for (TextureRegion[] row : split) {
        for (TextureRegion region : row) {
            explosions.add(region);
            explosions.add(region);
        }
    }
    return explosions;
}
项目:Tower-Defense-Galaxy    文件:VRContext.java   
VRPerEyeData(FrameBuffer buffer, TextureRegion region, VRCamera cameras) {
    this.buffer = buffer;
    this.region = region;
    this.camera = cameras;
    this.texture = org.lwjgl.openvr.Texture.create();
    this.texture.set(buffer.getColorBufferTexture().getTextureObjectHandle(), VR.ETextureType_TextureType_OpenGL, VR.EColorSpace_ColorSpace_Gamma);
}
项目:enklave    文件:ScreenRooms.java   
private void addimagebg(){
    MapPixmap imageBG = MapPixmap.getInstance();
    decalBackground = Decal.newDecal(new TextureRegion(new Texture(imageBG.getImage(1,1))));
    decalBackground.setPosition(0, 0, 0);
    decalBackground.setDimensions(Gdx.graphics.getHeight() * 0.3125f, Gdx.graphics.getHeight() * 0.3125f);
    decalBackground.setBlending(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
}
项目:Parasites-of-HellSpace    文件:Boom.java   
public Boom(float x, float y)
{
    texture = AssetLoader.assetManager.get("explosion.pack", TextureAtlas.class);
    animation = new Animation<TextureRegion>(1/15f, texture.getRegions());
    sprite = new Sprite(animation.getKeyFrame(0));
    elapsedTime = 0;
    sprite.setPosition(x, y);
    rotationAngle = MathUtils.random(359);
    sprite.setRotation(rotationAngle);
}
项目:GDX-Engine    文件:GameService.java   
@Override
   public void draw(TextureRegion region, Vector2 position, Vector2 origin,
    Vector2 size, float scale, float rotation) {
batch.draw(region, position.x, position.y, origin.x, origin.y, size.x,
    size.y, scale, scale, rotation);

   }
项目:GDX-Engine    文件:GameAsset.java   
@Override
   public void load(){

AssetLoader.setAssetClass(Texture.class);
for(int i = 0; i < 15; i++){
    monsterTexture[i] = AssetLoader.load("towerdefense/monster/monster ("+i+").png");
}
AssetLoader.setAssetClass(TextureRegion.class);
canon = AssetLoader.load("towerdefense/tower/canon.png", new Rectangle(190, 0, 63, 63));
towerTexture = AssetLoader.load("towerdefense/tower/tower.png");
gun = AssetLoader.load("towerdefense/tower/gun.png", new Rectangle(190, 0, 63, 63));
slower = AssetLoader.load("towerdefense/tower/slower.png", new Rectangle(190, 0, 63, 63));
   }
项目:Flappy-Baranus    文件:Bird.java   
public Bird(int x, int y){
    position = new Vector3(x, y, 0);
    velosity = new Vector3(0, 0, 0);
    texture = new Texture("Sheep-Animated-Gif4.png");
    birdAnimation = new Animation(new TextureRegion(texture), FRAME_COUNT, 0.9f);
    bounds = new Rectangle(x, y, texture.getWidth() / FRAME_COUNT, texture.getHeight());
    flap = Gdx.audio.newSound(Gdx.files.internal("sfx_wing.ogg"));
}
项目:Flappy-Baranus    文件:Animation.java   
public Animation(TextureRegion region, int frameCount, float cycleTime){
    frames = new Array<TextureRegion>();
    int frameWidth = region.getRegionWidth() / frameCount;
    for (int i = 0; i < frameCount; i++){
        frames.add(new TextureRegion(region, i * frameWidth, 0, frameWidth, region.getRegionHeight()));
    }
    this.frameCount = frameCount;
    maxFrameTime = cycleTime / frameCount;
    frame = 0;
}
项目:summer17-android    文件:Cherry.java   
public Cherry(int x, int y){
    cherry = new Texture("Cherry2_0.35.png");
    cherryAnimation = new Animation(new TextureRegion(cherry),2,0.5f);
    rand = new Random();
    posCherry = new Vector2(rand.nextInt(FLUCTUATION)+CHERRY_MIN_X, y);
    cherryBounds = new Rectangle(posCherry.x,posCherry.y,cherry.getWidth(),cherry.getHeight());
    collided = false;

}
项目:Cubes_2    文件:SlotActor.java   
public void draw(Batch batch, float x, float y, float width, float height) {
  batch.draw(blank, x, y, width, height);
  if (inventory.itemStacks[num] != null) {
    TextureRegion region = inventory.itemStacks[num].getTextureRegion();
    batch.draw(region, x + 2f, y + 2f, width - 4f, height - 4f);
    drawText(batch, x + 2f, y + 2f, inventory.itemStacks[num]);
  }
}
项目:GDX-Engine    文件:DefaultGameAsset.java   
@Override
public TextureRegion loadTextureRegion(Texture texture, Rectangle rec)
{
    TextureRegion tr = new TextureRegion(texture, (int)rec.x, (int)rec.y, (int)rec.width, (int)rec.height);
    //flip for system of y-axis down
    if(Game.isYdown())
        tr.flip(false, true);
    return tr;
}
项目:gdx-fireapp    文件:ImageHelper.java   
/**
 * Transforms byte[] to Texture Region.
 * <p>
 * If you are going to call this method inside firebase callback remember to wrap it<p>
 * into {@code Gdx.app.postRunnable(Runnable)}.
 * The texture will be changed so that it has sides with length of power of 2.
 *
 * @param bytes Byte array with image description
 * @return Texture region representation of given byte array
 */
public static TextureRegion createTextureFromBytes(byte[] bytes)
{
    Pixmap pixmap = new Pixmap(bytes, 0, bytes.length);
    final int orgWidth = pixmap.getWidth();
    final int orgHeight = pixmap.getHeight();
    int width = MathUtils.nextPowerOfTwo(orgWidth);
    int height = MathUtils.nextPowerOfTwo(orgHeight);
    final Pixmap potPixmap = new Pixmap(width, height, pixmap.getFormat());
    potPixmap.drawPixmap(pixmap, 0, 0, 0, 0, pixmap.getWidth(), pixmap.getHeight());
    pixmap.dispose();
    TextureRegion region = new TextureRegion(new Texture(potPixmap), 0, 0, orgWidth, orgHeight);
    potPixmap.dispose();
    return region;
}