From d49398cf4ef7a18910267894a2cd4b8f8dd5483f Mon Sep 17 00:00:00 2001 From: fgnm Date: Thu, 15 Jul 2021 12:21:33 +0200 Subject: [PATCH] Avoid some garbage, improve resource boxes UI, cleanup --- CHANGES | 1 + .../editor/utils/KeyBindingsLayout.java | 8 +- .../editor/view/stage/ItemSelector.java | 1 - .../BoxItemResourceSelectionUIMediator.java | 2 - .../UIAnimationsTabMediator.java | 6 +- .../resourcespanel/UIImagesTabMediator.java | 4 +- .../draggable/box/BoxItemResource.java | 95 +++++++++++++------ .../draggable/box/ImageResource.java | 11 +-- .../draggable/box/SpineResource.java | 35 +++---- .../draggable/box/SpriteResource.java | 15 +-- .../dialog/AnimationsPackDialogMediator.java | 1 - .../ui/widget/actors/basic/PixelLine.java | 6 +- .../ui/widget/actors/basic/PixelRect.java | 21 ++-- 13 files changed, 114 insertions(+), 92 deletions(-) diff --git a/CHANGES b/CHANGES index 8f7064b0..a972ce3f 100644 --- a/CHANGES +++ b/CHANGES @@ -11,6 +11,7 @@ - Add Editor performance settings (MSAA, OpenGL 3) - Add multiple atlas packing settings - Add Import libGDX atlas format +- Improve `Resources` Panel UI/UX - Huge improvements to Tiled Plugin: * Sprite and Spine animated Tiles * UI improvements and general refactoring diff --git a/src/main/java/games/rednblack/editor/utils/KeyBindingsLayout.java b/src/main/java/games/rednblack/editor/utils/KeyBindingsLayout.java index f63e4f89..9e558727 100644 --- a/src/main/java/games/rednblack/editor/utils/KeyBindingsLayout.java +++ b/src/main/java/games/rednblack/editor/utils/KeyBindingsLayout.java @@ -93,10 +93,10 @@ public class KeyBindingsLayout { defaultMapper.put(RESET_CAMERA, new KeyMapper(RESET_CAMERA, true, false, false, Input.Keys.NUM_0, Input.Keys.NUMPAD_0)); - defaultMapper.put(ALIGN_TOP, new KeyMapper(ALIGN_TOP, true, false, false, Input.Keys.NUM_1)); - defaultMapper.put(ALIGN_LEFT, new KeyMapper(ALIGN_LEFT, true, false, false, Input.Keys.NUM_2)); - defaultMapper.put(ALIGN_BOTTOM, new KeyMapper(ALIGN_BOTTOM, true, false, false, Input.Keys.NUM_3)); - defaultMapper.put(ALIGN_RIGHT, new KeyMapper(ALIGN_RIGHT, true, false, false, Input.Keys.NUM_4)); + defaultMapper.put(ALIGN_TOP, new KeyMapper(ALIGN_TOP, true, false, false, Input.Keys.NUMPAD_8)); + defaultMapper.put(ALIGN_LEFT, new KeyMapper(ALIGN_LEFT, true, false, false, Input.Keys.NUMPAD_4)); + defaultMapper.put(ALIGN_BOTTOM, new KeyMapper(ALIGN_BOTTOM, true, false, false, Input.Keys.NUMPAD_2)); + defaultMapper.put(ALIGN_RIGHT, new KeyMapper(ALIGN_RIGHT, true, false, false, Input.Keys.NUMPAD_6)); defaultMapper.put(DELETE, new KeyMapper(DELETE, false, false, false, Input.Keys.DEL)); diff --git a/src/main/java/games/rednblack/editor/view/stage/ItemSelector.java b/src/main/java/games/rednblack/editor/view/stage/ItemSelector.java index 74b16c92..b5299334 100644 --- a/src/main/java/games/rednblack/editor/view/stage/ItemSelector.java +++ b/src/main/java/games/rednblack/editor/view/stage/ItemSelector.java @@ -140,7 +140,6 @@ public class ItemSelector { acc.carryVal = x; acc.carry = i; } - System.out.println("MaxFloat = " + Float.MAX_VALUE + " MinFloat = " + Float.MIN_VALUE); }; public BiConsumer leftmostItem = (i, acc) -> { diff --git a/src/main/java/games/rednblack/editor/view/ui/BoxItemResourceSelectionUIMediator.java b/src/main/java/games/rednblack/editor/view/ui/BoxItemResourceSelectionUIMediator.java index 344e4db6..7b7755e5 100644 --- a/src/main/java/games/rednblack/editor/view/ui/BoxItemResourceSelectionUIMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/BoxItemResourceSelectionUIMediator.java @@ -108,8 +108,6 @@ public class BoxItemResourceSelectionUIMediator extends Mediator constructor = resourceClass.getConstructor(String.class, Color.class, Color.class, Color.class, Color.class, boolean.class); - DraggableResource draggableResource = new DraggableResource(constructor.newInstance(animationName, new Color(1, 1, 1, 0.2f), new Color(1, 1, 1, 0.4f), - new Color(200f / 255f, 200f / 255f, 200f / 255f, 0.2f), new Color(255f / 255f, 94f / 255f, 0f / 255f, 1f), true)); + Constructor constructor = resourceClass.getConstructor(String.class, boolean.class); + DraggableResource draggableResource = new DraggableResource(constructor.newInstance(animationName, true)); draggableResource.initDragDrop(); draggableResource.setFactoryFunction(factoryFunction); animationBoxes.add(draggableResource); diff --git a/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/UIImagesTabMediator.java b/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/UIImagesTabMediator.java index 46480376..3d66f1f5 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/UIImagesTabMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/UIImagesTabMediator.java @@ -21,7 +21,6 @@ package games.rednblack.editor.view.ui.box.resourcespanel; import org.apache.commons.lang3.ArrayUtils; import org.puremvc.java.interfaces.INotification; -import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.g2d.TextureAtlas; import com.badlogic.gdx.utils.Array; @@ -84,8 +83,7 @@ public class UIImagesTabMediator extends UIResourcesTabMediator { || !region.name.contains(searchText)) continue; boolean is9patch = region.findValue("split") != null; - ImageResource imageResource = new ImageResource(region, new Color(1, 1, 1, 0.2f), new Color(1, 1, 1, 0.4f), - new Color(200f / 255f, 200f / 255f, 200f / 255f, 0.2f), new Color(255f / 255f, 94f / 255f, 0f / 255f, 1f), true); + ImageResource imageResource = new ImageResource(region, true); DraggableResource draggableResource = new DraggableResource(imageResource); if (is9patch) { draggableResource.setFactoryFunction(ItemFactory.get()::create9Patch); diff --git a/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/draggable/box/BoxItemResource.java b/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/draggable/box/BoxItemResource.java index 36190369..04067825 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/draggable/box/BoxItemResource.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/draggable/box/BoxItemResource.java @@ -44,50 +44,55 @@ public abstract class BoxItemResource extends Group implements DraggableResource /** * The color to fill the background of the image. Also the color of the background when the mouse is not over the image. */ - private final Color fillColor; + private final Color fillColor = new Color(1, 1, 1, 0.2f); /** * The standard color of the border. Also the color of the border when the mouse is not over the image. */ - private final Color borderColor; + private final Color borderColor = new Color(1, 1, 1, 0.4f); /** * The color of the border when the mouse hovers over the image. */ - private final Color borderMouseOverColor; + private final Color borderMouseOverColor = new Color(1f, 94f / 255f, 0f / 255f, 1f); /** * The color to fill the background of the image when the mouse hovers over the image. */ - private final Color fillMouseOverColor; + private final Color fillMouseOverColor = new Color(200f / 255f, 200f / 255f, 200f / 255f, 0.2f); /** * Whether to change the border color when the mouse hovers over the image. + * Only used if the the parameter highlightWhenMouseOver is set to true. */ private boolean highlightWhenMouseOver; - + + /** + * The standard thickness of the border. Also the thickness of the border when the mouse is not over the image. + */ + private float borderThickness = 1f; + /** + * The thickness of the border when the mouse hovers the image. + */ + private float borderMouseOverThickness = 2f; + public BoxItemResource() { - this(new Color(1, 1, 1, 0.2f), new Color(1, 1, 1, 0.4f), Color.BLACK, Color.BLACK, false); + this(false); } /** * Creates a new box item resource with the given colors. * - * @param fillColor The color to fill the background of the image. - * @param borderColor The standard color of the border. Also used when the mouse is not hovering over the image. - * @param fillMouseOverColor The color to fill the background of the image when the mouse hovers over the image. Only used if the the parameter highlightWhenMouseOver is set to true. - * @param borderMouseOverColor The color of the border when the mouse hovers over the image. Only used if the the parameter highlightWhenMouseOver is set to true. * @param highlightWhenMouseOver Whether to change the border color when the mouse hovers over the image. */ - public BoxItemResource(Color fillColor, Color borderColor, Color fillMouseOverColor, Color borderMouseOverColor, boolean highlightWhenMouseOver) { + public BoxItemResource(boolean highlightWhenMouseOver) { sandbox = Sandbox.getInstance(); rc = new PixelRect(thumbnailSize, thumbnailSize); rc.setFillColor(fillColor); rc.setBorderColor(borderColor); + rc.setThickness(borderThickness); addActor(rc); setWidth(thumbnailSize); setHeight(thumbnailSize); - - this.fillColor = fillColor; - this.borderColor = borderColor; - this.fillMouseOverColor = fillMouseOverColor; - this.borderMouseOverColor = borderMouseOverColor; + + thumbnailSize -= Math.max(borderThickness, borderMouseOverThickness); + this.highlightWhenMouseOver = highlightWhenMouseOver; } @@ -161,8 +166,7 @@ public abstract class BoxItemResource extends Group implements DraggableResource isOver = false; // check if we have to revert the color if (highlightWhenMouseOver) { - rc.setFillColor(fillColor); - rc.setBorderColor(borderColor); + switchToStandardColor(); } } }); @@ -173,17 +177,54 @@ public abstract class BoxItemResource extends Group implements DraggableResource } public void switchToMouseOverColor() { - if (fillMouseOverColor != null && borderMouseOverColor != null) { - rc.setFillColor(fillMouseOverColor); - rc.setBorderColor(borderMouseOverColor); - } + rc.setFillColor(fillMouseOverColor); + rc.setBorderColor(borderMouseOverColor); + rc.setThickness(borderMouseOverThickness); } public void switchToStandardColor() { - if (fillColor != null && borderColor != null) { - rc.setFillColor(fillColor); - rc.setBorderColor(borderColor); - } + rc.setFillColor(fillColor); + rc.setBorderColor(borderColor); + rc.setThickness(borderThickness); + } + + public void setFillColor(Color color) { + fillColor.set(color); + } + + public void setFillColor(float r, float g, float b, float a) { + fillColor.set(r, g, b, a); + } + + public void setBorderColor(Color color) { + borderColor.set(color); + } + + public void setBorderColorColor(float r, float g, float b, float a) { + borderColor.set(r, g, b, a); + } + + public void setHighlightFillColor(Color color) { + fillMouseOverColor.set(color); + } + + public void setHighlightFillColor(float r, float g, float b, float a) { + fillMouseOverColor.set(r, g, b, a); + } + + public void setHighlightBorderColor(Color color) { + borderMouseOverColor.set(color); + } + + public void setHighlightBorderColorColor(float r, float g, float b, float a) { + borderMouseOverColor.set(r, g, b, a); + } + + public void setBorderThickness(float borderThickness) { + this.borderThickness = borderThickness; + } + + public void setHighlightBorderThickness(float borderThickness) { + this.borderMouseOverThickness = borderThickness; } - } diff --git a/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/draggable/box/ImageResource.java b/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/draggable/box/ImageResource.java index 4f2852c0..6ff09976 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/draggable/box/ImageResource.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/draggable/box/ImageResource.java @@ -18,7 +18,6 @@ package games.rednblack.editor.view.ui.box.resourcespanel.draggable.box; -import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.g2d.TextureAtlas.AtlasRegion; import com.badlogic.gdx.scenes.scene2d.Actor; import com.badlogic.gdx.scenes.scene2d.ui.Image; @@ -33,21 +32,17 @@ public class ImageResource extends BoxItemResource { public ImageResource(AtlasRegion region) { // this is not changing the behavior of the former constructor // as long as the colors of the super class are not changed - this(region, new Color(1, 1, 1, 0.2f), new Color(1, 1, 1, 0.4f), Color.BLACK, Color.BLACK, false); + this(region, false); } /** * Creates a new image resource from the given {@link AtlasRegion}. * * @param region The atlas region for the image resource. - * @param fillColor The color to fill the background of the image. - * @param borderColor The standard color of the border. Also used when the mouse is not hovering over the image. - * @param fillMouseOverColor The color to fill the background of the image when the mouse hovers over the image. Only used if the the parameter highlightWhenMouseOver is set to true. - * @param borderMouseOverColor The color of the border when the mouse hovers over the image. Only used if the the parameter highlightWhenMouseOver is set to true. * @param highlightWhenMouseOver Whether to change the border color when the mouse hovers over the image. */ - public ImageResource(AtlasRegion region, Color fillColor, Color borderColor, Color fillMouseOverColor, Color borderMouseOverColor, boolean highlightWhenMouseOver) { - super(fillColor, borderColor, fillMouseOverColor, borderMouseOverColor, highlightWhenMouseOver); + public ImageResource(AtlasRegion region, boolean highlightWhenMouseOver) { + super(highlightWhenMouseOver); Image img = new Image(region); if (img.getWidth() > thumbnailSize || img.getHeight() > thumbnailSize) { diff --git a/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/draggable/box/SpineResource.java b/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/draggable/box/SpineResource.java index 2dfdb43e..9ab50f53 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/draggable/box/SpineResource.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/draggable/box/SpineResource.java @@ -19,7 +19,6 @@ package games.rednblack.editor.view.ui.box.resourcespanel.draggable.box; import com.badlogic.gdx.Gdx; -import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.scenes.scene2d.Actor; import com.badlogic.gdx.scenes.scene2d.InputEvent; import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; @@ -35,32 +34,29 @@ import games.rednblack.h2d.common.ResourcePayloadObject; public class SpineResource extends BoxItemResource { private final SpineActor payloadActor; + private final SpineActor animThumb; private final ResourcePayloadObject payload; private boolean isMouseInside = false; public SpineResource(String animationName) { - // this is not changing the behavior of the former constructor - // as long as the colors of the super class are not changed - this(animationName, new Color(1, 1, 1, 0.2f), new Color(1, 1, 1, 0.4f), Color.BLACK, Color.BLACK, false); + // this is not changing the behavior of the former constructor + // as long as the colors of the super class are not changed + this(animationName, false); } /** * Creates a new spine resource from the given animation name. - * - * @param animationName The of the animation for the spine resource. - * @param fillColor The color to fill the background of the image. - * @param borderColor The standard color of the border. Also used when the mouse is not hovering over the image. - * @param fillMouseOverColor The color to fill the background of the image when the mouse hovers over the image. Only used if the the parameter highlightWhenMouseOver is set to true. - * @param borderMouseOverColor The color of the border when the mouse hovers over the image. Only used if the the parameter highlightWhenMouseOver is set to true. + * + * @param animationName The of the animation for the spine resource. * @param highlightWhenMouseOver Whether to change the border color when the mouse hovers over the image. */ - public SpineResource(String animationName, Color fillColor, Color borderColor, Color fillMouseOverColor, Color borderMouseOverColor, boolean highlightWhenMouseOver) { - super(fillColor, borderColor, fillMouseOverColor, borderMouseOverColor, highlightWhenMouseOver); + public SpineResource(String animationName, boolean highlightWhenMouseOver) { + super(highlightWhenMouseOver); SpineVO vo = new SpineVO(); vo.animationName = animationName; - final SpineActor animThumb = new SpineActor(animationName, sandbox.getSceneControl().sceneLoader.getRm()); + animThumb = new SpineActor(animationName, sandbox.getSceneControl().sceneLoader.getRm()); if (animThumb.getWidth() > thumbnailSize || animThumb.getHeight() > thumbnailSize) { // resizing is needed @@ -82,16 +78,17 @@ public class SpineResource extends BoxItemResource { } animThumb.setAnimation(animThumb.skeletonData.getAnimations().get(0).getName()); + animThumb.getState().setTimeScale(0); addListener(new ClickListener() { @Override - public void enter(InputEvent event, float x, float y, int pointer, Actor fromActor) { + public void enter(InputEvent event, float x, float y, int pointer, Actor fromActor) { isMouseInside = true; super.enter(event, x, y, pointer, fromActor); } @Override - public void exit(InputEvent event, float x, float y, int pointer, Actor toActor) { + public void exit(InputEvent event, float x, float y, int pointer, Actor toActor) { isMouseInside = false; super.enter(event, x, y, pointer, toActor); } @@ -100,14 +97,11 @@ public class SpineResource extends BoxItemResource { addActor(animThumb); - //payloadImg = new Image(VisUI.getSkin().getDrawable("icon-animation")); payloadActor = new SpineActor(animationName, sandbox.getSceneControl().sceneLoader.getRm()); payload = new ResourcePayloadObject(); payload.name = animationName; payload.className = getClass().getName(); - setWidth(thumbnailSize); - setHeight(thumbnailSize); super.act(1f); super.act(Gdx.graphics.getDeltaTime()); @@ -117,9 +111,8 @@ public class SpineResource extends BoxItemResource { @Override public void act(float delta) { - if (isMouseInside) { - super.act(delta); - } + super.act(delta); + animThumb.getState().setTimeScale(isMouseInside ? 1f : 0f); } @Override diff --git a/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/draggable/box/SpriteResource.java b/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/draggable/box/SpriteResource.java index 210b3785..4ee5ceb7 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/draggable/box/SpriteResource.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/draggable/box/SpriteResource.java @@ -18,7 +18,6 @@ package games.rednblack.editor.view.ui.box.resourcespanel.draggable.box; -import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.scenes.scene2d.Actor; import com.badlogic.gdx.scenes.scene2d.InputEvent; import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; @@ -33,32 +32,25 @@ import games.rednblack.h2d.common.ResourcePayloadObject; * Created by azakhary on 7/3/2014. */ public class SpriteResource extends BoxItemResource { - - private final SpriteAnimationActor payloadActor; private ResourcePayloadObject payload; - private boolean isMouseInside = false; public SpriteResource(String animationName) { // this is not changing the behavior of the former constructor // as long as the colors of the super class are not changed - this(animationName, new Color(1, 1, 1, 0.2f), new Color(1, 1, 1, 0.4f), Color.BLACK, Color.BLACK, false); + this(animationName, false); } /** * Creates a new sprite resource from the given animation name. * * @param animationName The of the animation for the sprite resource. - * @param fillColor The color to fill the background of the image. - * @param borderColor The standard color of the border. Also used when the mouse is not hovering over the image. - * @param fillMouseOverColor The color to fill the background of the image when the mouse hovers over the image. Only used if the the parameter highlightWhenMouseOver is set to true. - * @param borderMouseOverColor The color of the border when the mouse hovers over the image. Only used if the the parameter highlightWhenMouseOver is set to true. * @param highlightWhenMouseOver Whether to change the border color when the mouse hovers over the image. */ - public SpriteResource(String animationName, Color fillColor, Color borderColor, Color fillMouseOverColor, Color borderMouseOverColor, boolean highlightWhenMouseOver) { - super(fillColor, borderColor, fillMouseOverColor, borderMouseOverColor, highlightWhenMouseOver); + public SpriteResource(String animationName, boolean highlightWhenMouseOver) { + super(highlightWhenMouseOver); SpriteAnimationVO vo = new SpriteAnimationVO(); vo.animationName = animationName; @@ -106,7 +98,6 @@ public class SpriteResource extends BoxItemResource { payload.name = animationName; payload.className = getClass().getName(); - setHeight(thumbnailSize); setRightClickEvent(UIResourcesBoxMediator.SPRITE_ANIMATION_RIGHT_CLICK, payload.name); } diff --git a/src/main/java/games/rednblack/editor/view/ui/dialog/AnimationsPackDialogMediator.java b/src/main/java/games/rednblack/editor/view/ui/dialog/AnimationsPackDialogMediator.java index 4d022dab..388298ae 100644 --- a/src/main/java/games/rednblack/editor/view/ui/dialog/AnimationsPackDialogMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/dialog/AnimationsPackDialogMediator.java @@ -81,7 +81,6 @@ public class AnimationsPackDialogMediator extends Mediator { break; case UPDATE_CURRENT_LIST: currentTab = viewComponent.getSelectedTab(); - System.out.println(currentTab); if (currentTab != null) viewComponent.updateCurrentPack(projectManager.currentProjectInfoVO.animationsPacks.get(currentTab).regions); break; diff --git a/src/main/java/games/rednblack/editor/view/ui/widget/actors/basic/PixelLine.java b/src/main/java/games/rednblack/editor/view/ui/widget/actors/basic/PixelLine.java index d70563cb..52ed7616 100644 --- a/src/main/java/games/rednblack/editor/view/ui/widget/actors/basic/PixelLine.java +++ b/src/main/java/games/rednblack/editor/view/ui/widget/actors/basic/PixelLine.java @@ -65,6 +65,10 @@ public class PixelLine extends Image { public void setThickness (float thickness) { this.thickness = thickness; + this.setScaleY(thickness); } - + + public float getThickness() { + return thickness; + } } diff --git a/src/main/java/games/rednblack/editor/view/ui/widget/actors/basic/PixelRect.java b/src/main/java/games/rednblack/editor/view/ui/widget/actors/basic/PixelRect.java index 9ff0ad22..ac65f037 100644 --- a/src/main/java/games/rednblack/editor/view/ui/widget/actors/basic/PixelRect.java +++ b/src/main/java/games/rednblack/editor/view/ui/widget/actors/basic/PixelRect.java @@ -31,6 +31,7 @@ public class PixelRect extends Group { private final HyperLap2DFacade facade; private final PixelLine[] lines = new PixelLine[4]; private final Image fill; + private final Rectangle rectangle = new Rectangle(); public PixelRect() { this(0, 0); @@ -40,8 +41,10 @@ public class PixelRect extends Group { facade = HyperLap2DFacade.getInstance(); lines[0] = new PixelLine(0, 0, width, 0); lines[1] = new PixelLine(0, 0, 0, height); + lines[1].setPosition(lines[1].getThickness(), 0, lines[1].getThickness(), height - lines[1].getThickness()); lines[2] = new PixelLine(width, 0, width, height); lines[3] = new PixelLine(0, height, width, height); + lines[3].setPosition(0, height - lines[3].getThickness(), width, height - lines[3].getThickness()); fill = new Image(WhitePixel.sharedInstance.texture); fill.setColor(new Color(0, 0, 0, 0)); @@ -109,16 +112,18 @@ public class PixelRect extends Group { height = -height; y = y - height; } - Rectangle r = new Rectangle(x, y, width, height); - return r; + return rectangle.set(x, y, width, height); } - public void setThickness(float thickness) { - lines[0].setThickness(thickness); - lines[1].setThickness(thickness); - lines[2].setThickness(thickness); - lines[3].setThickness(thickness); - } + public void setThickness(float thickness) { + lines[0].setThickness(thickness); + lines[1].setThickness(thickness); + lines[1].setPosition(lines[1].getThickness(), 0, lines[1].getThickness(), getHeight() - lines[1].getThickness()); + lines[2].setThickness(thickness); + lines[3].setThickness(thickness); + + lines[3].setPosition(0, getHeight() - lines[3].getThickness(), getWidth(), getHeight() - lines[3].getThickness()); + } }