From 2ba65427287cffccf806169b5379b6ea8e053bab Mon Sep 17 00:00:00 2001 From: Collin Smith Date: Sat, 16 Feb 2019 14:19:03 -0800 Subject: [PATCH] Refactored modal color names Refactored modal colors to say what transparency they are Added modal background to EscapePanel --- core/src/gdx/diablo/Colors.java | 30 +++++++++++----------- core/src/gdx/diablo/entity/Monster.java | 11 ++++++-- core/src/gdx/diablo/panel/EscapePanel.java | 4 ++- core/src/gdx/diablo/screen/GameScreen.java | 4 ++- 4 files changed, 30 insertions(+), 19 deletions(-) diff --git a/core/src/gdx/diablo/Colors.java b/core/src/gdx/diablo/Colors.java index 45437d35..d92b7ed7 100644 --- a/core/src/gdx/diablo/Colors.java +++ b/core/src/gdx/diablo/Colors.java @@ -18,21 +18,21 @@ public class Colors { public static final Color PURPLE = new Color(0xAE00FFFF); // 11 #AE00FF public static final Color C12 = new Color(0x00C800FF); // 12 #00C800 - public Color white = WHITE.cpy(); - public Color server = SERVER.cpy(); - public Color set = SET.cpy(); - public Color magic = MAGIC.cpy(); - public Color unique = UNIQUE.cpy(); - public Color grey = GREY.cpy(); - public Color black = BLACK.cpy(); - public Color c7 = C7.cpy(); - public Color craft = CRAFT.cpy(); - public Color rare = RARE.cpy(); - public Color c10 = C10.cpy(); - public Color purple = PURPLE.cpy(); - public Color c12 = C12.cpy(); - public Color modal = black.cpy().sub(0, 0, 0, 0.5f); - public Color modal2 = black.cpy().sub(0, 0, 0, 0.25f); + public Color white = WHITE.cpy(); + public Color server = SERVER.cpy(); + public Color set = SET.cpy(); + public Color magic = MAGIC.cpy(); + public Color unique = UNIQUE.cpy(); + public Color grey = GREY.cpy(); + public Color black = BLACK.cpy(); + public Color c7 = C7.cpy(); + public Color craft = CRAFT.cpy(); + public Color rare = RARE.cpy(); + public Color c10 = C10.cpy(); + public Color purple = PURPLE.cpy(); + public Color c12 = C12.cpy(); + public Color modal50 = new Color(0, 0, 0, 0.50f); + public Color modal75 = new Color(0, 0, 0, 0.75f); public Colors() {} diff --git a/core/src/gdx/diablo/entity/Monster.java b/core/src/gdx/diablo/entity/Monster.java index 4d562170..59ccadd7 100644 --- a/core/src/gdx/diablo/entity/Monster.java +++ b/core/src/gdx/diablo/entity/Monster.java @@ -4,6 +4,7 @@ import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.glutils.ShapeRenderer; import com.badlogic.gdx.math.MathUtils; +import com.badlogic.gdx.math.Vector3; import com.badlogic.gdx.utils.Align; import org.apache.commons.lang3.StringUtils; @@ -43,7 +44,7 @@ public class Monster extends Entity { } label = new Label(monstats.NameStr, Diablo.fonts.font16); - label.getStyle().background = new PaletteIndexedColorDrawable(Diablo.colors.modal2) {{ + label.getStyle().background = new PaletteIndexedColorDrawable(Diablo.colors.modal75) {{ final float padding = 3; setLeftWidth(padding); setTopHeight(padding); @@ -113,10 +114,16 @@ public class Monster extends Entity { //BitmapFont font = Diablo.fonts.font16; //GlyphLayout glyphs = new GlyphLayout(font, "Test", font.getColor(), 0, Align.center, false); - //batch.setBlendMode(BlendMode.SOLID, Diablo.colors.modal); + //batch.setBlendMode(BlendMode.SOLID, Diablo.colors.modal50); //batch.draw(Diablo.textures.white, x - glyphs.width / 2, y + animation.getMinHeight(), glyphs.width, glyphs.height); //batch.resetBlendMode(); //font.draw(batch, glyphs, x, y + animation.getMinHeight() + font.getLineHeight()); } + + @Override + public boolean contains(Vector3 coords) { + if (!monstats2.isSel) return false; + return super.contains(coords); + } } diff --git a/core/src/gdx/diablo/panel/EscapePanel.java b/core/src/gdx/diablo/panel/EscapePanel.java index efb52eff..2e5a3ca1 100644 --- a/core/src/gdx/diablo/panel/EscapePanel.java +++ b/core/src/gdx/diablo/panel/EscapePanel.java @@ -18,6 +18,7 @@ import com.badlogic.gdx.utils.Disposable; import gdx.diablo.Diablo; import gdx.diablo.codec.Animation; import gdx.diablo.codec.DC6; +import gdx.diablo.graphics.PaletteIndexedColorDrawable; import gdx.diablo.loader.DC6Loader; import gdx.diablo.screen.MenuScreen; @@ -109,12 +110,13 @@ public class EscapePanel extends WidgetGroup implements Disposable { table.add(focusActor[5]).row(); table.setFillParent(true); + table.setBackground(new PaletteIndexedColorDrawable(Diablo.colors.modal50)); addActor(table); setFillParent(true); setVisible(false); setTouchable(Touchable.childrenOnly); - //setDebug(true, true); + setDebug(true, true); } @Override diff --git a/core/src/gdx/diablo/screen/GameScreen.java b/core/src/gdx/diablo/screen/GameScreen.java index 0575bbda..6cb21532 100644 --- a/core/src/gdx/diablo/screen/GameScreen.java +++ b/core/src/gdx/diablo/screen/GameScreen.java @@ -121,7 +121,7 @@ public class GameScreen extends ScreenAdapter implements LoadingScreen.Loadable input = new TextArea("", new TextArea.TextFieldStyle() {{ this.font = Diablo.fonts.fontformal12; this.fontColor = Diablo.colors.white; - this.background = new PaletteIndexedColorDrawable(Diablo.colors.modal); + this.background = new PaletteIndexedColorDrawable(Diablo.colors.modal50); this.cursor = new TextureRegionDrawable(Diablo.textures.white); float padding = 4; @@ -380,6 +380,8 @@ public class GameScreen extends ScreenAdapter implements LoadingScreen.Loadable PaletteIndexedBatch b = Diablo.batch; b.setPalette(Diablo.palettes.act1); + mapRenderer.hit(); + b.setProjectionMatrix(camera.combined); b.begin(); //map.draw(b, 0, 0, 30, 13, Diablo.VIRTUAL_WIDTH, Diablo.VIRTUAL_HEIGHT, 1.5f);