This commit is contained in:
Anuken
2018-11-06 21:01:21 -05:00
24 changed files with 61 additions and 13751 deletions

View File

@@ -37,6 +37,12 @@ dependencies {
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a" natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86" natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64" natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64"
implementation "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-arm64-v8a"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86_64"
implementation "com.badlogicgames.gdx:gdx-controllers-android:$gdxVersion" implementation "com.badlogicgames.gdx:gdx-controllers-android:$gdxVersion"
} }

View File

@@ -25,7 +25,7 @@ allprojects {
appName = 'Mindustry' appName = 'Mindustry'
gdxVersion = '1.9.8' gdxVersion = '1.9.8'
roboVMVersion = '2.3.0' roboVMVersion = '2.3.0'
uCoreVersion = '1042ca8a3959a1354f5249acc89e396035a3f266' uCoreVersion = 'eb1503dfb786f5f727bdb4b6a302718490444335'
getVersionString = { getVersionString = {
String buildVersion = getBuildVersion() String buildVersion = getBuildVersion()
@@ -95,6 +95,7 @@ project(":desktop") {
compile "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion" compile "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
compile "com.badlogicgames.gdx:gdx-controllers-lwjgl3:$gdxVersion" compile "com.badlogicgames.gdx:gdx-controllers-lwjgl3:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
compile 'com.github.MinnDevelopment:java-discord-rpc:v2.0.0' compile 'com.github.MinnDevelopment:java-discord-rpc:v2.0.0'
} }
} }
@@ -129,6 +130,7 @@ project(":ios") {
compile "com.mobidevelop.robovm:robovm-cocoatouch:$roboVMVersion" compile "com.mobidevelop.robovm:robovm-cocoatouch:$roboVMVersion"
compile "com.badlogicgames.gdx:gdx-backend-robovm:$gdxVersion" compile "com.badlogicgames.gdx:gdx-backend-robovm:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-ios" compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-ios"
compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-ios"
} }
} }
@@ -157,6 +159,7 @@ project(":core") {
compile "com.badlogicgames.gdx:gdx:$gdxVersion" compile "com.badlogicgames.gdx:gdx:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-controllers:$gdxVersion" compile "com.badlogicgames.gdx:gdx-controllers:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
compileOnly project(":annotations") compileOnly project(":annotations")
annotationProcessor project(":annotations") annotationProcessor project(":annotations")

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -189,7 +189,7 @@ text.changelog.current = [yellow][[Current version]
text.changelog.latest = [orange][[Latest version] text.changelog.latest = [orange][[Latest version]
text.loading = [accent]Loading... text.loading = [accent]Loading...
text.saving = [accent]Saving... text.saving = [accent]Saving...
text.wave = [orange]Wave {0} text.wave = [accent]Wave {0}
text.wave.waiting = [LIGHT_GRAY]Wave in {0} text.wave.waiting = [LIGHT_GRAY]Wave in {0}
text.waiting = [LIGHT_GRAY]Waiting... text.waiting = [LIGHT_GRAY]Waiting...
text.waiting.players = Waiting for players... text.waiting.players = Waiting for players...

View File

@@ -285,7 +285,7 @@ text.settings.clearall = 모두 초기화
text.paused = 일시 정지 text.paused = 일시 정지
text.yes = text.yes =
text.no = 아니오 text.no = 아니오
text.info.title = [accent]정보 text.info.title = 정보
text.error.title = [crimson]오류가 발생했습니다. text.error.title = [crimson]오류가 발생했습니다.
text.error.crashtitle = 오류가 발생했습니다. text.error.crashtitle = 오류가 발생했습니다.
text.blocks.blockinfo = 블록 정보 text.blocks.blockinfo = 블록 정보

View File

@@ -189,8 +189,8 @@ text.changelog.current = [yellow][[Текущая версия]
text.changelog.latest = [orange][[Последняя версия] text.changelog.latest = [orange][[Последняя версия]
text.loading = [accent] Загрузка... text.loading = [accent] Загрузка...
text.saving = [accent]Сохранение.. text.saving = [accent]Сохранение..
text.wave = [orange]Волна {0} text.wave = [accent]Волна {0}
text.wave.waiting = Волна через {0} text.wave.waiting = [LIGHT_GRAY]Волна через {0}
text.waiting = Ожидание... text.waiting = Ожидание...
text.waiting.players = Ожидание игроков ... text.waiting.players = Ожидание игроков ...
text.wave.enemies = [LIGHT_GRAY]{0} противник. остался text.wave.enemies = [LIGHT_GRAY]{0} противник. остался

BIN
core/assets/fonts/pixel.ttf Normal file

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

View File

@@ -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: { Color: {
black: {a: 1, b: 0, g: 0, r: 0 }, black: {a: 1, b: 0, g: 0, r: 0 },
white: {a: 1, b: 1, g: 1, r: 1 }, white: {a: 1, b: 1, g: 1, r: 1 },
@@ -88,7 +61,6 @@ SliderStyle: {
}, },
LabelStyle: { LabelStyle: {
default: {font: default-font, fontColor: white }, default: {font: default-font, fontColor: white },
title: {font: title, fontColor: white },
small: {font: default-font, fontColor: white } small: {font: default-font, fontColor: white }
}, },
TextFieldStyle: { TextFieldStyle: {

View File

@@ -174,7 +174,7 @@ public class Vars{
customMapDirectory = dataDirectory.child("maps/"); customMapDirectory = dataDirectory.child("maps/");
saveDirectory = dataDirectory.child("saves/"); 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)); baseCameraScale = Math.round(Unit.dp.scl(4));
} }
} }

View File

@@ -2,8 +2,11 @@ package io.anuke.mindustry.core;
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input.Keys; import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Colors; import com.badlogic.gdx.graphics.Colors;
import com.badlogic.gdx.graphics.g2d.BitmapFont; 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.math.Interpolation;
import com.badlogic.gdx.utils.Align; import com.badlogic.gdx.utils.Align;
import io.anuke.mindustry.Vars; import io.anuke.mindustry.Vars;
@@ -31,6 +34,8 @@ import static io.anuke.mindustry.Vars.*;
import static io.anuke.ucore.scene.actions.Actions.*; import static io.anuke.ucore.scene.actions.Actions.*;
public class UI extends SceneModule{ public class UI extends SceneModule{
private FreeTypeFontGenerator generator;
public final MenuFragment menufrag = new MenuFragment(); public final MenuFragment menufrag = new MenuFragment();
public final HudFragment hudfrag = new HudFragment(); public final HudFragment hudfrag = new HudFragment();
public final ChatFragment chatfrag = new ChatFragment(); public final ChatFragment chatfrag = new ChatFragment();
@@ -90,12 +95,28 @@ public class UI extends SceneModule{
Colors.put("accent", Palette.accent); 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 @Override
protected void loadSkin(){ 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()){ for(BitmapFont font : skin.getAll(BitmapFont.class).values()){
font.setUseIntegerPositions(false); font.setUseIntegerPositions(true);
font.getData().setScale(Vars.fontScale); font.getData().setScale(Vars.fontScale);
} }
} }
@@ -167,6 +188,12 @@ public class UI extends SceneModule{
Events.fire(new ResizeEvent()); Events.fire(new ResizeEvent());
} }
@Override
public void dispose(){
super.dispose();
generator.dispose();
}
public void loadGraphics(Runnable call){ public void loadGraphics(Runnable call){
loadGraphics("$text.loading", call); loadGraphics("$text.loading", call);
} }

View File

@@ -15,9 +15,9 @@ public class ItemImage extends Stack{
public ItemImage(TextureRegion region, Supplier<CharSequence> text){ public ItemImage(TextureRegion region, Supplier<CharSequence> text){
Table t = new Table().left().bottom(); 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.row();
t.label(text).get().setFontScale(Unit.dp.scl(0.5f)); t.label(text);
add(new Image(region)); add(new Image(region));
add(t); add(t);
@@ -26,9 +26,9 @@ public class ItemImage extends Stack{
public ItemImage(ItemStack stack){ public ItemImage(ItemStack stack){
Table t = new Table().left().bottom(); 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.row();
t.add(stack.amount + "").get().setFontScale(Unit.dp.scl(0.5f)); t.add(stack.amount + "");
add(new Image(stack.item.region)); add(new Image(stack.item.region));
add(t); add(t);

View File

@@ -21,13 +21,17 @@ import java.time.format.DateTimeFormatter;
public class CrashHandler{ public class CrashHandler{
public static void handle(Throwable e){ public static void handle(Throwable e){
e.printStackTrace();
if(!OS.isMac){
try{ try{
javax.swing.UIManager.setLookAndFeel(javax.swing.UIManager.getSystemLookAndFeelClassName()); javax.swing.UIManager.setLookAndFeel(javax.swing.UIManager.getSystemLookAndFeelClassName());
}catch(Throwable ignored){} }catch(Throwable ignored){}
}
boolean badGPU = false; boolean badGPU = false;
if(e.getMessage() != null && (e.getMessage().contains("Couldn't create window") || e.getMessage().contains("OpenGL 2.0 or higher"))){ if(!OS.isMac && e.getMessage() != null && (e.getMessage().contains("Couldn't create window") || e.getMessage().contains("OpenGL 2.0 or higher"))){
try{ try{
javax.swing.JOptionPane.showMessageDialog(null, "Your graphics card does not support OpenGL 2.0!\n" + javax.swing.JOptionPane.showMessageDialog(null, "Your graphics card does not support OpenGL 2.0!\n" +
"Try to update your graphics drivers.\n\n" + "Try to update your graphics drivers.\n\n" +
@@ -37,8 +41,6 @@ public class CrashHandler{
}catch(Throwable ignored){} }catch(Throwable ignored){}
} }
e.printStackTrace();
//don't create crash logs for me (anuke), as it's expected //don't create crash logs for me (anuke), as it's expected
//also don't create logs for custom builds //also don't create logs for custom builds
if(System.getProperty("user.name").equals("anuke") || Version.build == -1) return; if(System.getProperty("user.name").equals("anuke") || Version.build == -1) return;