當前位置: 首頁>>代碼示例>>Java>>正文


Java Texture類代碼示例

本文整理匯總了Java中com.badlogic.gdx.graphics.Texture的典型用法代碼示例。如果您正苦於以下問題:Java Texture類的具體用法?Java Texture怎麽用?Java Texture使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Texture類屬於com.badlogic.gdx.graphics包,在下文中一共展示了Texture類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: TileEffectDialog

import com.badlogic.gdx.graphics.Texture; //導入依賴的package包/類
public TileEffectDialog(Hexpert hexpert, Skin skin) {
    super(hexpert, skin, false);
    getContentTable().defaults().pad(15);

    for(int i = 0; i < TileType.values().length; i++)
    {
        TileType tileType = TileType.values()[i];
        Image tileImage = new Image(new TextureRegion((Texture) hexpert.assetManager.get(SPRITE_FOLDER + tileType.name().toLowerCase() + "_tile.png")));
        getContentTable().add(tileImage).width(96).height(96);

        Label lblDesc = new Label(hexpert.i18NBundle.get(tileType.name().toLowerCase() + "_effect"), skin);
        lblDesc.setAlignment(Align.center);
        getContentTable().add(lblDesc);
        getContentTable().row();
    }
}
 
開發者ID:MartensCedric,項目名稱:Hexpert,代碼行數:17,代碼來源:TileEffectDialog.java

示例2: createUndoButton

import com.badlogic.gdx.graphics.Texture; //導入依賴的package包/類
private void createUndoButton()
{
	Skin skin = new Skin();
	Pixmap pixmap = new Pixmap(1, 1, Pixmap.Format.RGBA8888);
	pixmap.setColor(Color.WHITE);
	pixmap.fill();
	skin.add("white", new Texture(pixmap));
	skin.add("default", new BitmapFont());

	TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle();
	textButtonStyle.up = skin.newDrawable("white", new Color(0, 0, 0, 1));
	textButtonStyle.font = skin.getFont("default");
	skin.add("default", textButtonStyle);

	btnUndo = new TextButton("UNDO", skin);
	btnUndo.setX(70);
	btnUndo.setY(Gdx.graphics.getHeight() - 25);
	btnUndo.setWidth(60);
	btnUndo.setVisible(true);
	group.addActor(btnUndo);
}
 
開發者ID:MartensCedric,項目名稱:LD38-Compo,代碼行數:22,代碼來源:LudumDare38.java

示例3: drawtopcombat

import com.badlogic.gdx.graphics.Texture; //導入依賴的package包/類
private void drawtopcombat(){
    groupTop = new Group();
    Texture lookup = managerAssets.getAssetsCombat().getTexture(NameFiles.progressbarcircular);
    lookup.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
    progressBarEnergy = ProgressBarEnergy.getInstance();
    Image imageLeftprofile = new Image(new TextureRegion(managerAssets.getAssetsButton().get(NameFiles.buttonBack1)));
    imageLeftprofile.setSize(Gdx.graphics.getWidth() * 0.15f, Gdx.graphics.getWidth() * 0.15f);
    imageLeftprofile.setPosition(imageLeftprofile.getWidth() * 0.1f, Gdx.graphics.getHeight() - imageLeftprofile.getHeight() * 1.1f);
    imageLeftprofile.addListener(new ClickListener(){
        @Override
        public void clicked(InputEvent event, float x, float y) {
            if(InformationProfile.getInstance().getDateUserGame().getEnklaveCombatId() == -1)
                gameManager.setScreen(gameManager.screenEnklave);
            else
                dialogExit("You can't out from combat!");
        }
    });
    groupTop.addActor(imageLeftprofile);
}
 
開發者ID:TudorRosca,項目名稱:enklave,代碼行數:20,代碼來源:ScreenCombat.java

示例4: Water

import com.badlogic.gdx.graphics.Texture; //導入依賴的package包/類
/**
 * Constructor that allows to specify if there is an effect of waves and splash particles.
 * @param waves Specifies whether the object will have waves
 * @param splashParticles Specifies whether the object will have splash particles
 */
public Water(boolean waves, boolean splashParticles) {

	this.waves = waves;
	this.splashParticles = splashParticles;
	this.fixturePairs = new HashSet<Pair<Fixture, Fixture>>();
	this.setDebugMode(false);

	if (waves) {
		textureWater = new TextureRegion(new Texture(Gdx.files.internal("water.png")));
		polyBatch = new PolygonSpriteBatch();
	}

	if (splashParticles) {
		textureDrop = new Texture(Gdx.files.internal("drop.png"));
		spriteBatch = new SpriteBatch();
		particles = new ArrayList<Particle>();
	}

	shapeBatch = new ShapeRenderer();
	shapeBatch.setColor(0, 0.5f, 1, 1);
}
 
