Better screen res support
This commit is contained in:
@@ -120,7 +120,7 @@ public abstract class ClientLauncher extends ApplicationCore implements Platform
|
|||||||
public void update(){
|
public void update(){
|
||||||
if(!finished){
|
if(!finished){
|
||||||
loader.draw();
|
loader.draw();
|
||||||
if(assets.update(1000 / loadingFPS) && false){
|
if(assets.update(1000 / loadingFPS)){
|
||||||
Log.info("Total time to load: @", Time.timeSinceMillis(beginTime));
|
Log.info("Total time to load: @", Time.timeSinceMillis(beginTime));
|
||||||
for(ApplicationListener listener : modules){
|
for(ApplicationListener listener : modules){
|
||||||
listener.init();
|
listener.init();
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class LoadRenderer{
|
|||||||
|
|
||||||
private StringBuilder assetText = new StringBuilder();
|
private StringBuilder assetText = new StringBuilder();
|
||||||
private Bar[] bars;
|
private Bar[] bars;
|
||||||
private Mesh mesh = MeshBuilder.buildHex(colorRed, 2, true, 1f);//MeshBuilder.buildIcosphere(2, 1f, colorRed);
|
private Mesh mesh = MeshBuilder.buildHex(colorRed, 2, true, 1f);
|
||||||
private Camera3D cam = new Camera3D();
|
private Camera3D cam = new Camera3D();
|
||||||
private int lastLength = -1;
|
private int lastLength = -1;
|
||||||
private FxProcessor fx = new FxProcessor(Format.RGBA8888, 2, 2, false, true);
|
private FxProcessor fx = new FxProcessor(Format.RGBA8888, 2, 2, false, true);
|
||||||
@@ -99,6 +99,7 @@ public class LoadRenderer{
|
|||||||
Core.graphics.clear(Color.black);
|
Core.graphics.clear(Color.black);
|
||||||
|
|
||||||
float w = Core.graphics.getWidth(), h = Core.graphics.getHeight(), s = Scl.scl();
|
float w = Core.graphics.getWidth(), h = Core.graphics.getHeight(), s = Scl.scl();
|
||||||
|
//s = 2f;
|
||||||
Lines.precise(true);
|
Lines.precise(true);
|
||||||
|
|
||||||
Draw.proj().setOrtho(0, 0, Core.graphics.getWidth(), Core.graphics.getHeight());
|
Draw.proj().setOrtho(0, 0, Core.graphics.getWidth(), Core.graphics.getHeight());
|
||||||
@@ -108,16 +109,14 @@ public class LoadRenderer{
|
|||||||
float stroke = 5f * s;
|
float stroke = 5f * s;
|
||||||
|
|
||||||
//light
|
//light
|
||||||
if(true){
|
|
||||||
Fill.light(w/2, h/2, lightVerts, lightRad, Tmp.c1.set(color).a(0.15f), Color.clear);
|
Fill.light(w/2, h/2, lightVerts, lightRad, Tmp.c1.set(color).a(0.15f), Color.clear);
|
||||||
}
|
|
||||||
|
|
||||||
float space = Scl.scl(60);
|
float space = s*(60);
|
||||||
float progress = assets.getProgress();
|
float progress = assets.getProgress();
|
||||||
int dotw = (int)(w / space)/2 + 1;
|
int dotw = (int)(w / space)/2 + 1;
|
||||||
int doth = (int)(h / space)/2 + 1;
|
int doth = (int)(h / space)/2 + 1;
|
||||||
|
|
||||||
//TODO remove
|
//preview : no frametime
|
||||||
if(preview){
|
if(preview){
|
||||||
testprogress += Time.delta() / (60f * 3);
|
testprogress += Time.delta() / (60f * 3);
|
||||||
progress = testprogress;
|
progress = testprogress;
|
||||||
@@ -126,34 +125,9 @@ public class LoadRenderer{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//dot matrix
|
|
||||||
if(false){
|
|
||||||
|
|
||||||
Draw.color(Pal.accent);
|
|
||||||
|
|
||||||
Draw.alpha(0.3f);
|
|
||||||
|
|
||||||
for(int cx = -dotw; cx <= dotw; cx++){
|
|
||||||
for(int cy = -doth; cy <= doth; cy++){
|
|
||||||
float dx = cx * space + w/2f, dy = cy * space + h/2f;
|
|
||||||
|
|
||||||
Fill.square(dx, dy, 1.5f*s, 45);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Draw.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
//square matrix
|
//square matrix
|
||||||
if(true){
|
|
||||||
if(true){
|
|
||||||
//solid color
|
|
||||||
Draw.color(Pal.accent, Color.black, 0.9f);
|
Draw.color(Pal.accent, Color.black, 0.9f);
|
||||||
}else{
|
|
||||||
//alpha color
|
|
||||||
Draw.color(Pal.accent, 0.1f);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Lines.stroke(stroke);
|
Lines.stroke(stroke);
|
||||||
|
|
||||||
@@ -164,39 +138,31 @@ public class LoadRenderer{
|
|||||||
Lines.poly(dx, dy, 4, space/2f);
|
Lines.poly(dx, dy, 4, space/2f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
float aspect = 1.94f;
|
float aspect = 1.94f;
|
||||||
Draw.flush();
|
Draw.flush();
|
||||||
//portrait
|
//portrait
|
||||||
if(graphics.getHeight() > graphics.getWidth()){
|
if(graphics.getHeight() > graphics.getWidth()){
|
||||||
aspect = 1f/aspect;
|
//aspect = 1f/2;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vec2 size = Scaling.fit.apply(graphics.getWidth(), graphics.getWidth() / aspect, graphics.getWidth(), graphics.getHeight());
|
Vec2 size = Scaling.fit.apply(graphics.getWidth(), graphics.getWidth() / aspect, graphics.getWidth(), graphics.getHeight());
|
||||||
|
|
||||||
int viewportWidth = (int)size.x, viewportHeight = (int)size.y, viewportX = (int)(graphics.getWidth()/2f - size.x/2f), viewportY = (int)(graphics.getHeight()/2f - size.y/2f);
|
int viewportWidth = (int)size.x, viewportHeight = (int)size.y, viewportX = (int)(graphics.getWidth()/2f - size.x/2f), viewportY = (int)(graphics.getHeight()/2f - size.y/2f);
|
||||||
|
if(graphics.getHeight() > graphics.getWidth()){
|
||||||
|
viewportHeight = graphics.getHeight();
|
||||||
|
viewportWidth = graphics.getWidth();
|
||||||
|
viewportX = viewportY = 0;
|
||||||
|
}
|
||||||
|
|
||||||
w = viewportWidth;
|
w = viewportWidth;
|
||||||
h = viewportHeight;
|
h = viewportHeight;
|
||||||
|
|
||||||
Gl.viewport(viewportX, viewportY, viewportWidth, viewportHeight);
|
Gl.viewport(viewportX, viewportY, viewportWidth, viewportHeight);
|
||||||
Draw.proj().setOrtho(0, 0, viewportWidth, viewportHeight);
|
Draw.proj().setOrtho(0, 0, viewportWidth, viewportHeight);
|
||||||
|
|
||||||
//bars
|
|
||||||
if(false){
|
|
||||||
Draw.color(Pal.accent, Color.black, 0.7f);
|
|
||||||
|
|
||||||
for(int cx = -dotw; cx <= dotw; cx++){
|
|
||||||
float height = 400f * s * Mathf.randomSeed(cx);
|
|
||||||
|
|
||||||
float dx = cx * space + w/2f, dy = 0;
|
|
||||||
Lines.rect(dx - space/2f, dy, space, height, 1*s, 2*s);
|
|
||||||
}
|
|
||||||
|
|
||||||
Draw.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
//background text and indicator
|
//background text and indicator
|
||||||
if(true){
|
|
||||||
float rads = 110 * s;
|
float rads = 110 * s;
|
||||||
float rad = Math.min(Math.min(w, h) / 3.1f, Math.min(w, h)/2f - rads);
|
float rad = Math.min(Math.min(w, h) / 3.1f, Math.min(w, h)/2f - rads);
|
||||||
float rad2 = rad + rads;
|
float rad2 = rad + rads;
|
||||||
@@ -209,11 +175,16 @@ public class LoadRenderer{
|
|||||||
Lines.poly(w/2, h/2, 4, rad);
|
Lines.poly(w/2, h/2, 4, rad);
|
||||||
Lines.poly(w/2, h/2, 4, rad2);
|
Lines.poly(w/2, h/2, 4, rad2);
|
||||||
|
|
||||||
|
if(assets.isLoaded("tech")){
|
||||||
|
BitmapFont font = assets.get("tech");
|
||||||
|
font.getData().markupEnabled = true;
|
||||||
|
|
||||||
int panei = 0;
|
int panei = 0;
|
||||||
|
|
||||||
for(int sx : Mathf.signs){
|
for(int sx : Mathf.signs){
|
||||||
for(int sy : Mathf.signs){
|
for(int sy : Mathf.signs){
|
||||||
float y1 = h/2f + sy*rad2, y2 = h/2f + sy*120f;
|
float y1 = h/2f + sy*rad2, y2 = h/2f + sy*120f;
|
||||||
|
//if(sy < 0) y1 = Math.min(y2, y1);
|
||||||
floats.clear();
|
floats.clear();
|
||||||
|
|
||||||
if(w > h){ //non-portrait
|
if(w > h){ //non-portrait
|
||||||
@@ -222,10 +193,17 @@ public class LoadRenderer{
|
|||||||
floats.add(w/2f + (w/2f-epad)*sx, y2);
|
floats.add(w/2f + (w/2f-epad)*sx, y2);
|
||||||
floats.add(w/2f + sx*mpad + sx*Math.abs(y2-y1), y2);
|
floats.add(w/2f + sx*mpad + sx*Math.abs(y2-y1), y2);
|
||||||
}else{ //portrait
|
}else{ //portrait
|
||||||
|
float py2 = h/2f + (h/2f-epad)*sy;
|
||||||
|
float testval = sy < 0 ? Math.min(y2, y1) : Math.max(y2, y1);
|
||||||
|
|
||||||
|
if(py2*sy < testval*sy){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
floats.add(w/2f + sx*mpad, y1);
|
floats.add(w/2f + sx*mpad, y1);
|
||||||
floats.add(w/2f + sx*mpad, h/2f + (h/2f-epad)*sy);
|
floats.add(w/2f + sx*mpad, py2);
|
||||||
floats.add(w/2f + sx*mpad + sx*Math.abs(y2-y1), h/2f + (h/2f-epad)*sy);
|
floats.add(Mathf.clamp(w/2f + sx*(mpad + Math.abs(y2-y1)), stroke/2f, w - stroke/2f), py2);
|
||||||
floats.add(w/2f + sx*mpad + sx*Math.abs(y2-y1), y2);
|
floats.add(Mathf.clamp(w/2f + sx*(mpad + Math.abs(y2-y1)), stroke/2f, w - stroke/2f), y2);
|
||||||
}
|
}
|
||||||
|
|
||||||
float minx = Float.MAX_VALUE, miny = Float.MAX_VALUE, maxx = 0, maxy = 0;
|
float minx = Float.MAX_VALUE, miny = Float.MAX_VALUE, maxx = 0, maxy = 0;
|
||||||
@@ -246,10 +224,6 @@ public class LoadRenderer{
|
|||||||
|
|
||||||
Draw.beginStenciled();
|
Draw.beginStenciled();
|
||||||
|
|
||||||
if(assets.isLoaded("tech")){
|
|
||||||
BitmapFont font = assets.get("tech");
|
|
||||||
font.getData().markupEnabled = true;
|
|
||||||
|
|
||||||
GlyphLayout layout = GlyphLayout.obtain();
|
GlyphLayout layout = GlyphLayout.obtain();
|
||||||
float pad = 4;
|
float pad = 4;
|
||||||
|
|
||||||
@@ -336,6 +310,12 @@ public class LoadRenderer{
|
|||||||
|
|
||||||
//planet + bars
|
//planet + bars
|
||||||
if(!graphics.isPortrait()){
|
if(!graphics.isPortrait()){
|
||||||
|
|
||||||
|
String text = "<<ready>>";
|
||||||
|
layout.setText(font, text);
|
||||||
|
|
||||||
|
//draw only when text fits
|
||||||
|
if(layout.width * 1.5f < vw){
|
||||||
Lines.circle(cx, cy, vsize/2f);
|
Lines.circle(cx, cy, vsize/2f);
|
||||||
|
|
||||||
if(rw > 0 && rh > 0){
|
if(rw > 0 && rh > 0){
|
||||||
@@ -360,10 +340,7 @@ public class LoadRenderer{
|
|||||||
Fill.poly(cx + Angles.trnsx(ang, vrad), cy + Angles.trnsy(ang, vrad), 3, 20 * s, ang);
|
Fill.poly(cx + Angles.trnsx(ang, vrad), cy + Angles.trnsy(ang, vrad), 3, 20 * s, ang);
|
||||||
}
|
}
|
||||||
|
|
||||||
String text = "<<ready>>";
|
|
||||||
Draw.color(Color.black);
|
Draw.color(Color.black);
|
||||||
|
|
||||||
layout.setText(font, text);
|
|
||||||
Fill.rect(cx, cy, layout.width + 14f * s, layout.height + 14f * s);
|
Fill.rect(cx, cy, layout.width + 14f * s, layout.height + 14f * s);
|
||||||
|
|
||||||
font.setColor(color);
|
font.setColor(color);
|
||||||
@@ -397,6 +374,12 @@ public class LoadRenderer{
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
//X
|
||||||
|
Lines.line(vx, vy, vx + vw, vy + vh);
|
||||||
|
Lines.line(vx, vy + vh, vx + vw, vy);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//fill the triangle with some stuff
|
//fill the triangle with some stuff
|
||||||
@@ -416,9 +399,7 @@ public class LoadRenderer{
|
|||||||
}
|
}
|
||||||
|
|
||||||
layout.free();
|
layout.free();
|
||||||
}else{
|
|
||||||
Core.assets.finishLoadingAsset("tech");
|
|
||||||
}
|
|
||||||
|
|
||||||
Draw.endStencil();
|
Draw.endStencil();
|
||||||
|
|
||||||
@@ -428,7 +409,6 @@ public class LoadRenderer{
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//middle display always has correct ratio, ignores viewport
|
//middle display always has correct ratio, ignores viewport
|
||||||
@@ -439,7 +419,7 @@ public class LoadRenderer{
|
|||||||
h = graphics.getHeight();
|
h = graphics.getHeight();
|
||||||
|
|
||||||
//middle display
|
//middle display
|
||||||
if(true){
|
|
||||||
float bspace = s * 100f;
|
float bspace = s * 100f;
|
||||||
float bsize = s * 80f;
|
float bsize = s * 80f;
|
||||||
int bars = (int)(w / bspace / 2) + 1;
|
int bars = (int)(w / bspace / 2) + 1;
|
||||||
@@ -462,57 +442,32 @@ public class LoadRenderer{
|
|||||||
float width = bsize/1.7f;
|
float width = bsize/1.7f;
|
||||||
float skew = bsize/2f;
|
float skew = bsize/2f;
|
||||||
|
|
||||||
Fill.rects(w/2 + cx*dir - width/2f + dir*skew, h/2f - bsize/2f + bsize/2f, width, bsize/2f, -dir*skew);
|
float v = w / 2 + cx * dir - width / 2f;
|
||||||
Fill.rects(w/2 + cx*dir - width/2f, h/2f - bsize/2f, width, bsize/2f, dir*skew);
|
Fill.rects(v + dir*skew, h/2f - bsize/2f + bsize/2f, width, bsize/2f, -dir*skew);
|
||||||
//Lines.poly(w/2 + cx*dir, h/2f, 3, bsize, 90 + dir*90);
|
Fill.rects(v, h/2f - bsize/2f, width, bsize/2f, dir*skew);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
//centerpiece has different rendering
|
||||||
|
float fract = 1f - (-1) / (float)(bars - 1);
|
||||||
|
float alpha = progress >= fract ? 1f : Mathf.clamp((pscale - (fract - progress)) / pscale);
|
||||||
|
Draw.color(Color.black, color, alpha);
|
||||||
|
Fill.square(w/2f, h/2f, bsize/3f, 45);
|
||||||
|
|
||||||
|
//note for translators: this text is unreadable and for debugging/show anyway, so it's not translated
|
||||||
if(assets.isLoaded("tech")){
|
if(assets.isLoaded("tech")){
|
||||||
|
String name = assets.getCurrentLoading() != null ? assets.getCurrentLoading().fileName.toLowerCase() : "system";
|
||||||
|
|
||||||
|
String key = name.contains("script") ? "scripts" : name.contains("content") ? "content" : name.contains("mod") ? "mods" : name.contains("msav") ||
|
||||||
|
name.contains("maps") ? "map" : name.contains("ogg") || name.contains("mp3") ? "sound" : name.contains("png") ? "image" : "system";
|
||||||
|
|
||||||
BitmapFont font = assets.get("tech");
|
BitmapFont font = assets.get("tech");
|
||||||
font.setColor(Pal.accent);
|
font.setColor(Pal.accent);
|
||||||
Draw.color(Color.black);
|
Draw.color(Color.black);
|
||||||
font.draw(System.getProperty("java.version") + "\n\n[scarlet][[ready]", w/2f, h/2f + 120, Align.center);
|
font.draw(red + "[[[[ " +key + " ]]\n\n"+orange+"<" + Version.modifier + " " + (Version.build == 0 ? " [init]" : Version.build == -1 ? " custom" : " " + Version.build) + ">", w/2f, h/2f + 110*s, Align.center);
|
||||||
}else{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
float height = Scl.scl(50f);
|
|
||||||
|
|
||||||
Draw.color(Color.black);
|
|
||||||
Fill.poly(graphics.getWidth()/2f, graphics.getHeight()/2f, 6, Mathf.dst(graphics.getWidth()/2f, graphics.getHeight()/2f) * smoothProgress);
|
|
||||||
Draw.reset();
|
|
||||||
|
|
||||||
float w = graphics.getWidth()*0.6f;
|
|
||||||
|
|
||||||
Draw.color(Color.black);
|
|
||||||
Fill.rect(graphics.getWidth()/2f, graphics.getHeight()/2f, w, height);
|
|
||||||
|
|
||||||
Draw.color(Pal.accent);
|
|
||||||
Fill.crect(graphics.getWidth()/2f-w/2f, graphics.getHeight()/2f - height/2f, w * smoothProgress, height);
|
|
||||||
|
|
||||||
for(int i : Mathf.signs){
|
|
||||||
Fill.tri(graphics.getWidth()/2f + w/2f*i, graphics.getHeight()/2f + height/2f, graphics.getWidth()/2f + w/2f*i, graphics.getHeight()/2f - height/2f, graphics.getWidth()/2f + w/2f*i + height/2f*i, graphics.getHeight()/2f);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(assets.isLoaded("outline")){
|
|
||||||
BitmapFont font = assets.get("outline");
|
|
||||||
font.draw((int)(assets.getProgress() * 100) + "%", graphics.getWidth() / 2f, graphics.getHeight() / 2f + Scl.scl(10f), Align.center);
|
|
||||||
font.draw(bundle.get("loading", "").replace("[accent]", ""), graphics.getWidth() / 2f, graphics.getHeight() / 2f + height / 2f + Scl.scl(20), Align.center);
|
|
||||||
|
|
||||||
if(assets.getCurrentLoading() != null){
|
|
||||||
String name = assets.getCurrentLoading().fileName.toLowerCase();
|
|
||||||
String key = name.contains("script") ? "scripts" : name.contains("content") ? "content" : name.contains("mod") ? "mods" : name.contains("msav") ||
|
|
||||||
name.contains("maps") ? "map" : name.contains("ogg") || name.contains("mp3") ? "sound" : name.contains("png") ? "image" : "system";
|
|
||||||
font.draw(bundle.get("load." + key, ""), graphics.getWidth() / 2f, graphics.getHeight() / 2f - height / 2f - Scl.scl(10f), Align.center);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
Lines.precise(false);
|
Lines.precise(false);
|
||||||
Draw.flush();
|
Draw.flush();
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
org.gradle.daemon=true
|
org.gradle.daemon=true
|
||||||
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
||||||
archash=25b4f486ee44620aea0da42d4d2c958a9e6c48fa
|
archash=3bba9d6264dc329066068b1bd6fadd6632d2e7b9
|
||||||
|
|||||||
Reference in New Issue
Block a user