Fullscreen key / Bugfixes
This commit is contained in:
@@ -538,6 +538,7 @@ keybind.press.axis = Press an axis or key...
|
|||||||
keybind.screenshot.name = Map Screenshot
|
keybind.screenshot.name = Map Screenshot
|
||||||
keybind.move_x.name = Move x
|
keybind.move_x.name = Move x
|
||||||
keybind.move_y.name = Move y
|
keybind.move_y.name = Move y
|
||||||
|
keybind.fullscreen.name = Toggle Fullscreen
|
||||||
keybind.select.name = Select/Shoot
|
keybind.select.name = Select/Shoot
|
||||||
keybind.diagonal_placement.name = Diagonal Placement
|
keybind.diagonal_placement.name = Diagonal Placement
|
||||||
keybind.pick.name = Pick Block
|
keybind.pick.name = Pick Block
|
||||||
|
|||||||
@@ -396,6 +396,17 @@ public class Control implements ApplicationListener{
|
|||||||
music.update();
|
music.update();
|
||||||
loops.update();
|
loops.update();
|
||||||
|
|
||||||
|
if(Core.input.keyTap(Binding.fullscreen)){
|
||||||
|
boolean full = settings.getBool("fullscreen");
|
||||||
|
if(full){
|
||||||
|
graphics.setWindowedMode(graphics.getWidth(), graphics.getHeight());
|
||||||
|
}else{
|
||||||
|
graphics.setFullscreenMode(graphics.getDisplayMode());
|
||||||
|
}
|
||||||
|
settings.put("fullscreen", !full);
|
||||||
|
settings.save();
|
||||||
|
}
|
||||||
|
|
||||||
if(!state.is(State.menu)){
|
if(!state.is(State.menu)){
|
||||||
input.update();
|
input.update();
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ public enum Binding implements KeyBind{
|
|||||||
zoom_hold(KeyCode.CONTROL_LEFT, "view"),
|
zoom_hold(KeyCode.CONTROL_LEFT, "view"),
|
||||||
zoom(new Axis(KeyCode.SCROLL)),
|
zoom(new Axis(KeyCode.SCROLL)),
|
||||||
menu(Core.app.getType() == ApplicationType.Android ? KeyCode.BACK : KeyCode.ESCAPE),
|
menu(Core.app.getType() == ApplicationType.Android ? KeyCode.BACK : KeyCode.ESCAPE),
|
||||||
|
fullscreen(KeyCode.F11),
|
||||||
pause(KeyCode.SPACE),
|
pause(KeyCode.SPACE),
|
||||||
minimap(KeyCode.M),
|
minimap(KeyCode.M),
|
||||||
toggle_menus(KeyCode.C),
|
toggle_menus(KeyCode.C),
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ public class SettingsMenuDialog extends SettingsDialog{
|
|||||||
}
|
}
|
||||||
return s + "%";
|
return s + "%";
|
||||||
});
|
});
|
||||||
graphics.sliderPref("fpscap", 241, 5, 241, 5, s -> (s > 240 ? Core.bundle.get("setting.fpscap.none") : Core.bundle.format("setting.fpscap.text", s)));
|
graphics.sliderPref("fpscap", 240, 5, 245, 5, s -> (s > 240 ? Core.bundle.get("setting.fpscap.none") : Core.bundle.format("setting.fpscap.text", s)));
|
||||||
graphics.sliderPref("chatopacity", 100, 0, 100, 5, s -> s + "%");
|
graphics.sliderPref("chatopacity", 100, 0, 100, 5, s -> s + "%");
|
||||||
|
|
||||||
if(!mobile){
|
if(!mobile){
|
||||||
@@ -207,7 +207,7 @@ public class SettingsMenuDialog extends SettingsDialog{
|
|||||||
if(b){
|
if(b){
|
||||||
Core.graphics.setFullscreenMode(Core.graphics.getDisplayMode());
|
Core.graphics.setFullscreenMode(Core.graphics.getDisplayMode());
|
||||||
}else{
|
}else{
|
||||||
Core.graphics.setWindowedMode(600, 480);
|
Core.graphics.setWindowedMode(Core.graphics.getWidth(), Core.graphics.getHeight());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,112 +0,0 @@
|
|||||||
import io.anuke.arc.util.Time;
|
|
||||||
import io.anuke.mindustry.content.Blocks;
|
|
||||||
import io.anuke.mindustry.core.GameState.State;
|
|
||||||
import io.anuke.mindustry.world.Tile;
|
|
||||||
import org.junit.jupiter.api.*;
|
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.*;
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
||||||
|
|
||||||
public class WorldTests{
|
|
||||||
static Tile[][] tiles;
|
|
||||||
|
|
||||||
@BeforeAll
|
|
||||||
static void launchApplication(){
|
|
||||||
ApplicationTests.launchApplication();
|
|
||||||
world.createTiles(10, 10);
|
|
||||||
tiles = world.getTiles();
|
|
||||||
}
|
|
||||||
|
|
||||||
@BeforeEach
|
|
||||||
void resetWorld(){
|
|
||||||
Time.setDeltaProvider(() -> 1f);
|
|
||||||
logic.reset();
|
|
||||||
state.set(State.menu);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void addDarknessAllSolidMaxDarkness(){
|
|
||||||
fillWith(Blocks.rocks.id);
|
|
||||||
world.addDarkness(tiles);
|
|
||||||
|
|
||||||
for(int x = 0; x < tiles.length; x++){
|
|
||||||
for(int y = 0; y < tiles[0].length; y++){
|
|
||||||
assertEquals(4, tiles[x][y].rotation());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void addDarknessAllSyntethicNoDarkness(){
|
|
||||||
fillWith(Blocks.copperWall.id);
|
|
||||||
world.addDarkness(tiles);
|
|
||||||
|
|
||||||
for(int x = 0; x < tiles.length; x++){
|
|
||||||
for(int y = 0; y < tiles[0].length; y++){
|
|
||||||
assertEquals(0, tiles[x][y].rotation());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void addDarknessAllNotSolidNoDarkness(){
|
|
||||||
fillWith(Blocks.air.id);
|
|
||||||
world.addDarkness(tiles);
|
|
||||||
|
|
||||||
for(int x = 0; x < tiles.length; x++){
|
|
||||||
for(int y = 0; y < tiles[0].length; y++){
|
|
||||||
assertEquals(0, tiles[x][y].rotation());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void addDarknessAllNotFilledNoDarkness(){
|
|
||||||
fillWith(Blocks.cliffs.id);
|
|
||||||
world.addDarkness(tiles);
|
|
||||||
|
|
||||||
for(int x = 0; x < tiles.length; x++){
|
|
||||||
for(int y = 0; y < tiles[0].length; y++){
|
|
||||||
assertEquals(0, tiles[x][y].rotation());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void fillWith(short tileID){
|
|
||||||
for(int x = 0; x < tiles.length; x++){
|
|
||||||
for(int y = 0; y < tiles[0].length; y++){
|
|
||||||
tiles[x][y] = new Tile(x, y, (short)0, (short)0, tileID);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void addDarknessOneNotSolidMiddleNoDarkness(){
|
|
||||||
fillWith(Blocks.rocks.id);
|
|
||||||
tiles[5][5] = new Tile(5, 5, (byte)0, (byte)0, Blocks.copperWall.id);
|
|
||||||
world.addDarkness(tiles);
|
|
||||||
|
|
||||||
for(int x = 0; x < tiles.length; x++){
|
|
||||||
for(int y = 0; y < tiles[0].length; y++){
|
|
||||||
byte darkness = tiles[x][y].rotation();
|
|
||||||
int distance = Math.abs(x - 5) + Math.abs(y - 5);
|
|
||||||
assertEquals(Math.min(Math.max(distance - 1, 0), 4), darkness);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void addDarknessOneNotSolidCornerNoDarkness(){
|
|
||||||
fillWith(Blocks.rocks.id);
|
|
||||||
tiles[7][7] = new Tile(5, 5, (byte)0, (byte)0, Blocks.copperWall.id);
|
|
||||||
world.addDarkness(tiles);
|
|
||||||
|
|
||||||
for(int x = 0; x < tiles.length; x++){
|
|
||||||
for(int y = 0; y < tiles[0].length; y++){
|
|
||||||
byte darkness = tiles[x][y].rotation();
|
|
||||||
int distance = Math.abs(x - 7) + Math.abs(y - 7);
|
|
||||||
assertEquals(Math.min(Math.max(distance - 1, 0), 4), darkness);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user