本文整理匯總了Java中com.badlogic.gdx.scenes.scene2d.ui.Skin.add方法的典型用法代碼示例。如果您正苦於以下問題:Java Skin.add方法的具體用法?Java Skin.add怎麽用?Java Skin.add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.badlogic.gdx.scenes.scene2d.ui.Skin
的用法示例。
在下文中一共展示了Skin.add方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createToolTip
import com.badlogic.gdx.scenes.scene2d.ui.Skin; //導入方法依賴的package包/類
private void createToolTip()
{
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);
labelToolTip = new TextButton("TEST", skin);
labelToolTip.setX(5);
labelToolTip.setY(5);
labelToolTip.setWidth(125);
labelToolTip.setVisible(false);
labelToolTip.getLabel().setWrap(true);
labelToolTip.setHeight(labelToolTip.getLabel().getHeight());
group.addActor(labelToolTip);
}
示例2: createResetButton
import com.badlogic.gdx.scenes.scene2d.ui.Skin; //導入方法依賴的package包/類
private void createResetButton()
{
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);
btnReset = new TextButton("RESET", skin);
btnReset.setX(5);
btnReset.setY(Gdx.graphics.getHeight() - 25);
btnReset.setWidth(60);
btnReset.setVisible(true);
group.addActor(btnReset);
}
示例3: createUndoButton
import com.badlogic.gdx.scenes.scene2d.ui.Skin; //導入方法依賴的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);
}
示例4: updateVisual
import com.badlogic.gdx.scenes.scene2d.ui.Skin; //導入方法依賴的package包/類
public void updateVisual(){
Skin skin = new Skin();
Pixmap pixmap = new Pixmap(1,(int)(Gdx.graphics.getHeight()*0.0175), Pixmap.Format.RGBA8888);
switch (infoProfile.getDateUserGame().getFaction()){
case 1:{
pixmap.setColor(1, 0f, 0f, 1);
break;
}
case 2:{
pixmap.setColor(0f, 0.831f, 0.969f,1f);
break;
}
case 3:{
pixmap.setColor(0.129f, 0.996f, 0.29f,1);
break;
}
}
pixmap.fill();
skin.add("blue", new Texture(pixmap));
ProgressBar.ProgressBarStyle style = new ProgressBar.ProgressBarStyle(bar.getStyle().background,skin.newDrawable("blue",Color.WHITE));
style.knobBefore = style.knob;
bar.setStyle(style);
}
示例5: loadSkin
import com.badlogic.gdx.scenes.scene2d.ui.Skin; //導入方法依賴的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;
}
示例6: initTouchpad
import com.badlogic.gdx.scenes.scene2d.ui.Skin; //導入方法依賴的package包/類
private void initTouchpad() {
// TODO: use uiskin.json
// Skin touchpadSkin = new Skin(Gdx.files.internal("data/uiskin.json"));
Skin touchpadSkin = new Skin();
touchpadSkin.add("touchBackground", assetService.getTexture(TOUCH_BACKGROUND));
touchpadSkin.add("touchKnob", assetService.getTexture(TOUCH_KNOB));
Touchpad.TouchpadStyle style = new Touchpad.TouchpadStyle();
style.background = touchpadSkin.getDrawable("touchBackground");
style.knob = touchpadSkin.getDrawable("touchKnob");
style.knob.setMinHeight(TOUCHPAD_SIZE / 2);
style.knob.setMinWidth(TOUCHPAD_SIZE / 2);
touchPad = new Touchpad(15, style);
touchPad.setBounds(TOUCHPAD_MARGIN, TOUCHPAD_MARGIN, TOUCHPAD_SIZE, TOUCHPAD_SIZE);
addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
super.clicked(event, x, y);
}
});
NoClickZone padZone = new NoClickZone(touchPad, NO_CLICK_MARGIN);
addActor(padZone);
touchpadSkin.add("touchButton", assetService.getTexture(TOUCH_KNOB));
button = new GamepadButton(touchpadSkin.getDrawable("touchButton"));
button.setSize(BUTTON_SIZE, BUTTON_SIZE);
NoClickZone buttonZone = new NoClickZone(button, NO_CLICK_MARGIN);
addActor(buttonZone);
}
示例7: initTouchPad
import com.badlogic.gdx.scenes.scene2d.ui.Skin; //導入方法依賴的package包/類
private void initTouchPad() {
touchpadSkin = new Skin();
touchpadSkin.add("touchBackground", GameUtils.getGame().assetHandler.get("Controls/touchBackground.png",Texture.class));
touchpadSkin.add("touchKnob", GameUtils.getGame().assetHandler.get("Controls/touchKnob.png",Texture.class));
touchpadStyle = new TouchpadStyle();
touchBackground = touchpadSkin.getDrawable("touchBackground");
touchKnob = touchpadSkin.getDrawable("touchKnob");
touchpadStyle.background = touchBackground;
touchpadStyle.knob = touchKnob;
touchpad = new Touchpad(10, touchpadStyle);
touchpad.setBounds(15, 15, 200, 200);
}
示例8: IntroScreen
import com.badlogic.gdx.scenes.scene2d.ui.Skin; //導入方法依賴的package包/類
IntroScreen(final ParticleGame game) {
particle_game = game;
stage = new Stage();
table = new Table();
table.setFillParent(true);
table.setDebug(true);
stage.addActor(table);
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("font", game.getFont());
TextButton.TextButtonStyle text_button_style = new TextButton.TextButtonStyle();
final Color button_color = new Color(226 / 255f, 226 / 255f, 226 / 255f, 1f);
final Color hover_color = new Color(162 / 255f, 162 / 255f, 162 / 255f, 1f);
text_button_style.up = skin.newDrawable("white", button_color);
text_button_style.down = skin.newDrawable("white", button_color);
text_button_style.over = skin.newDrawable("white", hover_color);
text_button_style.font = skin.getFont("font");
skin.add("default", text_button_style);
TextButton play_button = new TextButton("play", skin);
play_button.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
particle_game.setScreen(particle_game.getGameSetupScreen());
}
});
table.add(play_button);
}
示例9: ParticleChoiceScreen
import com.badlogic.gdx.scenes.scene2d.ui.Skin; //導入方法依賴的package包/類
ParticleChoiceScreen(final ParticleGame p, final GameScreen g) {
game = p;
game_screen = g;
camera = new OrthographicCamera(PARTICLE_BOARD_W, PARTICLE_BOARD_W);
camera.position.set(PARTICLE_BOARD_W / 2, PARTICLE_BOARD_W / 2, 0);
camera.update();
initStage();
initTable();
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", game.getFont());
TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle();
final Color buttonColor = new Color(226 / 255f, 226 / 255f, 226 / 255f, 1f);
final Color hoverColor = new Color(162 / 255f, 162 / 255f, 162 / 255f, 1f);
textButtonStyle.up = skin.newDrawable("white", buttonColor);
textButtonStyle.down = skin.newDrawable("white", buttonColor);
textButtonStyle.over = skin.newDrawable("white", hoverColor);
textButtonStyle.font = skin.getFont("default");
skin.add("default", textButtonStyle);
Label.LabelStyle labelStyle = new Label.LabelStyle();
labelStyle.font = game.getFont();
labelStyle.fontColor = Color.WHITE;
skin.add("default", labelStyle);
// initTableContents(skin);
}
示例10: createSkin
import com.badlogic.gdx.scenes.scene2d.ui.Skin; //導入方法依賴的package包/類
private Skin createSkin() {
Skin returnValue = new Skin();
returnValue.add("bg", createDrawable(20, 20, Color.DARK_GRAY), Drawable.class);
returnValue.add("progress-bar-back", createDrawable(20, 20, Color.BLACK), Drawable.class);
returnValue.add("progress-bar", createDrawable(1, 20, Color.BLUE), Drawable.class);
ProgressBarStyle progressBarStyle = new ProgressBarStyle();
progressBarStyle.background = returnValue.getDrawable("progress-bar-back");
progressBarStyle.knobBefore = returnValue.getDrawable("progress-bar");
returnValue.add("default-horizontal", progressBarStyle);
return returnValue;
}
示例11: createSkin
import com.badlogic.gdx.scenes.scene2d.ui.Skin; //導入方法依賴的package包/類
public static void createSkin(){
fontHemi10 = createFont(10 , Fonts.HEMI_HEAD);
fontHemi12 = createFont(12 , Fonts.HEMI_HEAD);
fontHemi16 = createFont(16 , Fonts.HEMI_HEAD);
fontHemi18 = createFont(18, Fonts.HEMI_HEAD);
fontVeraRg10 = createFont(10 , Fonts.VERA);
fontVeraBd16 = createFont(16, Fonts.VERA_BD);
fontHemi20 = createFont(20,Fonts.HEMI_HEAD);
fontVeraRg20 = createFont(20, Fonts.VERA);
fontVeraBd20 = createFont(20, Fonts.VERA_BD);
fontHemi24 = createFont(24 ,Fonts.HEMI_HEAD);
fontVeraRg24 = createFont(24, Fonts.VERA);
fontVeraBd24 = createFont(24, Fonts.VERA_BD);
Skin skin = new Skin();
TextureAtlas atlas = new TextureAtlas("interface/ui/atlas-ui.txt");
skin.addRegions(atlas);
skin.add("fontVeraRg10", Assets.fontVeraRg10);
skin.add("fontHemi10", Assets.fontHemi10);
skin.add("fontHemi12", Assets.fontHemi12);
skin.add("default-font", Assets.fontHemi16);
skin.add("fontVeraBd16", Assets.fontVeraBd16);
skin.add("fontHemi18", Assets.fontHemi18);
skin.add("fontHemi20", Assets.fontHemi20);
skin.add("fontVeraBd20", Assets.fontVeraBd20);
skin.add("fontVeraRg20", fontVeraRg20);
skin.add("fontHemi24", Assets.fontHemi24);
skin.add("fontVeraRg24", Assets.fontVeraRg24);
skin.add("fontVeraBd24", Assets.fontVeraBd24);
skin.load(Gdx.files.internal("interface/ui/uiSkin.json"));
_skin = skin;
}
示例12: touchPadConf
import com.badlogic.gdx.scenes.scene2d.ui.Skin; //導入方法依賴的package包/類
public void touchPadConf() {
touchpadSkin = new Skin();
touchpadSkin.add("touchpadBackground", new Texture("touchpadBackground.png"));
touchpadSkin.add("touchKnob", new Texture("touchKnob.png"));
touchpadStyle = new Touchpad.TouchpadStyle();
touchpadBackground = touchpadSkin.getDrawable("touchpadBackground");
touchpadKnob = touchpadSkin.getDrawable("touchKnob");
touchpadStyle.background = touchpadBackground;
touchpadStyle.knob = touchpadKnob;
touchpad = new Touchpad(20, touchpadStyle);
touchpad.setBounds(15, 15 ,150, 150);
}
示例13: DrawOneAttachers
import com.badlogic.gdx.scenes.scene2d.ui.Skin; //導入方法依賴的package包/類
private Group DrawOneAttachers(String typeFrame, String name, Color type, String photo, float energy,float energymax) {
Group gr = new Group();
Texture txt = managerAssets.getAssetsCombat().getTexture(typeFrame);
Vector2 crop = Scaling.fit.apply(txt.getWidth(),txt.getHeight(),WIDTH,HEIGHT);
final Image frame = new Image(new TextureRegion(txt));
frame.setName("frame");
frame.setSize(crop.x * 0.18f, crop.y * 0.2f);
frame.setPosition(WIDTH - frame.getWidth() * 1.13f, HEIGHT / 2.3f);
gr.addActor(frame);
if(InformationProfile.getInstance().getDateUserGame().getFaction() != InformationEnklave.getInstance().getFaction())
txt = managerAssets.getAssetsCombat().getTexture(NameFiles.targetRecharge);
else
txt = managerAssets.getAssetsCombat().getTexture(NameFiles.target);
crop = Scaling.fit.apply(txt.getWidth(), txt.getHeight(), WIDTH, HEIGHT);
Image frameselect = new Image(new TextureRegion(txt));
frameselect.setSize(crop.x * 0.18f, crop.y * 0.2f);
frameselect.setName("frameselect");
frameselect.toFront();
frameselect.setPosition(WIDTH - frame.getWidth() * 1.13f, HEIGHT / 2.3f);
frameselect.setVisible(false);
gr.addActor(frameselect);
Label labelName = new Label(name.substring(0,name.length()>9 ? 9 : name.length()), new Label.LabelStyle(bt, type));
labelName.setAlignment(Align.center);
labelName.setWidth(crop.x*0.18f);
labelName.setPosition(frame.getX(), frame.getY() + frame.getHeight() * 0.25f);
gr.addActor(labelName);
txt = managerAssets.getAssetsCombat().getTexture(photo);
crop = Scaling.fit.apply(txt.getWidth(), txt.getHeight(), WIDTH, HEIGHT);
Image profile = new Image(new TextureRegion(txt));
profile.setColor(type);
profile.setSize(crop.x * 0.07f, crop.y * 0.07f);
profile.setPosition(frame.getRight() - frame.getWidth() / 2 - profile.getWidth() / 2, frame.getY() + frame.getHeight() * 0.42f);
gr.addActor(profile);
Skin skin = new Skin();
skin.add("white", new TextureRegion(managerAssets.getAssetsCombat().getTexture(NameFiles.barLifeWhite), 0, 0, (int) (WIDTH * 0.014), (int) (WIDTH * 0.014)));
ProgressBar.ProgressBarStyle barStyle = new ProgressBar.ProgressBarStyle(skin.newDrawable("white", Color.WHITE), skin.newDrawable("white", type));
barStyle.knobBefore = barStyle.knob;
ProgressBar bar = new ProgressBar(0,energymax, 1, false, barStyle);
bar.setSize(WIDTH * 0.14f,HEIGHT * 0.012f);
bar.setPosition(frame.getX() + frame.getWidth() * 0.07f, frame.getY() + frame.getHeight() * 0.07f);
bar.setValue(energy);
gr.addActor(bar);
return gr;
}
示例14: drawoneDefenders
import com.badlogic.gdx.scenes.scene2d.ui.Skin; //導入方法依賴的package包/類
private Group drawoneDefenders(String typeFrame,String name,Color type,String photo,float energy,float energymax){
Group gr = new Group();
Texture txt = managerAssets.getAssetsCombat().getTexture(typeFrame);
Vector2 crop = Scaling.fit.apply(txt.getWidth(), txt.getHeight(), WIDTH, HEIGHT);
Image frame = new Image(new TextureRegion(txt));
frame.setName("frame");
frame.setSize(crop.x * 0.18f, crop.y * 0.2f);
frame.setPosition(WIDTH * 0.025f, HEIGHT / 2.3f);
gr.addActor(frame);
if(InformationProfile.getInstance().getDateUserGame().getFaction() == InformationEnklave.getInstance().getFaction())
txt = managerAssets.getAssetsCombat().getTexture(NameFiles.targetRecharge);
else
txt = managerAssets.getAssetsCombat().getTexture(NameFiles.target);
crop = Scaling.fit.apply(txt.getWidth(), txt.getHeight(), WIDTH, HEIGHT);
Image frameselect = new Image(new TextureRegion(txt));
frameselect.setName("frameselect");
frameselect.toFront();
frameselect.setSize(crop.x * 0.18f, crop.y * 0.2f);
frameselect.setPosition(WIDTH * 0.025f, HEIGHT / 2.3f);
frameselect.setVisible(false);
gr.addActor(frameselect);
Label labelName = new Label(name.substring(0,name.length()>9 ? 9 : name.length()),new Label.LabelStyle(bt,type));
labelName.setAlignment(Align.center);
labelName.setSize(WIDTH * 0.18f, HEIGHT * 0.02f);
labelName.setPosition(frame.getX(), frame.getY() + frame.getHeight() * 0.25f);
gr.addActor(labelName);
txt = managerAssets.getAssetsCombat().getTexture(photo);
crop = Scaling.fit.apply(txt.getWidth(), txt.getHeight(), WIDTH, HEIGHT);
Image profile = new Image(new TextureRegion(txt));
// profile.setColor(Color.BLUE);
profile.setSize(crop.x*0.07f, crop.y*0.07f);
profile.setPosition(frame.getRight() - frame.getWidth() / 2 - profile.getWidth() / 2, frame.getY() + frame.getHeight() * 0.42f);
gr.addActor(profile);
Skin skin = new Skin();
skin.add("white", new TextureRegion(managerAssets.getAssetsCombat().getTexture(NameFiles.barLifeWhite),0,0,(int)(WIDTH*0.004),(int)(WIDTH*0.014)));
ProgressBar.ProgressBarStyle barStyle = new ProgressBar.ProgressBarStyle(skin.newDrawable("white", Color.WHITE), skin.newDrawable("white",type));
barStyle.knobBefore = barStyle.knob;
ProgressBar bar = new ProgressBar(0, energymax, 1, false, barStyle);
bar.setSize(WIDTH * 0.14f, HEIGHT * 0.012f);
bar.setPosition(frame.getX()+frame.getWidth()*0.1f, frame.getY()+frame.getHeight()*0.07f);
bar.setValue(energy);
gr.addActor(bar);
return gr;
}
示例15: GameSetupScreen
import com.badlogic.gdx.scenes.scene2d.ui.Skin; //導入方法依賴的package包/類
GameSetupScreen(ParticleGame game) {
particle_game = game;
stage = new Stage();
table = new Table();
table.setDebug(true);
table.setFillParent(true);
stage.addActor(table);
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("font", game.getFont());
TextButton.TextButtonStyle text_button_style = new TextButton.TextButtonStyle();
final Color button_color = new Color(226 / 255f, 226 / 255f, 226 / 255f, 1f);
final Color hover_color = new Color(162 / 255f, 162 / 255f, 162 / 255f, 1f);
text_button_style.up = skin.newDrawable("white", button_color);
text_button_style.down = skin.newDrawable("white", button_color);
text_button_style.over = skin.newDrawable("white", hover_color);
text_button_style.font = skin.getFont("font");
skin.add("default", text_button_style);
TextButton create_game_button = new TextButton("create game!", skin);
create_game_button.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
final int num_boards = 10;
final PlayerCamera player_camera = new PlayerCamera(PARTICLE_BOARD_W, PARTICLE_BOARD_W,
PARTICLE_BOARD_W * num_boards
);
final DisplayManager display_manager = new DisplayManager(particle_game.getBatch(), player_camera);
final PropertyDictionary property_dictionary = new PropertyDictionary(10, 10, 10, 10);
final ParticleSystem particle_system = new ParticleSystem(PARTICLE_BOARD_W, num_boards);
final VelocitySystem velocity_system = new VelocitySystem(PARTICLE_BOARD_W / 9);
final WorldGenerator world_generator = new WorldGenerator(
11, 25, PARTICLE_BOARD_W * num_boards
);
particle_game.setCamera(player_camera);
particle_game.setDisplayManager(display_manager);
particle_game.setPropertyDictionary(property_dictionary);
particle_game.setParticleSystem(particle_system);
particle_game.setVelocitySystem(velocity_system);
world_generator.generate(property_dictionary, particle_system);
final Player player = new Player(particle_game, 0, 50);
particle_game.setPlayer(player);
particle_game.setScreen(particle_game.getGameScreen());
}
});
table.add(create_game_button);
}