Added more zoom levels
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="2"
|
android:versionCode="3"
|
||||||
android:versionName="1.01" >
|
android:versionName="1.02" >
|
||||||
|
|
||||||
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="25" />
|
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="25" />
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
com.badlogic.gdx.graphics.g2d.BitmapFont: {
|
com.badlogic.gdx.graphics.g2d.BitmapFont: {
|
||||||
default-font: {
|
default-font: {
|
||||||
file: prose.fnt,
|
file: prose.fnt,
|
||||||
markupEnabled: true,
|
markupEnabled: true,
|
||||||
scale: 0.5
|
scale: 0.5
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
com.badlogic.gdx.graphics.Color: {
|
com.badlogic.gdx.graphics.Color: {
|
||||||
@@ -21,6 +21,7 @@ com.badlogic.gdx.graphics.Color: {
|
|||||||
},
|
},
|
||||||
io.anuke.ucore.scene.Skin$TintedDrawable: {
|
io.anuke.ucore.scene.Skin$TintedDrawable: {
|
||||||
dialogDim: {name: white, color: {r: 0, g: 0, b: 0, a: 0.45} }
|
dialogDim: {name: white, color: {r: 0, g: 0, b: 0, a: 0.45} }
|
||||||
|
loadDim: {name: white, color: {r: 0, g: 0, b: 0, a: 0.7} }
|
||||||
},
|
},
|
||||||
io.anuke.ucore.scene.ui.Button$ButtonStyle: {
|
io.anuke.ucore.scene.ui.Button$ButtonStyle: {
|
||||||
default: {down: button-down, up: button },
|
default: {down: button-down, up: button },
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ project(":core") {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
//compile fileTree(dir: '../core/lib', include: '*.jar')
|
//compile fileTree(dir: '../core/lib', include: '*.jar')
|
||||||
//compile 'com.github.Anuken:ucore:b58e4bd'
|
compile 'com.github.Anuken:ucore:88b945b'
|
||||||
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
|
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
|
||||||
compile "com.badlogicgames.gdx:gdx-ai:1.8.1"
|
compile "com.badlogicgames.gdx:gdx-ai:1.8.1"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
apply plugin: "java"
|
apply plugin: "java"
|
||||||
|
|
||||||
sourceCompatibility = 1.8
|
sourceCompatibility = 1.8
|
||||||
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
|
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
|
||||||
|
sourceSets.main.java.srcDirs = ["src/"]
|
||||||
sourceSets.main.java.srcDirs = [ "src/" ]
|
|
||||||
|
|
||||||
|
|
||||||
eclipse.project {
|
eclipse.project {
|
||||||
name = appName + "-core"
|
name = appName + "-core"
|
||||||
}
|
}
|
||||||
|
dependencies {
|
||||||
|
compile files('lib/ucore.jar')
|
||||||
|
}
|
||||||
@@ -85,6 +85,14 @@ public class Control extends RendererModule{
|
|||||||
player = new Player();
|
player = new Player();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setCameraScale(int scale){
|
||||||
|
this.cameraScale = scale;
|
||||||
|
resize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
||||||
|
setCamera(player.x, player.y);
|
||||||
|
Draw.getSurface("pixel").setScale(cameraScale);
|
||||||
|
Draw.getSurface("shadow").setScale(cameraScale);
|
||||||
|
}
|
||||||
|
|
||||||
public void reset(){
|
public void reset(){
|
||||||
weapons.clear();
|
weapons.clear();
|
||||||
Renderer.clearTiles();
|
Renderer.clearTiles();
|
||||||
|
|||||||
@@ -35,14 +35,13 @@ import io.anuke.ucore.scene.ui.layout.*;
|
|||||||
import io.anuke.ucore.util.Timers;
|
import io.anuke.ucore.util.Timers;
|
||||||
|
|
||||||
public class UI extends SceneModule{
|
public class UI extends SceneModule{
|
||||||
Table itemtable, weapontable, tools;
|
Table itemtable, weapontable, tools, loadingtable;
|
||||||
SettingsDialog prefs;
|
SettingsDialog prefs;
|
||||||
KeybindDialog keys;
|
KeybindDialog keys;
|
||||||
Dialog about, menu, restart, tutorial, levels, upgrades;
|
Dialog about, menu, restart, tutorial, levels, upgrades;
|
||||||
Tooltip tooltip;
|
Tooltip tooltip;
|
||||||
|
|
||||||
VisibilityProvider play = () -> !GameState.is(State.menu);
|
VisibilityProvider play = () -> !GameState.is(State.menu);
|
||||||
|
|
||||||
VisibilityProvider nplay = () -> GameState.is(State.menu);
|
VisibilityProvider nplay = () -> GameState.is(State.menu);
|
||||||
|
|
||||||
public UI() {
|
public UI() {
|
||||||
@@ -368,23 +367,17 @@ public class UI extends SceneModule{
|
|||||||
aleft();
|
aleft();
|
||||||
abottom();
|
abottom();
|
||||||
int base = baseCameraScale;
|
int base = baseCameraScale;
|
||||||
|
int min = base-zoomScale*2;
|
||||||
|
int max = base+zoomScale;
|
||||||
new button("+", ()->{
|
new button("+", ()->{
|
||||||
if(control.cameraScale < base){
|
if(control.cameraScale < max){
|
||||||
control.cameraScale = base;
|
control.setCameraScale(control.cameraScale+zoomScale);
|
||||||
control.resize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
|
||||||
control.setCamera(player.x, player.y);
|
|
||||||
Draw.getSurface("pixel").setScale(control.cameraScale);
|
|
||||||
Draw.getSurface("shadow").setScale(control.cameraScale);
|
|
||||||
}
|
}
|
||||||
}).size(Unit.dp.inPixels(40));
|
}).size(Unit.dp.inPixels(40));
|
||||||
|
|
||||||
new button("-", ()->{
|
new button("-", ()->{
|
||||||
if(control.cameraScale > base-zoomScale){
|
if(control.cameraScale > min){
|
||||||
control.cameraScale = base-zoomScale;
|
control.setCameraScale(control.cameraScale-zoomScale);
|
||||||
control.resize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
|
||||||
control.setCamera(player.x, player.y);
|
|
||||||
Draw.getSurface("pixel").setScale(control.cameraScale);
|
|
||||||
Draw.getSurface("shadow").setScale(control.cameraScale);
|
|
||||||
}
|
}
|
||||||
}).size(Unit.dp.inPixels(40));
|
}).size(Unit.dp.inPixels(40));
|
||||||
|
|
||||||
@@ -453,6 +446,14 @@ public class UI extends SceneModule{
|
|||||||
}};
|
}};
|
||||||
}}.end();
|
}}.end();
|
||||||
|
|
||||||
|
loadingtable = new table("loadDim"){{
|
||||||
|
new table("button"){{
|
||||||
|
new label("[yellow]Loading...").scale(1).pad(10);
|
||||||
|
}}.end();
|
||||||
|
}}.end().get();
|
||||||
|
|
||||||
|
loadingtable.setVisible(false);
|
||||||
|
|
||||||
tools = new Table();
|
tools = new Table();
|
||||||
tools.addIButton("icon-cancel", Unit.dp.inPixels(42), ()->{
|
tools.addIButton("icon-cancel", Unit.dp.inPixels(42), ()->{
|
||||||
player.recipe = null;
|
player.recipe = null;
|
||||||
@@ -466,7 +467,6 @@ public class UI extends SceneModule{
|
|||||||
AndroidInput.place();
|
AndroidInput.place();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
scene.add(tools);
|
scene.add(tools);
|
||||||
|
|
||||||
tools.setVisible(()->{
|
tools.setVisible(()->{
|
||||||
@@ -515,6 +515,14 @@ public class UI extends SceneModule{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void showLoading(){
|
||||||
|
loadingtable.setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void hideLoading(){
|
||||||
|
loadingtable.setVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
public void showPrefs(){
|
public void showPrefs(){
|
||||||
prefs.show();
|
prefs.show();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ public class World{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void loadMap(int id){
|
public static void loadMap(int id){
|
||||||
|
|
||||||
spawnpoints.clear();
|
spawnpoints.clear();
|
||||||
|
|
||||||
int size = mapPixmaps[id].getWidth();
|
int size = mapPixmaps[id].getWidth();
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import io.anuke.mindustry.World;
|
|||||||
import io.anuke.ucore.core.Settings;
|
import io.anuke.ucore.core.Settings;
|
||||||
import io.anuke.ucore.scene.ui.*;
|
import io.anuke.ucore.scene.ui.*;
|
||||||
import io.anuke.ucore.scene.ui.layout.Unit;
|
import io.anuke.ucore.scene.ui.layout.Unit;
|
||||||
|
import io.anuke.ucore.util.Timers;
|
||||||
|
|
||||||
public class LevelDialog extends Dialog{
|
public class LevelDialog extends Dialog{
|
||||||
Label[] scores = new Label[maps.length];
|
Label[] scores = new Label[maps.length];
|
||||||
@@ -28,8 +29,15 @@ public class LevelDialog extends Dialog{
|
|||||||
addCloseButton();
|
addCloseButton();
|
||||||
getButtonTable().addButton("Play", ()->{
|
getButtonTable().addButton("Play", ()->{
|
||||||
hide();
|
hide();
|
||||||
World.loadMap(selectedMap);
|
Vars.ui.showLoading();
|
||||||
Vars.control.play();
|
Timers.run(16, ()->{
|
||||||
|
World.loadMap(selectedMap);
|
||||||
|
Vars.control.play();
|
||||||
|
});
|
||||||
|
|
||||||
|
Timers.run(18, ()->{
|
||||||
|
Vars.ui.hideLoading();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
ButtonGroup<ImageButton> mapgroup = new ButtonGroup<>();
|
ButtonGroup<ImageButton> mapgroup = new ButtonGroup<>();
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ sourceCompatibility = 1.8
|
|||||||
sourceSets.main.java.srcDirs = [ "src/" ]
|
sourceSets.main.java.srcDirs = [ "src/" ]
|
||||||
|
|
||||||
project.ext.mainClassName = "io.anuke.mindustry.desktop.DesktopLauncher"
|
project.ext.mainClassName = "io.anuke.mindustry.desktop.DesktopLauncher"
|
||||||
project.ext.assetsDir = new File("../core/assets");
|
project.ext.assetsDir = new File("../android/assets");
|
||||||
|
|
||||||
task run(dependsOn: classes, type: JavaExec) {
|
task run(dependsOn: classes, type: JavaExec) {
|
||||||
main = project.mainClassName
|
main = project.mainClassName
|
||||||
|
|||||||
Reference in New Issue
Block a user