mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-22 04:28:27 +07:00
Implemented number key weapon switching
This commit is contained in:
parent
8cc44b5c8c
commit
e0a1e75203
Binary file not shown.
@ -3,6 +3,7 @@ package io.anuke.mindustry;
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
import com.badlogic.gdx.Input.Buttons;
|
||||
import com.badlogic.gdx.Input.Keys;
|
||||
|
||||
import io.anuke.mindustry.entities.Weapon;
|
||||
import io.anuke.mindustry.resource.ItemStack;
|
||||
@ -55,6 +56,11 @@ public class Input{
|
||||
Cursors.restoreCursor();
|
||||
}
|
||||
|
||||
for(int i = 0; i < 9; i ++)
|
||||
if(Inputs.keyUp(Keys.valueOf(""+(i+1))) && getWeapon(i) != null){
|
||||
currentWeapon = getWeapon(i);
|
||||
ui.updateWeapons();
|
||||
}
|
||||
|
||||
if(Inputs.buttonUp(Buttons.LEFT) && recipe != null &&
|
||||
World.validPlace(World.tilex(), World.tiley(), recipe.result) && !ui.hasMouse()){
|
||||
@ -104,4 +110,25 @@ public class Input{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static int currentWeapons(){
|
||||
int i = 0;
|
||||
|
||||
for(Weapon w : Weapon.values())
|
||||
if(weapons.get(w))
|
||||
i ++;
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
public static Weapon getWeapon(int id){
|
||||
int i = 0;
|
||||
|
||||
for(Weapon w : Weapon.values())
|
||||
if(weapons.get(w))
|
||||
if(i ++ == id)
|
||||
return w;
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -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 = false;
|
||||
public static boolean debug = true;
|
||||
|
||||
public static final Vector2 vector = new Vector2();
|
||||
|
||||
|
@ -10,7 +10,7 @@ public class DesktopLauncher {
|
||||
Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration();
|
||||
config.setTitle("Mindustry");
|
||||
config.setMaximized(true);
|
||||
config.useVsync(false);
|
||||
//config.useVsync(false);
|
||||
config.setWindowedMode(800, 600);
|
||||
new Lwjgl3Application(new Mindustry(), config);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user