v3.0.0: added a new 'heavy' transparent toast chrome

used for tooltips, inventory pane, and right click menus
This commit is contained in:
Evan Debenham
2024-11-13 15:11:32 -05:00
parent d867563d1e
commit c01760a394
5 changed files with 8 additions and 10 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

@@ -28,6 +28,7 @@ public class Chrome {
public enum Type { public enum Type {
TOAST, TOAST,
TOAST_TR, TOAST_TR,
TOAST_TR_HEAVY,
TOAST_WHITE, TOAST_WHITE,
WINDOW, WINDOW,
WINDOW_SILVER, WINDOW_SILVER,
@@ -55,6 +56,8 @@ public class Chrome {
case TOAST_TR: case TOAST_TR:
case GREY_BUTTON_TR: case GREY_BUTTON_TR:
return new NinePatch( Asset, 20, 9, 9, 9, 4 ); return new NinePatch( Asset, 20, 9, 9, 9, 4 );
case TOAST_TR_HEAVY:
return new NinePatch( Asset, 29, 9, 9, 9, 4 );
case TOAST_WHITE: case TOAST_WHITE:
return new NinePatch( Asset, 29, 0, 9, 9, 4 ); return new NinePatch( Asset, 29, 0, 9, 9, 4 );
case RED_BUTTON: case RED_BUTTON:
@@ -114,12 +114,9 @@ public class InventoryPane extends Component {
@Override @Override
protected void createChildren() { protected void createChildren() {
bg = Chrome.get(Chrome.Type.TOAST_TR); bg = Chrome.get(Chrome.Type.TOAST_TR_HEAVY);
add(bg); add(bg);
bg2 = Chrome.get(Chrome.Type.TOAST_TR);
add(bg2);
blocker = new PointerArea(0, 0, PixelScene.uiCamera.width, PixelScene.uiCamera.height){ blocker = new PointerArea(0, 0, PixelScene.uiCamera.width, PixelScene.uiCamera.height){
@Override @Override
protected void onClick(PointerEvent event) { protected void onClick(PointerEvent event) {
@@ -211,10 +208,9 @@ public class InventoryPane extends Component {
width = WIDTH; width = WIDTH;
height = HEIGHT; height = HEIGHT;
bg.x = bg2.x = x; bg.x = x;
bg.y = bg2.y = y; bg.y = y;
bg.size(width, height); bg.size(width, height);
bg2.size(width, height);
float left = x+4; float left = x+4;
for (InventorySlot i : equipped){ for (InventorySlot i : equipped){
@@ -264,7 +260,6 @@ public class InventoryPane extends Component {
public void alpha( float value ){ public void alpha( float value ){
bg.alpha( value ); bg.alpha( value );
bg2.alpha( value );
for (InventorySlot slot : equipped){ for (InventorySlot slot : equipped){
slot.alpha( value ); slot.alpha( value );
@@ -64,7 +64,7 @@ public class RightClickMenu extends Component {
} }
private void setup(Image icon, String title, String... options){ private void setup(Image icon, String title, String... options){
bg = Chrome.get(Chrome.Type.TOAST_TR); bg = Chrome.get(Chrome.Type.TOAST_TR_HEAVY);
add(bg); add(bg);
this.icon = icon; this.icon = icon;
@@ -73,7 +73,7 @@ public class Tooltip extends Component {
protected void createChildren() { protected void createChildren() {
super.createChildren(); super.createChildren();
bg = Chrome.get(Chrome.Type.TOAST_TR); bg = Chrome.get(Chrome.Type.TOAST_TR_HEAVY);
add(bg); add(bg);
text = PixelScene.renderTextBlock(6); text = PixelScene.renderTextBlock(6);