Avoid some garbage, improve resource boxes UI, cleanup
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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));
|
||||
|
||||
|
||||
@@ -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<Entity, AccContainer> leftmostItem = (i, acc) -> {
|
||||
|
||||
@@ -108,8 +108,6 @@ public class BoxItemResourceSelectionUIMediator extends Mediator<BoxItemResource
|
||||
case UIResourcesBoxMediator.SANDBOX_DRAG_IMAGE_EXIT:
|
||||
setColorExcept(new Color(0f, 0f, 0f, 1f), null);
|
||||
break;
|
||||
default:
|
||||
System.err.println("Unknown notification: " + notification);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-4
@@ -26,7 +26,6 @@ import java.util.function.BiFunction;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.puremvc.java.interfaces.INotification;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
|
||||
@@ -93,9 +92,8 @@ public class UIAnimationsTabMediator extends UIResourcesTabMediator<UIAnimations
|
||||
for (String animationName : strings) {
|
||||
if (!animationName.contains(searchText)) continue;
|
||||
try {
|
||||
Constructor<? extends BoxItemResource> 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<? extends BoxItemResource> constructor = resourceClass.getConstructor(String.class, boolean.class);
|
||||
DraggableResource draggableResource = new DraggableResource(constructor.newInstance(animationName, true));
|
||||
draggableResource.initDragDrop();
|
||||
draggableResource.setFactoryFunction(factoryFunction);
|
||||
animationBoxes.add(draggableResource);
|
||||
|
||||
+1
-3
@@ -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<UIImagesTab> {
|
||||
|| !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);
|
||||
|
||||
+68
-27
@@ -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 <code>highlightWhenMouseOver</code> is set to <code>true</code>.
|
||||
*/
|
||||
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 <code>highlightWhenMouseOver</code> is set to <code>true</code>.
|
||||
* @param borderMouseOverColor The color of the border when the mouse hovers over the image. Only used if the the parameter <code>highlightWhenMouseOver</code> is set to <code>true</code>.
|
||||
* @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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+3
-8
@@ -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 <code>highlightWhenMouseOver</code> is set to <code>true</code>.
|
||||
* @param borderMouseOverColor The color of the border when the mouse hovers over the image. Only used if the the parameter <code>highlightWhenMouseOver</code> is set to <code>true</code>.
|
||||
* @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) {
|
||||
|
||||
+14
-21
@@ -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 <code>highlightWhenMouseOver</code> is set to <code>true</code>.
|
||||
* @param borderMouseOverColor The color of the border when the mouse hovers over the image. Only used if the the parameter <code>highlightWhenMouseOver</code> is set to <code>true</code>.
|
||||
*
|
||||
* @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
|
||||
|
||||
+3
-12
@@ -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 <code>highlightWhenMouseOver</code> is set to <code>true</code>.
|
||||
* @param borderMouseOverColor The color of the border when the mouse hovers over the image. Only used if the the parameter <code>highlightWhenMouseOver</code> is set to <code>true</code>.
|
||||
* @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);
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +81,6 @@ public class AnimationsPackDialogMediator extends Mediator<AtlasesPackDialog> {
|
||||
break;
|
||||
case UPDATE_CURRENT_LIST:
|
||||
currentTab = viewComponent.getSelectedTab();
|
||||
System.out.println(currentTab);
|
||||
if (currentTab != null)
|
||||
viewComponent.updateCurrentPack(projectManager.currentProjectInfoVO.animationsPacks.get(currentTab).regions);
|
||||
break;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user