開發者ID:jocasolo,項目名稱:water2d-libgdx,代碼行數:27,代碼來源:Water.java

示例5: saveAndReload

import com.badlogic.gdx.graphics.Texture; //導入依賴的package包/類
public void saveAndReload(Map map, Pixmap out){
	if(map.pixmap != null && out != map.pixmap && map.texture != null){
		map.texture.dispose();
		map.texture = new Texture(out);
	}else if (out == map.pixmap){
		map.texture.draw(out, 0, 0);
	}
	
	map.pixmap = out;
	if(map.texture == null) map.texture = new Texture(map.pixmap);
	
	if(map.id == -1){
		if(mapNames.containsKey(map.name)){
			map.id = mapNames.get(map.name).id;
		}else{
			map.id = ++lastID;
		}
	}
	
	if(!Settings.has("hiscore" + map.name)){
		Settings.defaults("hiscore" + map.name, 0);
	}
	
	saveCustomMap(map);
	Vars.ui.levels.reload();
}
 
開發者ID:Anuken,項目名稱:Mindustry,代碼行數:27,代碼來源:Maps.java

示例6: create

import com.badlogic.gdx.graphics.Texture; //導入依賴的package包/類
@Override
public void create() {
	
        rotationSpeed = 0.5f;
        mesh = new Mesh(true, 4, 6,
                        new VertexAttribute(VertexAttributes.Usage.Position, 3,"attr_Position"),
                        new VertexAttribute(Usage.TextureCoordinates, 2, "attr_texCoords"));
        texture = new Texture(Gdx.files.internal("data/Jellyfish.jpg"));
        mesh.setVertices(new float[] { 
                         -1024f, -1024f, 0, 0, 1,
                          1024f, -1024f, 0, 1, 1,
                          1024f,  1024f, 0, 1, 0,
                         -1024f,  1024f, 0, 0, 0
        });
        mesh.setIndices(new short[] { 0, 1, 2, 2, 3, 0 });

        cam = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());            
        xScale = Gdx.graphics.getWidth()/(float)TARGET_WIDTH;
        yScale = Gdx.graphics.getHeight()/(float)TARGET_HEIGHT;
        font = loadBitmapFont("default.fnt", "default.png");
        scale = Math.min(xScale, yScale);
        cam.zoom = 1/scale;
      //  cam.project(start_position);
        cam.position.set(0, 0, 0);
        batch = new SpriteBatch();
}
 
開發者ID:game-libgdx-unity,項目名稱:GDX-Engine,代碼行數:27,代碼來源:TestCamera.java

示例7: addActor

import com.badlogic.gdx.graphics.Texture; //導入依賴的package包/類
@Override
public void addActor(ActorAddEvent event) {

    Actor actor = event.actor;
    StringBuilder item_name = new StringBuilder();
    item_name.append(actor.getName()==null?"":actor.getName());
    item_name.append("[");

    item_name.append(EditorManager.getInstance()
            .getActorType(actor).getSimpleName());
    item_name.append("]");
    Tree.Node item = createNodeItem(actor,item_name.toString());
    item.setIcon(new TextureRegionDrawable(new TextureRegion(new Texture(
            Gdx.files.internal("icon/Label_16.png")))));
    item.getActor().setTouchable(Touchable.disabled);
    if (actor.getParent() instanceof MainWindow){
        stageNode.add(item);
    }else {
        Tree.Node parentNode = stageNode.findNode(actor.getParent());
        if (parentNode!=null) parentNode.add(item);
    }
    tree.getSelection().choose(item);

}
 
開發者ID:whitecostume,項目名稱:libgdx_ui_editor,代碼行數:25,代碼來源:TreeWindow.java

示例8: BuildingScoreDialog

import com.badlogic.gdx.graphics.Texture; //導入依賴的package包/類
public BuildingScoreDialog(Hexpert hexpert, Skin skin) {
    super(hexpert, skin, false);
    
    getContentTable().defaults().pad(15);
    Label.LabelStyle lblStyle = skin.get("bigger", Label.LabelStyle.class);
    Label lblExplaination = new Label(hexpert.i18NBundle.get("tut_score"), skin);
    lblExplaination.setWrap(true);
    lblExplaination.setAlignment(Align.center);
    getContentTable().add(lblExplaination).colspan(8).width(8*160);
    lblExplaination.setWrap(true);
    getContentTable().row();

    for (int i = 1; i < BuildingType.values().length; i++) {
        BuildingType buildingType = BuildingType.values()[i];
        Image image = new Image(new TextureRegion((Texture)
                hexpert.assetManager.get(SPRITE_FOLDER + buildingType.name().toLowerCase() + "_min.png")));

        getContentTable().add(image).width(160).height(160);
        Label lblScore = new Label(Integer.toString(buildingType.getScore()), lblStyle);
        lblScore.setAlignment(Align.center);
        getContentTable().add(lblScore).expand();
        if (i % 4 == 0)
            getContentTable().row();
    }
}
 
