Change area-delete to work with rightclick on desktop
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="io.anuke.mindustry"
|
package="io.anuke.mindustry"
|
||||||
android:versionCode="34"
|
android:versionCode="35"
|
||||||
android:versionName="3.1b1" >
|
android:versionName="3.1b2" >
|
||||||
|
|
||||||
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="25" />
|
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="25" />
|
||||||
<uses-permission android:name="com.android.vending.BILLING" />
|
<uses-permission android:name="com.android.vending.BILLING" />
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import io.anuke.mindustry.entities.Player;
|
|||||||
import io.anuke.ucore.scene.ui.layout.Unit;
|
import io.anuke.ucore.scene.ui.layout.Unit;
|
||||||
|
|
||||||
public class Vars{
|
public class Vars{
|
||||||
public static final boolean testAndroid = true;
|
public static final boolean testAndroid = false;
|
||||||
//shorthand for whether or not this is running on android
|
//shorthand for whether or not this is running on android
|
||||||
public static final boolean android = (Gdx.app.getType() == ApplicationType.Android) || testAndroid;
|
public static final boolean android = (Gdx.app.getType() == ApplicationType.Android) || testAndroid;
|
||||||
//shorthand for whether or not this is running on GWT
|
//shorthand for whether or not this is running on GWT
|
||||||
|
|||||||
@@ -108,8 +108,7 @@ public class Control extends Module{
|
|||||||
"pause", Keys.SPACE,
|
"pause", Keys.SPACE,
|
||||||
"dash", Keys.SHIFT_LEFT,
|
"dash", Keys.SHIFT_LEFT,
|
||||||
"rotate_right", Keys.R,
|
"rotate_right", Keys.R,
|
||||||
"rotate_left", Keys.E,
|
"rotate_left", Keys.E
|
||||||
"area_delete_mode", Keys.Q
|
|
||||||
);
|
);
|
||||||
|
|
||||||
for(int i = 0; i < Vars.saveSlots; i ++){
|
for(int i = 0; i < Vars.saveSlots; i ++){
|
||||||
|
|||||||
@@ -330,8 +330,8 @@ public class Tutorial{
|
|||||||
blockPlaceX = 2;
|
blockPlaceX = 2;
|
||||||
blockPlaceY = -2;
|
blockPlaceY = -2;
|
||||||
text = !Vars.android ?
|
text = !Vars.android ?
|
||||||
"You can delete blocks by holding the [orange]right mouse button[] on the block you want to delete. Try deleting this conveyor.":
|
"You can delete blocks by clicking the [orange]right mouse button[] on the block you want to delete. Try deleting this conveyor.":
|
||||||
"You can delete blocks by [orange]tapping and holding[] on the block you want to delete. Try deleting this conveyor.";
|
"You can delete blocks by [orange]selecting the crosshair[] in the [orange]break mode menu[] in the bottom left and tapping a block. Try deleting this conveyor.";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/*
|
/*
|
||||||
@@ -645,7 +645,7 @@ public class Tutorial{
|
|||||||
},
|
},
|
||||||
end{
|
end{
|
||||||
{
|
{
|
||||||
text = "And that concludes the tutorial! Good luck!";
|
text = "And that concludes the tutorial! Good luck!";
|
||||||
canBack = false;
|
canBack = false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import io.anuke.ucore.util.Mathf;
|
|||||||
public class DesktopInput extends InputHandler{
|
public class DesktopInput extends InputHandler{
|
||||||
int mousex, mousey;
|
int mousex, mousey;
|
||||||
int endx, endy;
|
int endx, endy;
|
||||||
|
private boolean enableHold = false;
|
||||||
|
|
||||||
@Override public float getCursorEndX(){ return endx; }
|
@Override public float getCursorEndX(){ return endx; }
|
||||||
@Override public float getCursorEndY(){ return endy; }
|
@Override public float getCursorEndY(){ return endy; }
|
||||||
@@ -29,7 +30,7 @@ public class DesktopInput extends InputHandler{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean touchDown (int screenX, int screenY, int pointer, int button){
|
public boolean touchDown (int screenX, int screenY, int pointer, int button){
|
||||||
if(button == Buttons.LEFT){
|
if((button == Buttons.LEFT && player.recipe != null) || (button == Buttons.RIGHT)){
|
||||||
Vector2 vec = Graphics.world(screenX, screenY);
|
Vector2 vec = Graphics.world(screenX, screenY);
|
||||||
mousex = (int)vec.x;
|
mousex = (int)vec.x;
|
||||||
mousey = (int)vec.y;
|
mousey = (int)vec.y;
|
||||||
@@ -38,7 +39,11 @@ public class DesktopInput extends InputHandler{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean touchUp(int screenX, int screenY, int pointer, int button){
|
public boolean touchUp(int screenX, int screenY, int pointer, int button){
|
||||||
player.placeMode.released(getBlockX(), getBlockY(), getBlockEndX(), getBlockEndY());
|
if(button == Buttons.LEFT){
|
||||||
|
player.placeMode.released(getBlockX(), getBlockY(), getBlockEndX(), getBlockEndY());
|
||||||
|
}else if(button == Buttons.RIGHT){
|
||||||
|
player.breakMode.released(getBlockX(), getBlockY(), getBlockEndX(), getBlockEndY());
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,10 +51,11 @@ public class DesktopInput extends InputHandler{
|
|||||||
public void update(){
|
public void update(){
|
||||||
if(player.isDead()) return;
|
if(player.isDead()) return;
|
||||||
|
|
||||||
if(!Inputs.buttonDown(Buttons.LEFT)){
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
endx = Gdx.input.getX();
|
endx = Gdx.input.getX();
|
||||||
endy = Gdx.input.getY();
|
endy = Gdx.input.getY();
|
||||||
|
|
||||||
@@ -69,10 +75,10 @@ public class DesktopInput extends InputHandler{
|
|||||||
player.rotation ++;
|
player.rotation ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Inputs.keyDown("area_delete_mode")){
|
if(Inputs.buttonDown(Buttons.RIGHT)){
|
||||||
player.placeMode = PlaceMode.areaDelete;
|
player.breakMode = PlaceMode.areaDelete;
|
||||||
}else{
|
}else{
|
||||||
player.placeMode = PlaceMode.hold;
|
player.breakMode = PlaceMode.hold;
|
||||||
}
|
}
|
||||||
|
|
||||||
player.rotation = Mathf.mod(player.rotation, 4);
|
player.rotation = Mathf.mod(player.rotation, 4);
|
||||||
@@ -105,7 +111,7 @@ public class DesktopInput extends InputHandler{
|
|||||||
}
|
}
|
||||||
|
|
||||||
//block breaking
|
//block breaking
|
||||||
if(Inputs.buttonDown(Buttons.RIGHT) && cursor != null && validBreak(tilex(), tiley())){
|
if(enableHold && Inputs.buttonDown(Buttons.RIGHT) && cursor != null && validBreak(tilex(), tiley())){
|
||||||
Tile tile = cursor;
|
Tile tile = cursor;
|
||||||
player.breaktime += Timers.delta();
|
player.breaktime += Timers.delta();
|
||||||
if(player.breaktime >= tile.getBreakTime()){
|
if(player.breaktime >= tile.getBreakTime()){
|
||||||
|
|||||||
Reference in New Issue
Block a user