Menu shader / Sprite fixes
@ -26,7 +26,7 @@ allprojects {
|
||||
appName = 'Mindustry'
|
||||
gdxVersion = '1.9.8'
|
||||
roboVMVersion = '2.3.0'
|
||||
uCoreVersion = '91fb3eb182bebacdfcdbb7d979eee3c15a1f2ecc'
|
||||
uCoreVersion = '9251b7a2359f40e2b4976021610a041173e78b92'
|
||||
|
||||
getVersionString = {
|
||||
String buildVersion = getBuildVersion()
|
||||
|
Before Width: | Height: | Size: 112 B After Width: | Height: | Size: 115 B |
Before Width: | Height: | Size: 115 B After Width: | Height: | Size: 114 B |
Before Width: | Height: | Size: 111 B After Width: | Height: | Size: 110 B |
Before Width: | Height: | Size: 248 B After Width: | Height: | Size: 245 B |
Before Width: | Height: | Size: 424 B After Width: | Height: | Size: 232 B |
Before Width: | Height: | Size: 396 B After Width: | Height: | Size: 230 B |
Before Width: | Height: | Size: 140 B After Width: | Height: | Size: 140 B |
Before Width: | Height: | Size: 140 B After Width: | Height: | Size: 140 B |
Before Width: | Height: | Size: 140 B After Width: | Height: | Size: 140 B |
Before Width: | Height: | Size: 234 B After Width: | Height: | Size: 234 B |
Before Width: | Height: | Size: 233 B After Width: | Height: | Size: 234 B |
Before Width: | Height: | Size: 140 B After Width: | Height: | Size: 140 B |
Before Width: | Height: | Size: 296 B After Width: | Height: | Size: 298 B |
Before Width: | Height: | Size: 143 B After Width: | Height: | Size: 143 B |
Before Width: | Height: | Size: 140 B After Width: | Height: | Size: 140 B |
Before Width: | Height: | Size: 106 B After Width: | Height: | Size: 113 B |
Before Width: | Height: | Size: 528 B After Width: | Height: | Size: 295 B |
@ -4,27 +4,29 @@ precision mediump int;
|
||||
#endif
|
||||
|
||||
uniform sampler2D u_texture;
|
||||
uniform float resolution;
|
||||
uniform vec4 u_color;
|
||||
uniform vec2 u_resolution;
|
||||
uniform float u_time;
|
||||
uniform vec2 u_uv;
|
||||
uniform vec2 u_uv2;
|
||||
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoord;
|
||||
|
||||
bool hex(vec2 p) {
|
||||
p.x *= 0.57735*2.0;
|
||||
p.y += mod(floor(p.x), 2.0)*0.5;
|
||||
p = abs((mod(p, 1.0) - 0.5));
|
||||
return abs(max(p.x*1.5 + p.y, p.y*2.0) - 1.0) > 0.1;
|
||||
}
|
||||
|
||||
vec3 palette(float i) {
|
||||
return vec3(1.0, 1.0, 1.0);
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec2 coords = ((v_texCoord.xy - u_uv) / (u_uv2 - u_uv) - vec2(0.5, 0.5)) * u_resolution;
|
||||
|
||||
bool h = hex(v_texCoord.xy/100.0);
|
||||
float roundx = 8.0;
|
||||
float roundy = roundx;
|
||||
float roundm = 0.2;
|
||||
|
||||
gl_FragColor.rgb = vec3(h,h,h);
|
||||
gl_FragColor.a = 1.0;
|
||||
coords.x = float(int(coords.x / roundx)) * roundx;
|
||||
coords.y = float(int(coords.y / roundy)) * roundy;
|
||||
|
||||
float d = abs(coords.x) - abs(coords.y);
|
||||
|
||||
float m = abs(sin(-u_time/50.0 + d/120.0));
|
||||
m = float(int(m / roundm)) * roundm + roundm;
|
||||
|
||||
gl_FragColor.rgb = mix(v_color.rgb, vec3(0.0), m);
|
||||
gl_FragColor.a = mod(abs(coords.x) + abs(coords.y), 100.0) < 30.0 ? 1.0 : 0.0;
|
||||
}
|
Before Width: | Height: | Size: 99 KiB After Width: | Height: | Size: 99 KiB |
@ -6,6 +6,7 @@ import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import com.badlogic.gdx.utils.FloatArray;
|
||||
import io.anuke.ucore.core.Core;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.graphics.Shader;
|
||||
import io.anuke.ucore.scene.ui.layout.Unit;
|
||||
|
||||
@ -25,6 +26,7 @@ public class Shaders{
|
||||
public static MixShader mix;
|
||||
public static Shader fullMix;
|
||||
public static FogShader fog;
|
||||
public static MenuShader menu;
|
||||
|
||||
public static void init(){
|
||||
outline = new Outline();
|
||||
@ -39,6 +41,23 @@ public class Shaders{
|
||||
mix = new MixShader();
|
||||
fog = new FogShader();
|
||||
fullMix = new Shader("fullmix", "default");
|
||||
menu = new MenuShader();
|
||||
}
|
||||
|
||||
public static class MenuShader extends Shader{
|
||||
float time = 0f;
|
||||
|
||||
public MenuShader(){
|
||||
super("menu", "default");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(){
|
||||
shader.setUniformf("u_resolution", Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
||||
shader.setUniformf("u_time", time += Gdx.graphics.getDeltaTime() * 60f);
|
||||
shader.setUniformf("u_uv", Draw.getBlankRegion().getU(), Draw.getBlankRegion().getV());
|
||||
shader.setUniformf("u_uv2", Draw.getBlankRegion().getU2(), Draw.getBlankRegion().getV2());
|
||||
}
|
||||
}
|
||||
|
||||
public static class FogShader extends Shader{
|
||||
|
@ -13,7 +13,7 @@ public class Changelogs{
|
||||
public static void getChangelog(Consumer<Array<VersionInfo>> success, Consumer<Throwable> fail){
|
||||
Net.http(releasesURL, "GET", result -> {
|
||||
Json j = new Json();
|
||||
Array<JsonValue> list = j.fromJson(null, result);
|
||||
Array<JsonValue> list = j.fromJson(Array.class, result);
|
||||
Array<VersionInfo> out = new Array<>();
|
||||
for(JsonValue value : list){
|
||||
String name = value.getString("name");
|
||||
|
@ -3,8 +3,12 @@ package io.anuke.mindustry.ui.fragments;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.graphics.Palette;
|
||||
import io.anuke.mindustry.graphics.Shaders;
|
||||
import io.anuke.ucore.core.Core;
|
||||
import io.anuke.ucore.core.Graphics;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.graphics.Fill;
|
||||
import io.anuke.ucore.scene.Group;
|
||||
import io.anuke.ucore.scene.ui.layout.Unit;
|
||||
|
||||
@ -16,15 +20,14 @@ public class BackgroundFragment extends Fragment{
|
||||
public void build(Group parent){
|
||||
|
||||
Core.scene.table().addRect((a, b, w, h) -> {
|
||||
Draw.colorl(0.1f);
|
||||
Fill.crect(0, 0, w, h);
|
||||
Draw.color(Palette.accent);
|
||||
Graphics.shader(Shaders.menu);
|
||||
Fill.crect(0, 0, w, h);
|
||||
Graphics.shader();
|
||||
Draw.color();
|
||||
|
||||
TextureRegion back = Draw.region("background");
|
||||
float backscl = (int) Math.max(Gdx.graphics.getWidth() / (float) back.getRegionWidth() * 1.5f, Unit.dp.scl(5f));
|
||||
|
||||
Draw.alpha(0.5f);
|
||||
Core.batch.draw(back, w / 2 - back.getRegionWidth() * backscl / 2, h / 2 - back.getRegionHeight() * backscl / 2,
|
||||
back.getRegionWidth() * backscl, back.getRegionHeight() * backscl);
|
||||
|
||||
boolean portrait = Gdx.graphics.getWidth() < Gdx.graphics.getHeight();
|
||||
float logoscl = (int) Unit.dp.scl(7) * (portrait ? 5f / 7f : 1f);
|
||||
TextureRegion logo = Core.skin.getRegion("logotext");
|
||||
|
@ -256,7 +256,7 @@ public class BlocksFragment extends Fragment{
|
||||
}
|
||||
|
||||
selectTable.row();
|
||||
selectTable.add(stack).growX().left().top().colspan(Category.values().length).padBottom(-5).height((size + 12) * rowsUsed);
|
||||
selectTable.add(stack).growX().left().top().colspan(Category.values().length).padBottom(-5).height((size + 12) * Math.min(rowsUsed, 3));
|
||||
}
|
||||
|
||||
void toggle(float t, Interpolation ip){
|
||||
|
@ -107,7 +107,7 @@ public class Pump extends LiquidBlock{
|
||||
}
|
||||
|
||||
protected boolean isValid(Tile tile){
|
||||
return tile.floor().liquidDrop != null && tier >= tile.floor().liquidDrop.tier;
|
||||
return tile != null && tile.floor().liquidDrop != null && tier >= tile.floor().liquidDrop.tier;
|
||||
}
|
||||
|
||||
}
|
||||
|