Added missing icons

This commit is contained in:
Anuken
2020-01-17 15:24:34 -05:00
parent c3d2351b2d
commit d9e5dc8ba2
17 changed files with 607 additions and 73 deletions

View File

@@ -213,7 +213,16 @@ public class UI implements ApplicationListener, Loadable{
TextureRegionDrawable draw = new TextureRegionDrawable(new TextureRegion(font.getRegion().getTexture(), g.u, g.v2, g.u2, g.v)){
@Override
public void draw(float x, float y, float width, float height){
super.draw(x + Math.max(g.height-g.width, 0)/2, y, g.width, g.height);
Draw.color(Tmp.c1.set(tint).mul(Draw.getColor()).toFloatBits());
float cx = x + width/2f - g.width/2f, cy = y + height/2f - g.height/2f;
cx = (int)cx;
cy = (int)cy;
Draw.rect(region, cx + g.width/2f, cy + g.height/2f, g.width, g.height);
}
@Override
public float imageSize(){
return size;
}
};
@@ -230,7 +239,7 @@ public class UI implements ApplicationListener, Loadable{
Core.assets.load("default", BitmapFont.class, new FreeTypeFontLoaderParameter(fontName, param)).loaded = f -> Fonts.def = (BitmapFont)f;
Core.assets.load("chat", BitmapFont.class, new FreeTypeFontLoaderParameter(fontName, param)).loaded = f -> Fonts.chat = (BitmapFont)f;
Core.assets.load("icon", BitmapFont.class, new FreeTypeFontLoaderParameter("fonts/icon.ttf", new FreeTypeFontParameter(){{
size = (int)(Scl.scl(28f));
size = (int)(Scl.scl(30f));
incremental = true;
}})).loaded = f -> Fonts.icon = (BitmapFont)f;
}

View File

@@ -427,7 +427,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
Cons<EditorTool> addTool = tool -> {
ImageButton button = new ImageButton(Core.atlas.drawable("Icon." + tool.name() + "-"), Styles.clearTogglei);
ImageButton button = new ImageButton(ui.getIcon(tool.name()), Styles.clearTogglei);
button.clicked(() -> {
view.setTool(tool);
if(lastTable[0] != null){

View File

@@ -1,8 +1,10 @@
package mindustry.ui;
import arc.Core;
import arc.scene.style.*;
import arc.util.Strings;
import arc.graphics.Color;
import mindustry.gen.*;
import mindustry.graphics.Pal;
public class Links{
@@ -10,17 +12,17 @@ public class Links{
private static void createLinks(){
links = new LinkEntry[]{
new LinkEntry("discord", "https://discord.gg/mindustry", Color.valueOf("7289da")),
new LinkEntry("changelog", "https://github.com/Anuken/Mindustry/releases", Pal.accent.cpy()),
new LinkEntry("trello", "https://trello.com/b/aE2tcUwF", Color.valueOf("026aa7")),
new LinkEntry("wiki", "https://mindustrygame.github.io/wiki/", Color.valueOf("0f142f")),
new LinkEntry("feathub", "https://feathub.com/Anuken/Mindustry/", Color.valueOf("ebebeb")),
new LinkEntry("reddit", "https://www.reddit.com/r/Mindustry/", Color.valueOf("ee593b")),
new LinkEntry("itch.io", "https://anuke.itch.io/mindustry", Color.valueOf("fa5c5c")),
new LinkEntry("google-play", "https://play.google.com/store/apps/details?id=io.anuke.mindustry", Color.valueOf("689f38")),
new LinkEntry("f-droid", "https://f-droid.org/packages/io.anuke.mindustry/", Color.valueOf("026aa7")),
new LinkEntry("github", "https://github.com/Anuken/Mindustry/", Color.valueOf("24292e")),
new LinkEntry("dev-builds", "https://github.com/Anuken/MindustryBuilds", Color.valueOf("fafbfc"))
new LinkEntry("discord", "https://discord.gg/mindustry", Icon.discord, Color.valueOf("7289da")),
new LinkEntry("changelog", "https://github.com/Anuken/Mindustry/releases", Icon.list, Pal.accent.cpy()),
new LinkEntry("trello", "https://trello.com/b/aE2tcUwF", Icon.trello, Color.valueOf("026aa7")),
new LinkEntry("wiki", "https://mindustrygame.github.io/wiki/", Icon.book, Color.valueOf("0f142f")),
new LinkEntry("feathub", "https://feathub.com/Anuken/Mindustry/", Icon.add, Color.valueOf("ebebeb")),
new LinkEntry("reddit", "https://www.reddit.com/r/Mindustry/", Icon.redditAlien, Color.valueOf("ee593b")),
new LinkEntry("itch.io", "https://anuke.itch.io/mindustry", Icon.itchio, Color.valueOf("fa5c5c")),
new LinkEntry("google-play", "https://play.google.com/store/apps/details?id=io.anuke.mindustry", Icon.googleplay, Color.valueOf("689f38")),
new LinkEntry("f-droid", "https://f-droid.org/packages/io.anuke.mindustry/", Icon.android, Color.valueOf("026aa7")),
new LinkEntry("github", "https://github.com/Anuken/Mindustry/", Icon.github, Color.valueOf("24292e")),
new LinkEntry("dev-builds", "https://github.com/Anuken/MindustryBuilds", Icon.githubSquare, Color.valueOf("fafbfc"))
};
}
@@ -35,12 +37,14 @@ public class Links{
public static class LinkEntry{
public final String name, title, description, link;
public final Color color;
public final Drawable icon;
public LinkEntry(String name, String link, Color color){
public LinkEntry(String name, String link, Drawable icon, Color color){
this.name = name;
this.color = color;
this.description = Core.bundle.getNotNull("link." + name + ".description");
this.link = link;
this.icon = icon;
String title = Core.bundle.getOrNull("link." + name + ".title");
this.title = title != null ? title : Strings.capitalize(name.replace("-", " "));

View File

@@ -55,7 +55,7 @@ public class AboutDialog extends FloatingDialog{
table.table(i -> {
i.background(Tex.buttonEdge3);
i.addImage(Core.atlas.drawable("icon-" + link.name));
i.addImage(link.icon);
}).size(h - 5, h);
table.table(inset -> {

View File

@@ -106,7 +106,7 @@ public class MenuFragment extends Fragment{
join = new MobileButton(Icon.add, "$joingame", () -> checkPlay(ui.join::show)),
editor = new MobileButton(Icon.terrain, "$editor", () -> checkPlay(ui.maps::show)),
tools = new MobileButton(Icon.settings, "$settings", ui.settings::show),
mods = new MobileButton(Icon.box, "$mods", ui.mods::show),
mods = new MobileButton(Icon.fileText, "$mods", ui.mods::show),
donate = new MobileButton(Icon.link, "$website", () -> Core.net.openURI("https://anuke.itch.io/mindustry")),
exit = new MobileButton(Icon.exit, "$quit", () -> Core.app.exit());
@@ -172,7 +172,7 @@ public class MenuFragment extends Fragment{
new Buttoni("$tutorial", Icon.info, () -> checkPlay(control::playTutorial))
),
new Buttoni("$editor", Icon.terrain, () -> checkPlay(ui.maps::show)), steam ? new Buttoni("$workshop", Icon.save, platform::openWorkshop) : null,
new Buttoni(Core.bundle.get("mods") + "\n" + Core.bundle.get("mods.alpha"), Icon.box, ui.mods::show),
new Buttoni(Core.bundle.get("mods") + "\n" + Core.bundle.get("mods.alpha"), Icon.fileText, ui.mods::show),
//not enough space for this button
//new Buttoni("$schematics", Icon.paste, ui.schematics::show),
new Buttoni("$settings", Icon.settings, ui.settings::show),

View File

@@ -202,15 +202,13 @@ public class PlacementFragment extends Fragment{
blockTable.row();
}
ImageButton button = blockTable.addImageButton(Icon.lock, Styles.selecti, () -> {
ImageButton button = blockTable.addImageButton(new TextureRegionDrawable(block.icon(Cicon.medium)), Styles.selecti, () -> {
if(unlocked(block)){
control.input.block = control.input.block == block ? null : block;
selectedBlocks.put(currentCategory, control.input.block);
}
}).size(46f).group(group).name("block-" + block.name).get();
button.getStyle().imageUp = new TextureRegionDrawable(block.icon(Cicon.medium));
button.update(() -> { //color unplacable things gray
TileEntity core = player.getClosestCore();
Color color = state.rules.infiniteResources || (core != null && (core.items.has(block.requirements, state.rules.buildCostMultiplier) || state.rules.infiniteResources)) ? Color.white : Color.gray;