開發者ID:MartensCedric,項目名稱:Hexpert,代碼行數:26,代碼來源:BuildingScoreDialog.java

示例9: GameCenter

import com.badlogic.gdx.graphics.Texture; //導入依賴的package包/類
public GameCenter(Chat game){
  this.game = game;

  /*Camera Settings*/
  camera = new OrthographicCamera();
  camera.setToOrtho(false,480,800);
  camera.position.set(480/2,800/2,0);

  /*Button Areas*/
  wordTiles = new Rectangle(480/2-250/2,800/2,250,55);
  Arkanoid = new Rectangle(480/2-250/2,800/2-60,250,55);
  WordCrush = new Rectangle(480/2-250/2,800/2-120,250,55);
  EndlessRoad = new Rectangle(480/2-250/2,800/2-180,250,55);
  bottone4 = new Rectangle(480/2-250/2,800/2-240,250,55);
  buttonTexture = new Texture("green_button00.png");
  touch = new Vector3();
}
 
開發者ID:curiosone-bot,項目名稱:curiosone-app,代碼行數:18,代碼來源:GameCenter.java

示例10: createSkins

import com.badlogic.gdx.graphics.Texture; //導入依賴的package包/類
/**
 * Function used to create the Skins' Buttons and Labels and associate them to a given table, organized.
 * It also adds Listeners to the Skins' Buttons.
 *
 * @param table Table where the Skins' Labels and Buttons will be organized.
 */
private void createSkins(Table table) {
    for (int i = 0; i < game.getNumSkins(); ++i) {

        //Adding Buttons and Labels to the Arrays
        skinButtons.add(new Button(new TextureRegionDrawable(new TextureRegion(game.getAssetManager().get("big_skins/skin" + (i < 10 ? "0" : "") + i + ".png", Texture.class)))));
        skinLabels.add(new Label("Current", skin1));

        final int j = i; //Needed for Listener initialization
        skinButtons.get(i).addListener(new ClickListener() {
            @Override
            public void clicked(InputEvent event, float x, float y) {
                setCurrentLabel(j);
            }
        });

        table.add(skinButtons.get(i)).size(BUTTON_SIZE, BUTTON_SIZE).pad(IMAGE_EDGE);
    }
    table.row();

    for (int i = 0; i < game.getNumSkins(); ++i)
        table.add(skinLabels.get(i));

    initializeCurrentSkin();
}
 
開發者ID:AndreFCruz,項目名稱:feup-lpoo-armadillo,代碼行數:31,代碼來源:CustomizeMenuScreen.java

示例11: setTexture

import com.badlogic.gdx.graphics.Texture; //導入依賴的package包/類
public void setTexture(Texture texture, boolean setNewDimension) {
    Texture oldTexture = this.texture;
    this.texture = texture;

    // set dimension of texture
    setDimension(texture.getWidth(), texture.getHeight());

    if (setNewDimension) {
        // update width and height
        this.positionComponent.setDimension(texture.getWidth(), texture.getHeight());

        if (this.texture != null) {
            // update dimension
            this.width = this.texture.getWidth();
            this.height = this.texture.getHeight();
        }
    }

    this.textureChangedListenerList.stream().forEach(listener -> {
        listener.onTextureChanged(oldTexture, this.texture);
    });
}
 
開發者ID:opensourcegamedev,項目名稱:SpaceChaos,代碼行數:23,代碼來源:DrawTextureComponent.java

示例12: GameScreen

import com.badlogic.gdx.graphics.Texture; //導入依賴的package包/類
public GameScreen(String playerName) {
	camera = new Camera();
	player = new Player(playerName,0,0,"Players/player.png");
	controller = new CursedEchoController(player);
	stage = new Stage();
	
	map  = GameUtils.getGame().assetHandler.get("World/grass.png",Texture.class);
	
	camera.setToOrtho(false,Gdx.graphics.getWidth()/2,Gdx.graphics.getHeight()/2);
	camera.update();
	
	switch(Gdx.app.getType()) {
	case Android:
		controller.addTouchPad(stage);
		break;
	default:
		break;
	}
}
 
