Merge branch 'freetype' of https://github.com/Anuken/Mindustry
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -189,7 +189,7 @@ text.changelog.current = [yellow][[Current version]
|
||||
text.changelog.latest = [orange][[Latest version]
|
||||
text.loading = [accent]Loading...
|
||||
text.saving = [accent]Saving...
|
||||
text.wave = [orange]Wave {0}
|
||||
text.wave = [accent]Wave {0}
|
||||
text.wave.waiting = [LIGHT_GRAY]Wave in {0}
|
||||
text.waiting = [LIGHT_GRAY]Waiting...
|
||||
text.waiting.players = Waiting for players...
|
||||
|
||||
@@ -285,7 +285,7 @@ text.settings.clearall = 모두 초기화
|
||||
text.paused = 일시 정지
|
||||
text.yes = 예
|
||||
text.no = 아니오
|
||||
text.info.title = [accent]정보
|
||||
text.info.title = 정보
|
||||
text.error.title = [crimson]오류가 발생했습니다.
|
||||
text.error.crashtitle = 오류가 발생했습니다.
|
||||
text.blocks.blockinfo = 블록 정보
|
||||
|
||||
@@ -189,8 +189,8 @@ text.changelog.current = [yellow][[Текущая версия]
|
||||
text.changelog.latest = [orange][[Последняя версия]
|
||||
text.loading = [accent] Загрузка...
|
||||
text.saving = [accent]Сохранение..
|
||||
text.wave = [orange]Волна {0}
|
||||
text.wave.waiting = Волна через {0}
|
||||
text.wave = [accent]Волна {0}
|
||||
text.wave.waiting = [LIGHT_GRAY]Волна через {0}
|
||||
text.waiting = Ожидание...
|
||||
text.waiting.players = Ожидание игроков ...
|
||||
text.wave.enemies = [LIGHT_GRAY]{0} противник. остался
|
||||
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
Before Width: | Height: | Size: 215 KiB |
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
Before Width: | Height: | Size: 137 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 140 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 69 KiB |
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
Before Width: | Height: | Size: 373 KiB |
@@ -1,31 +1,4 @@
|
||||
{
|
||||
Font: {
|
||||
default-font: {
|
||||
file: square.fnt,
|
||||
markup: true,
|
||||
scale: 0.5
|
||||
},
|
||||
default-font-chat: {
|
||||
file: square.fnt,
|
||||
markup: false,
|
||||
scale: 0.5
|
||||
},
|
||||
trad-chinese: {
|
||||
file: trad_chinese.fnt,
|
||||
markup: true,
|
||||
scale: 0.5
|
||||
},
|
||||
simp-chinese: {
|
||||
file: simp_chinese.fnt,
|
||||
markup: true,
|
||||
scale: 0.5
|
||||
},
|
||||
title: {
|
||||
file: title.fnt,
|
||||
markup: true,
|
||||
scale: 2
|
||||
}
|
||||
},
|
||||
Color: {
|
||||
black: {a: 1, b: 0, g: 0, r: 0 },
|
||||
white: {a: 1, b: 1, g: 1, r: 1 },
|
||||
@@ -88,7 +61,6 @@ SliderStyle: {
|
||||
},
|
||||
LabelStyle: {
|
||||
default: {font: default-font, fontColor: white },
|
||||
title: {font: title, fontColor: white },
|
||||
small: {font: default-font, fontColor: white }
|
||||
},
|
||||
TextFieldStyle: {
|
||||
|
||||
@@ -174,7 +174,7 @@ public class Vars{
|
||||
customMapDirectory = dataDirectory.child("maps/");
|
||||
saveDirectory = dataDirectory.child("saves/");
|
||||
|
||||
fontScale = Math.max(Unit.dp.scl(1f) / 2f, 0.5f);
|
||||
fontScale = Math.max(Unit.dp.scl(1f), 0.5f);
|
||||
baseCameraScale = Math.round(Unit.dp.scl(4));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,11 @@ package io.anuke.mindustry.core;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.Input.Keys;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.Colors;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
||||
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator;
|
||||
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeFontParameter;
|
||||
import com.badlogic.gdx.math.Interpolation;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
import io.anuke.mindustry.Vars;
|
||||
@@ -31,6 +34,8 @@ import static io.anuke.mindustry.Vars.*;
|
||||
import static io.anuke.ucore.scene.actions.Actions.*;
|
||||
|
||||
public class UI extends SceneModule{
|
||||
private FreeTypeFontGenerator generator;
|
||||
|
||||
public final MenuFragment menufrag = new MenuFragment();
|
||||
public final HudFragment hudfrag = new HudFragment();
|
||||
public final ChatFragment chatfrag = new ChatFragment();
|
||||
@@ -89,13 +94,29 @@ public class UI extends SceneModule{
|
||||
|
||||
Colors.put("accent", Palette.accent);
|
||||
}
|
||||
|
||||
void generateFonts(){
|
||||
generator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/pixel.ttf"));
|
||||
FreeTypeFontParameter param = new FreeTypeFontParameter();
|
||||
param.size = 14*2;
|
||||
param.shadowColor = Color.DARK_GRAY;
|
||||
param.shadowOffsetY = 2;
|
||||
param.incremental = true;
|
||||
|
||||
skin.add("default-font", generator.generateFont(param));
|
||||
skin.add("default-font-chat", generator.generateFont(param));
|
||||
skin.getFont("default-font").getData().markupEnabled = true;
|
||||
skin.getFont("default-font").setOwnsTexture(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadSkin(){
|
||||
skin = new Skin(Gdx.files.internal("ui/uiskin.json"), Core.atlas);
|
||||
skin = new Skin(Core.atlas);
|
||||
generateFonts();
|
||||
skin.load(Gdx.files.internal("ui/uiskin.json"));
|
||||
|
||||
for(BitmapFont font : skin.getAll(BitmapFont.class).values()){
|
||||
font.setUseIntegerPositions(false);
|
||||
font.setUseIntegerPositions(true);
|
||||
font.getData().setScale(Vars.fontScale);
|
||||
}
|
||||
}
|
||||
@@ -167,6 +188,12 @@ public class UI extends SceneModule{
|
||||
Events.fire(new ResizeEvent());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose(){
|
||||
super.dispose();
|
||||
generator.dispose();
|
||||
}
|
||||
|
||||
public void loadGraphics(Runnable call){
|
||||
loadGraphics("$text.loading", call);
|
||||
}
|
||||
|
||||
@@ -48,11 +48,11 @@ public class WaveMission extends Mission{
|
||||
@Override
|
||||
public String displayString(){
|
||||
return state.wave > target ?
|
||||
Bundles.format(
|
||||
Vars.unitGroups[Vars.waveTeam.ordinal()].size() > 1 ?
|
||||
"text.mission.wave.enemies" :
|
||||
"text.mission.wave.enemy", target, target, Vars.unitGroups[Vars.waveTeam.ordinal()].size()) :
|
||||
Bundles.format("text.mission.wave", state.wave, target, (int)(state.wavetime/60));
|
||||
Bundles.format(
|
||||
Vars.unitGroups[Vars.waveTeam.ordinal()].size() > 1 ?
|
||||
"text.mission.wave.enemies" :
|
||||
"text.mission.wave.enemy", target, target, Vars.unitGroups[Vars.waveTeam.ordinal()].size()) :
|
||||
Bundles.format("text.mission.wave", state.wave, target, (int)(state.wavetime/60));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,9 +15,9 @@ public class ItemImage extends Stack{
|
||||
public ItemImage(TextureRegion region, Supplier<CharSequence> text){
|
||||
Table t = new Table().left().bottom();
|
||||
|
||||
t.label(text).color(Color.DARK_GRAY).padBottom(-Core.skin.font().getData().capHeight * 2 / Unit.dp.scl(1f)).get().setFontScale(Unit.dp.scl(0.5f));
|
||||
t.label(text).color(Color.DARK_GRAY).padBottom(-Core.skin.font().getData().capHeight * 2 / Unit.dp.scl(1f));
|
||||
t.row();
|
||||
t.label(text).get().setFontScale(Unit.dp.scl(0.5f));
|
||||
t.label(text);
|
||||
|
||||
add(new Image(region));
|
||||
add(t);
|
||||
@@ -26,9 +26,9 @@ public class ItemImage extends Stack{
|
||||
public ItemImage(ItemStack stack){
|
||||
Table t = new Table().left().bottom();
|
||||
|
||||
t.add(stack.amount + "").color(Color.DARK_GRAY).padBottom(-Core.skin.font().getData().capHeight * 2 / Unit.dp.scl(1f)).get().setFontScale(Unit.dp.scl(0.5f));
|
||||
t.add(stack.amount + "").color(Color.DARK_GRAY).padBottom(-Core.skin.font().getData().capHeight * 2 / Unit.dp.scl(1f));
|
||||
t.row();
|
||||
t.add(stack.amount + "").get().setFontScale(Unit.dp.scl(0.5f));
|
||||
t.add(stack.amount + "");
|
||||
|
||||
add(new Image(stack.item.region));
|
||||
add(t);
|
||||
|
||||
Reference in New Issue
Block a user