diff --git a/forge-m-base/src/forge/Forge.java b/forge-m-base/src/forge/Forge.java index 9a6bb5cdfa7..6e5c32ed83d 100644 --- a/forge-m-base/src/forge/Forge.java +++ b/forge-m-base/src/forge/Forge.java @@ -108,7 +108,7 @@ public class Forge implements ApplicationListener { @Override public void render () { - Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); // Clear the screen. + Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); // Clear the screen. FContainer screen = currentScreen; if (screen == null) { @@ -309,12 +309,19 @@ public class Forge implements ApplicationListener { if (color.a != 0) { //enable blending so alpha colored shapes work properly Gdx.gl.glEnable(GL20.GL_BLEND); } + boolean needSmoothing = (x1 != x2 && y1 != y2); + if (needSmoothing) { + Gdx.gl.glEnable(GL10.GL_LINE_SMOOTH); + } shapeRenderer.begin(ShapeType.Line); shapeRenderer.setColor(color); shapeRenderer.line(adjustX(x1), adjustY(y1, 0), adjustX(x2), adjustY(y2, 0)); shapeRenderer.end(); + if (needSmoothing) { + Gdx.gl.glDisable(GL10.GL_LINE_SMOOTH); + } if (color.a != 0) { Gdx.gl.glDisable(GL20.GL_BLEND); } @@ -337,6 +344,9 @@ public class Forge implements ApplicationListener { if (color.a != 0) { //enable blending so alpha colored shapes work properly Gdx.gl.glEnable(GL20.GL_BLEND); } + if (cornerRadius > 0) { + Gdx.gl.glEnable(GL10.GL_LINE_SMOOTH); + } //adjust width/height so rectangle covers equivalent filled area w = Math.round(w - 1); @@ -357,6 +367,9 @@ public class Forge implements ApplicationListener { shapeRenderer.end(); + if (cornerRadius > 0) { + Gdx.gl.glDisable(GL10.GL_LINE_SMOOTH); + } if (color.a != 0) { Gdx.gl.glDisable(GL20.GL_BLEND); } @@ -431,6 +444,58 @@ public class Forge implements ApplicationListener { batch.begin(); } + public void drawCircle(float thickness, FSkinColor skinColor, float x, float y, float radius) { + drawCircle(thickness, skinColor.getColor(), x, y, radius); + } + public void drawCircle(float thickness, Color color, float x, float y, float radius) { + batch.end(); //must pause batch while rendering shapes + + if (thickness > 1) { + Gdx.gl.glLineWidth(thickness); + } + if (color.a != 0) { //enable blending so alpha colored shapes work properly + Gdx.gl.glEnable(GL20.GL_BLEND); + } + Gdx.gl.glEnable(GL10.GL_LINE_SMOOTH); + + shapeRenderer.begin(ShapeType.Line); + shapeRenderer.setColor(color); + shapeRenderer.circle(adjustX(x), adjustY(y, 0), radius); + shapeRenderer.end(); + + Gdx.gl.glDisable(GL10.GL_LINE_SMOOTH); + if (color.a != 0) { + Gdx.gl.glDisable(GL20.GL_BLEND); + } + if (thickness > 1) { + Gdx.gl.glLineWidth(1); + } + + batch.begin(); + } + + public void fillCircle(FSkinColor skinColor, float x, float y, float radius) { + fillCircle(skinColor.getColor(), x, y, radius); + } + public void fillCircle(Color color, float x, float y, float radius) { + batch.end(); //must pause batch while rendering shapes + + if (color.a != 0) { //enable blending so alpha colored shapes work properly + Gdx.gl.glEnable(GL20.GL_BLEND); + } + + shapeRenderer.begin(ShapeType.Filled); + shapeRenderer.setColor(color); + shapeRenderer.circle(adjustX(x), adjustY(y, 0), radius); //TODO: Make smoother + shapeRenderer.end(); + + if (color.a != 0) { + Gdx.gl.glDisable(GL20.GL_BLEND); + } + + batch.begin(); + } + public void fillTriangle(FSkinColor skinColor, float x1, float y1, float x2, float y2, float x3, float y3) { fillTriangle(skinColor.getColor(), x1, y1, x2, y2, x3, y3); } diff --git a/forge-m-base/src/forge/screens/settings/SettingsScreen.java b/forge-m-base/src/forge/screens/settings/SettingsScreen.java index 67f87352c6a..c3b05cfb761 100644 --- a/forge-m-base/src/forge/screens/settings/SettingsScreen.java +++ b/forge-m-base/src/forge/screens/settings/SettingsScreen.java @@ -126,6 +126,7 @@ public class SettingsScreen extends FScreen { private class CustomSelectScreen extends FScreen { private final FList lstOptions; + private final String currentValue = FModel.getPreferences().getPref(pref); private CustomSelectScreen() { super(true, "Select " + label.substring(0, label.length() - 1), false); @@ -133,14 +134,28 @@ public class SettingsScreen extends FScreen { lstOptions.setListItemRenderer(new FList.DefaultListItemRenderer() { @Override public boolean tap(String value, float x, float y, int count) { - valueChanged(value); + if (!value.equals(currentValue)) { + valueChanged(value); + } Forge.back(); return true; } @Override public void drawValue(Graphics g, String value, FSkinFont font, FSkinColor foreColor, float width, float height) { - super.drawValue(g, value, font, foreColor, width, height); + float x = width * INSETS_FACTOR; + float y = 0; + width -= 2 * x; + + g.drawText(value, font, foreColor, x, y, width, height, false, HAlignment.LEFT, true); + + float radius = height / 5; + x += width - radius; + y = height / 2; + g.drawCircle(1, DESC_COLOR, x, y, radius); + if (value.equals(currentValue)) { + g.fillCircle(foreColor, x, y, radius / 2); + } } }); } diff --git a/forge-m-base/src/forge/toolbox/FList.java b/forge-m-base/src/forge/toolbox/FList.java index 4a25be19d84..b671516e767 100644 --- a/forge-m-base/src/forge/toolbox/FList.java +++ b/forge-m-base/src/forge/toolbox/FList.java @@ -15,7 +15,7 @@ public class FList extends FScrollPane { private static final float INSETS_FACTOR = 0.025f; private static final float GROUP_HEADER_HEIGHT = Utils.AVG_FINGER_HEIGHT * 0.6f; private static final FSkinColor FORE_COLOR = FSkinColor.get(Colors.CLR_TEXT); - private static final FSkinColor PRESSED_COLOR = FSkinColor.get(Colors.CLR_THEME2).alphaColor(0.75f); + private static final FSkinColor PRESSED_COLOR = FSkinColor.get(Colors.CLR_ACTIVE).alphaColor(0.9f); private static final FSkinColor LINE_COLOR = FORE_COLOR.alphaColor(0.5f); private final List groups = new ArrayList();