開發者ID:Arcxes,項目名稱:CursedEcho,代碼行數:20,代碼來源:GameScreen.java

示例13: loadSkin

import com.badlogic.gdx.graphics.Texture; //導入依賴的package包/類
static Skin loadSkin() {
    String folder = "ui/x" + bestMultiplier + "/";

    // Base skin
    Skin skin = new Skin(Gdx.files.internal("skin/uiskin.json"));

    // Nine patches
    final int border = (int)(28 * bestMultiplier);
    skin.add("button_up", new NinePatch(new Texture(
            Gdx.files.internal(folder + "button_up.png")), border, border, border, border));

    skin.add("button_down", new NinePatch(new Texture(
            Gdx.files.internal(folder + "button_down.png")), border, border, border, border));

    for (String id : ids) {
        skin.add(id + "_texture", new Texture(Gdx.files.internal(folder + id + ".png")));
    }

    folder = "font/x" + bestMultiplier + "/";
    skin.add("font", new BitmapFont(Gdx.files.internal(folder + "geosans-light64.fnt")));
    skin.add("font_small", new BitmapFont(Gdx.files.internal(folder + "geosans-light32.fnt")));
    skin.add("font_bonus", new BitmapFont(Gdx.files.internal(folder + "the-next-font.fnt")));

    return skin;
}
 
開發者ID:LonamiWebs,項目名稱:Klooni1010,代碼行數:26,代碼來源:SkinLoader.java

示例14: AssetsRooms

import com.badlogic.gdx.graphics.Texture; //導入依賴的package包/類
public AssetsRooms() {
    manager = new AssetManager();
    manager.load(NameFiles.topenklaveimage,Texture.class);
    manager.load(NameFiles.noselectRooms,Texture.class);
    manager.load(NameFiles.selectroombottom,Texture.class);
    manager.load(NameFiles.selectroomleft,Texture.class);
    manager.load(NameFiles.selectroomright,Texture.class);
    manager.load(NameFiles.txtSelectRoom,Texture.class);
    manager.load(NameFiles.imageArrowBottom,Texture.class);
    manager.load(NameFiles.imageArrowRight,Texture.class);
    manager.load(NameFiles.imagePulse,Texture.class);
    manager.load(NameFiles.extensionImgBackground,Texture.class);
    manager.load(NameFiles.borderImageBlue,Texture.class);
    manager.load(NameFiles.borderUpdown,Texture.class);
    manager.load(NameFiles.progressbarcircular,Texture.class);
    manager.load(NameFiles.imageBarrack,Texture.class);
    manager.load(NameFiles.imageCommCenter,Texture.class);
    manager.load(NameFiles.imageLaboratory,Texture.class);
    manager.load(NameFiles.frameEnk,Texture.class);
}
 
開發者ID:TudorRosca,項目名稱:enklave,代碼行數:21,代碼來源:AssetsRooms.java

示例15: createPowerup

import com.badlogic.gdx.graphics.Texture; //導入依賴的package包/類
/**
 * Creates a new power up entity.
 *
 * @param ecs
 *            entity component system
 * @param x
 *            x start position
 * @param y
 *            y start position
 * @param texture
 *            texture
 * @return power up entity
 */
public static Entity createPowerup(EntityManager ecs, float x, float y, Texture texture) {
    // create new entity
    Entity powerupEntity = new Entity(ecs);

    // every entity requires a position component
    powerupEntity.addComponent(new PositionComponent(x, y), PositionComponent.class);

    // add texture component to draw texture
    powerupEntity.addComponent(new DrawTextureComponent(texture, texture.getWidth() / 2, texture.getHeight() / 2),
            DrawTextureComponent.class);

    // add collision component, so entity can collide with other space
    // shuttles or meteorites
    powerupEntity.addComponent(new CollisionComponent(), CollisionComponent.class);
    powerupEntity.getComponent(CollisionComponent.class)
            .addInnerShape(new CCircle(texture.getWidth() / 2, texture.getHeight() / 2, texture.getWidth() / 2));

    //avoid camera shake on collision and sounds on collision
    powerupEntity.addComponent(new AvoidCollisionCameraShakeComponent(), AvoidCollisionCameraShakeComponent.class);
    powerupEntity.addComponent(new AvoidCollisionSoundComponent(), AvoidCollisionSoundComponent.class);

    return powerupEntity;
}
 
開發者ID:opensourcegamedev,項目名稱:SpaceChaos,代碼行數:37,代碼來源:PowerupFactory.java


注:本文中的com.badlogic.gdx.graphics.Texture類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。