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