mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-13 00:05:23 +07:00
uCore surface support
This commit is contained in:
parent
e0a1e75203
commit
b8b3848e5e
@ -19,9 +19,10 @@ public class Control extends RendererModule{
|
|||||||
//GifRecorder recoder = new GifRecorder(batch);
|
//GifRecorder recoder = new GifRecorder(batch);
|
||||||
|
|
||||||
public Control(){
|
public Control(){
|
||||||
cameraScale = 4f;
|
cameraScale = 4;
|
||||||
setPixelation();
|
pixelate();
|
||||||
buffers.add("shadow", (int) (Gdx.graphics.getWidth() / cameraScale), (int) (Gdx.graphics.getHeight() / cameraScale));
|
|
||||||
|
Draw.addSurface("shadow", cameraScale);
|
||||||
|
|
||||||
atlas = new Atlas("mindustry.atlas");
|
atlas = new Atlas("mindustry.atlas");
|
||||||
|
|
||||||
@ -146,10 +147,7 @@ public class Control extends RendererModule{
|
|||||||
@Override
|
@Override
|
||||||
public void resize(int width, int height){
|
public void resize(int width, int height){
|
||||||
super.resize(width, height);
|
super.resize(width, height);
|
||||||
|
|
||||||
buffers.remove("shadow");
|
|
||||||
buffers.add("shadow", (int) (Gdx.graphics.getWidth() / cameraScale), (int) (Gdx.graphics.getHeight() / cameraScale));
|
|
||||||
|
|
||||||
rangex = (int) (width / tilesize / cameraScale/2)+2;
|
rangex = (int) (width / tilesize / cameraScale/2)+2;
|
||||||
rangey = (int) (height / tilesize / cameraScale/2)+2;
|
rangey = (int) (height / tilesize / cameraScale/2)+2;
|
||||||
}
|
}
|
||||||
|
@ -2,12 +2,9 @@ package io.anuke.mindustry;
|
|||||||
|
|
||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
import com.badlogic.gdx.Gdx;
|
|
||||||
import com.badlogic.gdx.Input.Buttons;
|
import com.badlogic.gdx.Input.Buttons;
|
||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import com.badlogic.gdx.graphics.GL20;
|
|
||||||
import com.badlogic.gdx.graphics.OrthographicCamera;
|
import com.badlogic.gdx.graphics.OrthographicCamera;
|
||||||
import com.badlogic.gdx.graphics.g2d.Batch;
|
|
||||||
import com.badlogic.gdx.math.MathUtils;
|
import com.badlogic.gdx.math.MathUtils;
|
||||||
|
|
||||||
import io.anuke.mindustry.entities.TileEntity;
|
import io.anuke.mindustry.entities.TileEntity;
|
||||||
@ -20,7 +17,6 @@ import io.anuke.ucore.core.Inputs;
|
|||||||
import io.anuke.ucore.entities.DestructibleEntity;
|
import io.anuke.ucore.entities.DestructibleEntity;
|
||||||
import io.anuke.ucore.entities.Entities;
|
import io.anuke.ucore.entities.Entities;
|
||||||
import io.anuke.ucore.entities.Entity;
|
import io.anuke.ucore.entities.Entity;
|
||||||
import io.anuke.ucore.graphics.FrameBufferMap;
|
|
||||||
import io.anuke.ucore.scene.utils.Cursors;
|
import io.anuke.ucore.scene.utils.Cursors;
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
import io.anuke.ucore.util.Timers;
|
import io.anuke.ucore.util.Timers;
|
||||||
@ -29,21 +25,12 @@ public class Renderer{
|
|||||||
|
|
||||||
public static void renderTiles(){
|
public static void renderTiles(){
|
||||||
Draw.clear();
|
Draw.clear();
|
||||||
Batch batch = control.batch;
|
|
||||||
FrameBufferMap buffers = control.buffers;
|
|
||||||
OrthographicCamera camera = control.camera;
|
OrthographicCamera camera = control.camera;
|
||||||
int rangex = control.rangex, rangey = control.rangey;
|
int rangex = control.rangex, rangey = control.rangey;
|
||||||
|
|
||||||
for(int l = 0; l < 4; l++){
|
for(int l = 0; l < 4; l++){
|
||||||
if(l == 1){
|
if(l == 1){
|
||||||
batch.end();
|
Draw.surface("shadow");
|
||||||
buffers.end("pixel");
|
|
||||||
|
|
||||||
buffers.begin("shadow");
|
|
||||||
|
|
||||||
batch.begin();
|
|
||||||
Gdx.gl.glClearColor(0, 0, 0, 0);
|
|
||||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int x = -rangex; x <= rangex; x++){
|
for(int x = -rangex; x <= rangex; x++){
|
||||||
@ -66,17 +53,9 @@ public class Renderer{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(l == 1){
|
if(l == 1){
|
||||||
batch.end();
|
Draw.color(0, 0, 0, 0.15f);
|
||||||
buffers.end("shadow");
|
Draw.flushSurface();
|
||||||
batch.setColor(0, 0, 0, 0.15f);
|
Draw.color();
|
||||||
|
|
||||||
buffers.begin("pixel");
|
|
||||||
|
|
||||||
control.drawFull("shadow");
|
|
||||||
batch.setColor(Color.WHITE);
|
|
||||||
batch.setProjectionMatrix(camera.combined);
|
|
||||||
|
|
||||||
batch.begin();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,8 +54,8 @@ public class UI extends SceneModule{
|
|||||||
|
|
||||||
Batch batch = scene.getBatch();
|
Batch batch = scene.getBatch();
|
||||||
Draw.color();
|
Draw.color();
|
||||||
int w = gwidth();
|
int w = (int)screen.x;
|
||||||
int h = gheight();
|
int h = (int)screen.y;
|
||||||
|
|
||||||
Draw.color(Hue.lightness(0.6f));
|
Draw.color(Hue.lightness(0.6f));
|
||||||
|
|
||||||
@ -331,15 +331,15 @@ public class UI extends SceneModule{
|
|||||||
aleft();
|
aleft();
|
||||||
abottom();
|
abottom();
|
||||||
new button("+", ()->{
|
new button("+", ()->{
|
||||||
if(control.cameraScale < 4f){
|
if(control.cameraScale < 4){
|
||||||
control.cameraScale = 4f;
|
control.cameraScale = 4;
|
||||||
control.resize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
control.resize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
||||||
}
|
}
|
||||||
}).size(40);
|
}).size(40);
|
||||||
|
|
||||||
new button("-", ()->{
|
new button("-", ()->{
|
||||||
if(control.cameraScale > 3f){
|
if(control.cameraScale > 3){
|
||||||
control.cameraScale = 3f;
|
control.cameraScale = 3;
|
||||||
control.resize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
control.resize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
||||||
}
|
}
|
||||||
}).size(40);
|
}).size(40);
|
||||||
|
@ -19,7 +19,7 @@ public class Vars{
|
|||||||
public static final float wavespace = 20*60;
|
public static final float wavespace = 20*60;
|
||||||
public static final float enemyspawnspace = 65;
|
public static final float enemyspawnspace = 65;
|
||||||
public static final float breakduration = 30;
|
public static final float breakduration = 30;
|
||||||
public static boolean debug = true;
|
public static boolean debug = false;
|
||||||
|
|
||||||
public static final Vector2 vector = new Vector2();
|
public static final Vector2 vector = new Vector2();
|
||||||
|
|
||||||
|
@ -34,10 +34,6 @@ public class Player extends DestructibleEntity{
|
|||||||
respawntime = respawnduration;
|
respawntime = respawnduration;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void removed(){
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(){
|
public void draw(){
|
||||||
Draw.rect("player", x, y, direction.angle()-90);
|
Draw.rect("player", x, y, direction.angle()-90);
|
||||||
|
Loading…
Reference in New Issue
Block a user