Java Code Examples for com.badlogic.gdx.scenes.scene2d.ui.Skin#getDrawable()
The following examples show how to use
com.badlogic.gdx.scenes.scene2d.ui.Skin#getDrawable() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JoystickControl.java From TerraLegion with MIT License | 6 votes |
public JoystickControl(Texture background, Texture knob, float deadZoneRadius, float x, float y, float width, float height) { touchpadSkin = new Skin(); //Set background image touchpadSkin.add("touchBackground", background); //Set knob image touchpadSkin.add("touchKnob", knob); //Create TouchPad Style touchpadStyle = new TouchpadStyle(); //Apply the Drawables to the TouchPad Style touchpadStyle.background = touchpadSkin.getDrawable("touchBackground"); touchpadStyle.knob = touchpadSkin.getDrawable("touchKnob"); //Create new TouchPad with the created style touchpad = new Touchpad(deadZoneRadius, touchpadStyle); //setBounds(x,y,width,height) touchpad.setBounds(x, y, width, height); }
Example 2
Source File: PatchGrid.java From gdx-texture-packer-gui with Apache License 2.0 | 6 votes |
public PatchGrid(Skin skin, Color primaryColor, GridValues values) { this.primaryColor = new Color(primaryColor); this.values = values; setTouchable(Touchable.enabled); whiteDrawable = skin.getDrawable("white"); gridNodeDrawable = skin.getDrawable("custom/nine-patch-gird-node"); left = new PatchLine(whiteDrawable, primaryColor); right = new PatchLine(whiteDrawable, primaryColor); top = new PatchLine(whiteDrawable, primaryColor); bottom = new PatchLine(whiteDrawable, primaryColor); patchLines.addAll(left, right, top, bottom); addActor(left); addActor(right); addActor(top); addActor(bottom); lineDragListener = new LineDragListener(); addListener(lineDragListener); values.addListener(modelListener = new ModelChangeListener()); }
Example 3
Source File: LoadSaveScreen.java From bladecoder-adventure-engine with Apache License 2.0 | 5 votes |
/** * Creates a button to represent one slot * * @param slot * @return The button to use for one slot */ private Button getSlotButton(String slot) { final Skin skin = ui.getSkin(); final Button button = new Button(new ButtonStyle()); final ButtonStyle style = button.getStyle(); style.up = style.down = skin.getDrawable("black"); String textLabel = ui.getWorld().getI18N().getString("ui.newSlot"); button.setSize(slotWidth, slotHeight); if (slotExists(slot)) { button.add(getScreenshot(slot)).maxSize(slotWidth * .95f, slotHeight * .95f); try { long l = Long.parseLong(slot); Date d = new Date(l); textLabel = (new SimpleDateFormat()).format(d); } catch (Exception e) { textLabel = slot; } button.addListener(loadClickListener); } else { Image fg = new Image(skin.getDrawable("plus")); button.add(fg).maxSize(slotHeight / 2, slotHeight / 2); button.addListener(saveClickListener); } button.row(); Label label = new Label(textLabel, skin); label.setAlignment(Align.center); button.add(label).fillX(); button.setName(slot); return button; }
Example 4
Source File: ScenePointer.java From bladecoder-adventure-engine with Apache License 2.0 | 5 votes |
public ScenePointer(Skin skin, World w) { this.world = w; font = skin.getFont("desc"); pointerIcon = skin.getDrawable(POINTER_ICON); leaveIcon = skin.getDrawable(LEAVE_ICON); hotspotIcon = skin.getDrawable(HOTSPOT_ICON); reset(); }
Example 5
Source File: Pointer.java From bladecoder-adventure-engine with Apache License 2.0 | 5 votes |
public Pointer(Skin skin) { pointerIcon = skin.getDrawable(POINTER_ICON); setTouchable(Touchable.disabled); resize(); show(); }
Example 6
Source File: PixelGrid.java From gdx-texture-packer-gui with Apache License 2.0 | 4 votes |
public PixelGrid(Skin skin) { white = skin.getDrawable("white"); setTouchable(Touchable.disabled); }
Example 7
Source File: BorderAreaDim.java From gdx-texture-packer-gui with Apache License 2.0 | 4 votes |
public BorderAreaDim(Skin skin, Actor actor) { drawable = skin.getDrawable("white"); this.actor = actor; }
Example 8
Source File: onScreenControls.java From killingspree with MIT License | 4 votes |
public onScreenControls() { stage = new Stage(); skin = new Skin(); skin.add("buttonA", new Texture("controls/buttonA.png")); skin.add("buttonB", new Texture("controls/buttonB.png")); skin.add("buttonX", new Texture("controls/buttonX.png")); skin.add("buttonLeft", new Texture("controls/buttonLeft.png")); skin.add("buttonRight", new Texture("controls/buttonRight.png")); skin.add("buttonUp", new Texture("controls/buttonUp.png")); skin.add("closeButton", new Texture("controls/closeButton.png")); Drawable button; button = skin.getDrawable("buttonLeft"); leftButton = new Button(button); leftButton.setColor(leftButton.getColor().r, leftButton.getColor().g, leftButton.getColor().b, leftButton.getColor().a / 5); button = skin.getDrawable("buttonRight"); rightButton = new Button(button); rightButton.setColor(rightButton.getColor().r, rightButton.getColor().g, rightButton.getColor().b, rightButton.getColor().a / 5); button = skin.getDrawable("buttonUp"); upButton = new Button(button); upButton.setColor(upButton.getColor().r, upButton.getColor().g, upButton.getColor().b, upButton.getColor().a / 5); button = skin.getDrawable("buttonA"); jumpButton = new Button(button); jumpButton.setColor(jumpButton.getColor().r, jumpButton.getColor().g, jumpButton.getColor().b, jumpButton.getColor().a / 5); button = skin.getDrawable("buttonX"); shootButton = new Button(button); shootButton.setColor(shootButton.getColor().r, shootButton.getColor().g, shootButton.getColor().b, shootButton.getColor().a / 5); button = skin.getDrawable("buttonB"); throwBombButton = new Button(button); throwBombButton.setColor(throwBombButton.getColor().r, throwBombButton.getColor().g, throwBombButton.getColor().b, throwBombButton.getColor().a / 5); button = skin.getDrawable("closeButton"); closeButton = new Button(button); closeButton.setColor(closeButton.getColor().r, closeButton.getColor().g, closeButton.getColor().b, closeButton.getColor().a / 5); this.stage.addActor(jumpButton); this.stage.addActor(shootButton); this.stage.addActor(throwBombButton); this.stage.addActor(closeButton); this.stage.addActor(upButton); this.stage.addActor(rightButton); this.stage.addActor(leftButton); Gdx.input.setInputProcessor(stage); resize(); }
Example 9
Source File: ScnWidget.java From bladecoder-adventure-engine with Apache License 2.0 | 4 votes |
public ScnWidget(Skin skin) { bigFont = skin.get("big-font", BitmapFont.class); defaultFont = skin.get("default-font", BitmapFont.class); setSize(150, 150); tile = new TiledDrawable(Ctx.assetManager.getIcon("transparent-light")); background = skin.getDrawable("background"); faRenderer.setViewport(getWidth(), getHeight()); setLayoutEnabled(true); addListener(inputListner); Ctx.project.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent e) { EditorLogger.debug("ScnWidget Listener: " + e.getPropertyName()); if (e.getPropertyName().equals(Project.NOTIFY_SCENE_SELECTED)) { if (!projectLoadedFlag) setSelectedScene(Ctx.project.getSelectedScene()); } else if (e.getPropertyName().equals(Project.NOTIFY_ACTOR_SELECTED)) { if (!projectLoadedFlag) setSelectedActor(Ctx.project.getSelectedActor()); } else if (e.getPropertyName().equals(Project.NOTIFY_ANIM_SELECTED)) { if (!projectLoadedFlag && Ctx.project.getSelectedFA() != null) setSelectedFA(Ctx.project.getSelectedFA()); } else if (e.getPropertyName().equals(Project.NOTIFY_PROJECT_LOADED)) { projectLoadedFlag = true; } else if (e.getPropertyName().equals("scene")) { setSelectedScene(Ctx.project.getSelectedScene()); setSelectedActor(Ctx.project.getSelectedActor()); } else if (e.getPropertyName().equals("init_animation")) { if (!inScene) setSelectedFA(null); } } }); showSpriteBounds = Boolean .parseBoolean(Ctx.project.getEditorConfig().getProperty("view.showSpriteBounds", "true")); inScene = Boolean.parseBoolean(Ctx.project.getEditorConfig().getProperty("view.inScene", "false")); animation = Boolean.parseBoolean(Ctx.project.getEditorConfig().getProperty("view.animation", "true")); scnMoveIcon = Ctx.assetManager.getIcon("scn_move"); scnRotateIcon = Ctx.assetManager.getIcon("scn_rotate"); scnScaleLockIcon = Ctx.assetManager.getIcon("scn_scale_lock"); scnScaleIcon = Ctx.assetManager.getIcon("scn_scale"); }
Example 10
Source File: TextureDropWidget.java From talos with Apache License 2.0 | 3 votes |
public void init(TextureRegion region, Skin skin, float width) { Stack stack = new Stack(); image = new Image(region); Image border = new Image(skin.getDrawable("border")); stack.add(image); stack.add(border); add(stack).size(width); }