当前位置: 首页>>代码示例>>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;未经允许,请勿转载。