Added basic controller support
This commit is contained in:
BIN
core/assets-raw/sprites/ui/icons/icon-grid.png
Executable file
BIN
core/assets-raw/sprites/ui/icons/icon-grid.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 241 B |
BIN
core/assets-raw/sprites/ui/icons/icon-line.png
Normal file
BIN
core/assets-raw/sprites/ui/icons/icon-line.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 233 B |
@@ -58,7 +58,7 @@ io.anuke.ucore.scene.ui.Window$WindowStyle: {
|
|||||||
dialog: {stageBackground: dialogDim, titleFont: default-font, background: window-empty, titleFontColor: accent }
|
dialog: {stageBackground: dialogDim, titleFont: default-font, background: window-empty, titleFontColor: accent }
|
||||||
},
|
},
|
||||||
io.anuke.ucore.scene.ui.KeybindDialog$KeybindDialogStyle: {
|
io.anuke.ucore.scene.ui.KeybindDialog$KeybindDialogStyle: {
|
||||||
default: {keyColor: red, keyNameColor: white},
|
default: {keyColor: red, keyNameColor: white, paneStyle: clear},
|
||||||
},
|
},
|
||||||
io.anuke.ucore.scene.ui.Slider$SliderStyle: {
|
io.anuke.ucore.scene.ui.Slider$SliderStyle: {
|
||||||
default-horizontal: {background: slider, knob: slider-knob, knobOver: slider-knob-over, knobDown: slider-knob-down},
|
default-horizontal: {background: slider, knob: slider-knob, knobOver: slider-knob-over, knobDown: slider-knob-down},
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import java.util.Arrays;
|
|||||||
|
|
||||||
import com.badlogic.gdx.Application.ApplicationType;
|
import com.badlogic.gdx.Application.ApplicationType;
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
|
import com.badlogic.gdx.Input.Buttons;
|
||||||
import com.badlogic.gdx.Input.Keys;
|
import com.badlogic.gdx.Input.Keys;
|
||||||
import com.badlogic.gdx.audio.Music;
|
import com.badlogic.gdx.audio.Music;
|
||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
@@ -29,10 +30,14 @@ import io.anuke.mindustry.resource.Weapon;
|
|||||||
import io.anuke.mindustry.world.*;
|
import io.anuke.mindustry.world.*;
|
||||||
import io.anuke.ucore.UCore;
|
import io.anuke.ucore.UCore;
|
||||||
import io.anuke.ucore.core.*;
|
import io.anuke.ucore.core.*;
|
||||||
|
import io.anuke.ucore.core.Inputs.Axis;
|
||||||
|
import io.anuke.ucore.core.Inputs.DeviceType;
|
||||||
import io.anuke.ucore.entities.Entities;
|
import io.anuke.ucore.entities.Entities;
|
||||||
import io.anuke.ucore.entities.EntityGroup;
|
import io.anuke.ucore.entities.EntityGroup;
|
||||||
import io.anuke.ucore.graphics.Atlas;
|
import io.anuke.ucore.graphics.Atlas;
|
||||||
import io.anuke.ucore.modules.Module;
|
import io.anuke.ucore.modules.Module;
|
||||||
|
import io.anuke.ucore.util.Input;
|
||||||
|
import io.anuke.ucore.util.InputProxy;
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
|
|
||||||
public class Control extends Module{
|
public class Control extends Module{
|
||||||
@@ -62,6 +67,10 @@ public class Control extends Module{
|
|||||||
|
|
||||||
float respawntime;
|
float respawntime;
|
||||||
InputHandler input;
|
InputHandler input;
|
||||||
|
|
||||||
|
private InputProxy proxy;
|
||||||
|
private float controlx, controly;
|
||||||
|
private boolean controlling;
|
||||||
|
|
||||||
public Control(){
|
public Control(){
|
||||||
if(Mindustry.args.contains("-debug", false))
|
if(Mindustry.args.contains("-debug", false))
|
||||||
@@ -82,6 +91,18 @@ public class Control extends Module{
|
|||||||
}else{
|
}else{
|
||||||
input = new DesktopInput();
|
input = new DesktopInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
proxy = new InputProxy(Gdx.input){
|
||||||
|
@Override
|
||||||
|
public int getY() {
|
||||||
|
return controlling ? (int)controly : input.getY();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getX() {
|
||||||
|
return controlling ? (int)controlx : input.getX();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
Inputs.addProcessor(input);
|
Inputs.addProcessor(input);
|
||||||
|
|
||||||
@@ -99,16 +120,45 @@ public class Control extends Module{
|
|||||||
Musics.load("1.ogg", "2.ogg", "3.ogg", "4.ogg");
|
Musics.load("1.ogg", "2.ogg", "3.ogg", "4.ogg");
|
||||||
|
|
||||||
KeyBinds.defaults(
|
KeyBinds.defaults(
|
||||||
"up", Keys.W,
|
"move_x", new Axis(Input.A, Input.D),
|
||||||
"left", Keys.A,
|
"move_y", new Axis(Input.S, Input.W),
|
||||||
"down", Keys.S,
|
"shoot", Input.MOUSE_LEFT,
|
||||||
"right", Keys.D,
|
"zoom_hold", Input.CONTROL_LEFT,
|
||||||
"zoom_hold", Keys.CONTROL_LEFT,
|
"zoom", new Axis(Input.SCROLL),
|
||||||
"menu", Gdx.app.getType() == ApplicationType.Android ? Keys.BACK : Keys.ESCAPE,
|
"menu", Gdx.app.getType() == ApplicationType.Android ? Input.BACK : Input.ESCAPE,
|
||||||
"pause", Keys.SPACE,
|
"pause", Input.SPACE,
|
||||||
"dash", Keys.SHIFT_LEFT,
|
"dash", Input.SHIFT_LEFT,
|
||||||
"rotate_right", Keys.R,
|
"rotate_alt", new Axis(Input.R, Input.E),
|
||||||
"rotate_left", Keys.E
|
"rotate", new Axis(Input.SCROLL),
|
||||||
|
"weapon_1", Input.NUM_1,
|
||||||
|
"weapon_2", Input.NUM_2,
|
||||||
|
"weapon_3", Input.NUM_3,
|
||||||
|
"weapon_4", Input.NUM_4,
|
||||||
|
"weapon_5", Input.NUM_5,
|
||||||
|
"weapon_6", Input.NUM_6
|
||||||
|
);
|
||||||
|
|
||||||
|
KeyBinds.defaults(
|
||||||
|
DeviceType.controller,
|
||||||
|
"move_x", new Axis(Input.CONTROLLER_L_STICK_HORIZONTAL_AXIS),
|
||||||
|
"move_y", new Axis(Input.CONTROLLER_L_STICK_VERTICAL_AXIS),
|
||||||
|
"cursor_x", new Axis(Input.CONTROLLER_R_STICK_HORIZONTAL_AXIS),
|
||||||
|
"cursor_y", new Axis(Input.CONTROLLER_R_STICK_VERTICAL_AXIS),
|
||||||
|
"select", Input.CONTROLLER_R_BUMPER,
|
||||||
|
"shoot", Input.CONTROLLER_Y,
|
||||||
|
"zoom_hold", Input.ANY_KEY,
|
||||||
|
"zoom", new Axis(Input.CONTROLLER_DPAD_DOWN, Input.CONTROLLER_DPAD_UP),
|
||||||
|
"menu", Input.CONTROLLER_X,
|
||||||
|
"pause", Input.CONTROLLER_L_BUMPER,
|
||||||
|
"dash", Input.CONTROLLER_B,
|
||||||
|
"rotate_alt", new Axis(Input.UNSET),
|
||||||
|
"rotate", new Axis(Input.CONTROLLER_DPAD_LEFT, Input.CONTROLLER_DPAD_RIGHT),
|
||||||
|
"weapon_1", Input.NUM_1,
|
||||||
|
"weapon_2", Input.NUM_2,
|
||||||
|
"weapon_3", Input.NUM_3,
|
||||||
|
"weapon_4", Input.NUM_4,
|
||||||
|
"weapon_5", Input.NUM_5,
|
||||||
|
"weapon_6", Input.NUM_6
|
||||||
);
|
);
|
||||||
|
|
||||||
for(int i = 0; i < Vars.saveSlots; i ++){
|
for(int i = 0; i < Vars.saveSlots; i ++){
|
||||||
@@ -126,6 +176,10 @@ public class Control extends Module{
|
|||||||
spawns = WaveCreator.getSpawns();
|
spawns = WaveCreator.getSpawns();
|
||||||
//WaveCreator.testWaves(1, 30);
|
//WaveCreator.testWaves(1, 30);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean showCursor(){
|
||||||
|
return controlling;
|
||||||
|
}
|
||||||
|
|
||||||
public void reset(){
|
public void reset(){
|
||||||
weapons.clear();
|
weapons.clear();
|
||||||
@@ -433,32 +487,73 @@ public class Control extends Module{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(){
|
public void update(){
|
||||||
|
|
||||||
|
if(Gdx.input != proxy){
|
||||||
|
Gdx.input = proxy;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(KeyBinds.getSection("default").device.type == DeviceType.controller){
|
||||||
|
if(Inputs.keyTap("select")){
|
||||||
|
UCore.log("Select.");
|
||||||
|
Core.scene.touchDown(Gdx.input.getX(), Gdx.input.getY(), 0, Buttons.LEFT);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(Inputs.keyRelease("select")){
|
||||||
|
Core.scene.touchUp(Gdx.input.getX(), Gdx.input.getY(), 0, Buttons.LEFT);
|
||||||
|
}
|
||||||
|
|
||||||
|
float xa = Inputs.getAxis("cursor_x");
|
||||||
|
float ya = Inputs.getAxis("cursor_y");
|
||||||
|
|
||||||
|
if(Math.abs(xa) > 0.3 || Math.abs(ya) > 0.3) {
|
||||||
|
controlx += xa*10;
|
||||||
|
controly -= ya*10;
|
||||||
|
controlling = true;
|
||||||
|
|
||||||
|
Core.scene.touchDragged(Gdx.input.getX(), Gdx.input.getY(), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
controlx = Mathf.clamp(controlx, 0, Gdx.graphics.getWidth());
|
||||||
|
controly = Mathf.clamp(controly, 0, Gdx.graphics.getHeight());
|
||||||
|
|
||||||
|
if(Gdx.input.getDeltaX() > 1 || Gdx.input.getDeltaY() > 1)
|
||||||
|
controlling = false;
|
||||||
|
}else{
|
||||||
|
controlling = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!controlling){
|
||||||
|
controlx = Gdx.input.getX();
|
||||||
|
controly = Gdx.input.getY();
|
||||||
|
}
|
||||||
|
|
||||||
|
Gdx.input.setCursorCatched(controlling);
|
||||||
|
|
||||||
if(debug && GameState.is(State.playing)){
|
if(debug && GameState.is(State.playing)){
|
||||||
//debug actions
|
//debug actions
|
||||||
if(Inputs.keyUp(Keys.P)){
|
if(Inputs.keyTap(Keys.P)){
|
||||||
Effects.effect(Fx.shellsmoke, player);
|
Effects.effect(Fx.shellsmoke, player);
|
||||||
Effects.effect(Fx.shellexplosion, player);
|
Effects.effect(Fx.shellexplosion, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Inputs.keyUp(Keys.C)){
|
if(Inputs.keyTap(Keys.C)){
|
||||||
enemyGroup.clear();
|
enemyGroup.clear();
|
||||||
enemies = 0;
|
enemies = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Inputs.keyUp(Keys.F)){
|
if(Inputs.keyTap(Keys.F)){
|
||||||
wavetime = 0f;
|
wavetime = 0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Inputs.keyUp(Keys.U)){
|
if(Inputs.keyTap(Keys.U)){
|
||||||
Vars.showUI = !Vars.showUI;
|
Vars.showUI = !Vars.showUI;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Inputs.keyUp(Keys.O)){
|
if(Inputs.keyTap(Keys.O)){
|
||||||
Vars.noclip = !Vars.noclip;
|
Vars.noclip = !Vars.noclip;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Inputs.keyUp(Keys.Y)){
|
if(Inputs.keyTap(Keys.Y)){
|
||||||
if(Inputs.keyDown(Keys.SHIFT_LEFT)){
|
if(Inputs.keyDown(Keys.SHIFT_LEFT)){
|
||||||
new HealerEnemy().set(player.x, player.y).add();
|
new HealerEnemy().set(player.x, player.y).add();
|
||||||
}else{
|
}else{
|
||||||
@@ -476,11 +571,11 @@ public class Control extends Module{
|
|||||||
if(!GameState.is(State.menu)){
|
if(!GameState.is(State.menu)){
|
||||||
input.update();
|
input.update();
|
||||||
|
|
||||||
if(Inputs.keyUp("pause") && !ui.isGameOver() && (GameState.is(State.paused) || GameState.is(State.playing))){
|
if(Inputs.keyTap("pause") && !ui.isGameOver() && (GameState.is(State.paused) || GameState.is(State.playing))){
|
||||||
GameState.set(GameState.is(State.playing) ? State.paused : State.playing);
|
GameState.set(GameState.is(State.playing) ? State.paused : State.playing);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Inputs.keyUp("menu")){
|
if(Inputs.keyTap("menu")){
|
||||||
if(GameState.is(State.paused)){
|
if(GameState.is(State.paused)){
|
||||||
ui.hideMenu();
|
ui.hideMenu();
|
||||||
GameState.set(State.playing);
|
GameState.set(State.playing);
|
||||||
|
|||||||
@@ -22,7 +22,9 @@ import io.anuke.mindustry.ui.fragments.*;
|
|||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
import io.anuke.mindustry.world.blocks.Blocks;
|
import io.anuke.mindustry.world.blocks.Blocks;
|
||||||
import io.anuke.mindustry.world.blocks.types.Configurable;
|
import io.anuke.mindustry.world.blocks.types.Configurable;
|
||||||
|
import io.anuke.ucore.UCore;
|
||||||
import io.anuke.ucore.core.*;
|
import io.anuke.ucore.core.*;
|
||||||
|
import io.anuke.ucore.core.Inputs.DeviceType;
|
||||||
import io.anuke.ucore.function.Listenable;
|
import io.anuke.ucore.function.Listenable;
|
||||||
import io.anuke.ucore.function.VisibilityProvider;
|
import io.anuke.ucore.function.VisibilityProvider;
|
||||||
import io.anuke.ucore.modules.SceneModule;
|
import io.anuke.ucore.modules.SceneModule;
|
||||||
@@ -155,6 +157,13 @@ public class UI extends SceneModule{
|
|||||||
|
|
||||||
scene.act();
|
scene.act();
|
||||||
scene.draw();
|
scene.draw();
|
||||||
|
|
||||||
|
if(control.showCursor()) {
|
||||||
|
Draw.color();
|
||||||
|
scene.getBatch().begin();
|
||||||
|
Draw.rect("icon-close", Gdx.input.getX(), Gdx.graphics.getHeight() - Gdx.input.getY());
|
||||||
|
scene.getBatch().end();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -163,7 +172,7 @@ public class UI extends SceneModule{
|
|||||||
configtable = new Table();
|
configtable = new Table();
|
||||||
scene.add(configtable);
|
scene.add(configtable);
|
||||||
|
|
||||||
editorDialog = new MapEditorDialog(editor);
|
if(!Vars.gwt) editorDialog = new MapEditorDialog(editor);
|
||||||
|
|
||||||
settingserror = new Dialog("Warning", "dialog");
|
settingserror = new Dialog("Warning", "dialog");
|
||||||
settingserror.content().add("[crimson]Failed to access local storage.\nSettings will not be saved.");
|
settingserror.content().add("[crimson]Failed to access local storage.\nSettings will not be saved.");
|
||||||
|
|||||||
@@ -83,17 +83,16 @@ public class Player extends DestructibleEntity{
|
|||||||
}
|
}
|
||||||
|
|
||||||
vector.set(0, 0);
|
vector.set(0, 0);
|
||||||
|
|
||||||
|
float xa = Inputs.getAxis("move_x");
|
||||||
|
float ya = Inputs.getAxis("move_y");
|
||||||
|
if(Math.abs(xa) < 0.3) xa = 0;
|
||||||
|
if(Math.abs(ya) < 0.3) ya = 0;
|
||||||
|
|
||||||
|
vector.y += ya*speed;
|
||||||
|
vector.x += xa*speed;
|
||||||
|
|
||||||
if(Inputs.keyDown("up"))
|
boolean shooting = !Inputs.keyDown("dash") && Inputs.keyDown("shoot") && recipe == null
|
||||||
vector.y += speed;
|
|
||||||
if(Inputs.keyDown("down"))
|
|
||||||
vector.y -= speed;
|
|
||||||
if(Inputs.keyDown("left"))
|
|
||||||
vector.x -= speed;
|
|
||||||
if(Inputs.keyDown("right"))
|
|
||||||
vector.x += speed;
|
|
||||||
|
|
||||||
boolean shooting = !Inputs.keyDown("dash") && Inputs.buttonDown(Buttons.LEFT) && recipe == null
|
|
||||||
&& !ui.hasMouse() && !control.getInput().onConfigurable();
|
&& !ui.hasMouse() && !control.getInput().onConfigurable();
|
||||||
|
|
||||||
if(shooting && Timers.get(this, "reload", weapon.reload)){
|
if(shooting && Timers.get(this, "reload", weapon.reload)){
|
||||||
|
|||||||
@@ -12,10 +12,14 @@ import io.anuke.mindustry.core.GameState.State;
|
|||||||
import io.anuke.mindustry.resource.Weapon;
|
import io.anuke.mindustry.resource.Weapon;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
import io.anuke.mindustry.world.blocks.types.Configurable;
|
import io.anuke.mindustry.world.blocks.types.Configurable;
|
||||||
|
import io.anuke.ucore.UCore;
|
||||||
import io.anuke.ucore.core.Graphics;
|
import io.anuke.ucore.core.Graphics;
|
||||||
import io.anuke.ucore.core.Inputs;
|
import io.anuke.ucore.core.Inputs;
|
||||||
|
import io.anuke.ucore.core.Inputs.DeviceType;
|
||||||
|
import io.anuke.ucore.core.KeyBinds;
|
||||||
import io.anuke.ucore.core.Timers;
|
import io.anuke.ucore.core.Timers;
|
||||||
import io.anuke.ucore.scene.utils.Cursors;
|
import io.anuke.ucore.scene.utils.Cursors;
|
||||||
|
import io.anuke.ucore.util.InputProxy;
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
|
|
||||||
public class DesktopInput extends InputHandler{
|
public class DesktopInput extends InputHandler{
|
||||||
@@ -23,6 +27,10 @@ public class DesktopInput extends InputHandler{
|
|||||||
int endx, endy;
|
int endx, endy;
|
||||||
private boolean enableHold = false;
|
private boolean enableHold = false;
|
||||||
private boolean beganBreak;
|
private boolean beganBreak;
|
||||||
|
|
||||||
|
public DesktopInput(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override public float getCursorEndX(){ return endx; }
|
@Override public float getCursorEndX(){ return endx; }
|
||||||
@Override public float getCursorEndY(){ return endy; }
|
@Override public float getCursorEndY(){ return endy; }
|
||||||
@@ -52,7 +60,7 @@ public class DesktopInput extends InputHandler{
|
|||||||
@Override
|
@Override
|
||||||
public void update(){
|
public void update(){
|
||||||
if(player.isDead()) return;
|
if(player.isDead()) return;
|
||||||
|
|
||||||
if(!Inputs.buttonDown(Buttons.LEFT) && !Inputs.buttonDown(Buttons.RIGHT)){
|
if(!Inputs.buttonDown(Buttons.LEFT) && !Inputs.buttonDown(Buttons.RIGHT)){
|
||||||
mousex = (int)Graphics.mouseWorld().x;
|
mousex = (int)Graphics.mouseWorld().x;
|
||||||
mousey = (int)Graphics.mouseWorld().y;
|
mousey = (int)Graphics.mouseWorld().y;
|
||||||
@@ -61,21 +69,13 @@ public class DesktopInput extends InputHandler{
|
|||||||
endx = Gdx.input.getX();
|
endx = Gdx.input.getX();
|
||||||
endy = Gdx.input.getY();
|
endy = Gdx.input.getY();
|
||||||
|
|
||||||
if(Inputs.scrolled() && Inputs.keyDown("zoom_hold") && !GameState.is(State.menu) && !ui.onDialog()){
|
if(Inputs.getAxisActive("zoom") && Inputs.keyDown("zoom_hold") && !GameState.is(State.menu) && !ui.onDialog()){
|
||||||
renderer.scaleCamera(Inputs.scroll());
|
renderer.scaleCamera((int)Inputs.getAxis("zoom"));
|
||||||
}
|
|
||||||
|
|
||||||
if(Inputs.scrolled()){
|
|
||||||
player.rotation += Inputs.scroll();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(Inputs.keyUp("rotate_right")){
|
|
||||||
player.rotation --;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(Inputs.keyUp("rotate_left")){
|
|
||||||
player.rotation ++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
player.rotation += Inputs.getAxis("rotate_alt");
|
||||||
|
player.rotation += Inputs.getAxis("rotate");
|
||||||
|
player.rotation = Mathf.mod(player.rotation, 4);
|
||||||
|
|
||||||
if(Inputs.buttonDown(Buttons.RIGHT)){
|
if(Inputs.buttonDown(Buttons.RIGHT)){
|
||||||
player.breakMode = PlaceMode.areaDelete;
|
player.breakMode = PlaceMode.areaDelete;
|
||||||
@@ -83,11 +83,9 @@ public class DesktopInput extends InputHandler{
|
|||||||
player.breakMode = PlaceMode.hold;
|
player.breakMode = PlaceMode.hold;
|
||||||
}
|
}
|
||||||
|
|
||||||
player.rotation = Mathf.mod(player.rotation, 4);
|
for(int i = 1; i <= 6 && i < control.getWeapons().size; i ++){
|
||||||
|
if(Inputs.keyTap("weapon_" + i) && i < control.getWeapons().size){
|
||||||
for(int i = 0; i < 9; i ++){
|
player.weapon = control.getWeapons().get(i - 1);
|
||||||
if(Inputs.keyUp(Keys.valueOf(""+(i+1))) && i < control.getWeapons().size){
|
|
||||||
player.weapon = control.getWeapons().get(i);
|
|
||||||
ui.updateWeapons();
|
ui.updateWeapons();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package io.anuke.mindustry.mapeditor;
|
package io.anuke.mindustry.mapeditor;
|
||||||
|
|
||||||
import com.badlogic.gdx.Input;
|
import com.badlogic.gdx.Input;
|
||||||
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import com.badlogic.gdx.graphics.Colors;
|
import com.badlogic.gdx.graphics.Colors;
|
||||||
import com.badlogic.gdx.graphics.Pixmap;
|
import com.badlogic.gdx.graphics.Pixmap;
|
||||||
import com.badlogic.gdx.graphics.g2d.Batch;
|
import com.badlogic.gdx.graphics.g2d.Batch;
|
||||||
@@ -219,9 +220,12 @@ public class MapView extends Element implements GestureListener{
|
|||||||
boolean pop = ScissorStack.pushScissors(Tmp.r1.set(x + width/2 - size/2, y + height/2 - size/2, size, size));
|
boolean pop = ScissorStack.pushScissors(Tmp.r1.set(x + width/2 - size/2, y + height/2 - size/2, size, size));
|
||||||
|
|
||||||
batch.draw(editor.texture(), centerx - sclwidth/2, centery - sclheight/2, sclwidth, sclheight);
|
batch.draw(editor.texture(), centerx - sclwidth/2, centery - sclheight/2, sclwidth, sclheight);
|
||||||
|
|
||||||
if(grid){
|
if(grid){
|
||||||
|
Draw.color(Color.GRAY);
|
||||||
image.setBounds(centerx - sclwidth/2, centery - sclheight/2, sclwidth, sclheight);
|
image.setBounds(centerx - sclwidth/2, centery - sclheight/2, sclwidth, sclheight);
|
||||||
image.draw(batch, alpha);
|
image.draw(batch, alpha);
|
||||||
|
Draw.color();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tool == EditorTool.line && drawing){
|
if(tool == EditorTool.line && drawing){
|
||||||
|
|||||||
Reference in New Issue
Block a user