mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-05 15:58:14 +07:00
Added more zoom levels
This commit is contained in:
@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="io.anuke.mindustry"
|
||||
android:versionCode="2"
|
||||
android:versionName="1.01" >
|
||||
android:versionCode="3"
|
||||
android:versionName="1.02" >
|
||||
|
||||
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="25" />
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
{
|
||||
com.badlogic.gdx.graphics.g2d.BitmapFont: {
|
||||
default-font: {
|
||||
file: prose.fnt,
|
||||
markupEnabled: true,
|
||||
scale: 0.5
|
||||
file: prose.fnt,
|
||||
markupEnabled: true,
|
||||
scale: 0.5
|
||||
}
|
||||
},
|
||||
com.badlogic.gdx.graphics.Color: {
|
||||
@ -21,6 +21,7 @@ com.badlogic.gdx.graphics.Color: {
|
||||
},
|
||||
io.anuke.ucore.scene.Skin$TintedDrawable: {
|
||||
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: {
|
||||
default: {down: button-down, up: button },
|
||||
|
@ -78,7 +78,7 @@ project(":core") {
|
||||
|
||||
dependencies {
|
||||
//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-ai:1.8.1"
|
||||
}
|
||||
|
@ -1,11 +1,10 @@
|
||||
apply plugin: "java"
|
||||
|
||||
sourceCompatibility = 1.8
|
||||
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
|
||||
|
||||
sourceSets.main.java.srcDirs = [ "src/" ]
|
||||
|
||||
|
||||
sourceSets.main.java.srcDirs = ["src/"]
|
||||
eclipse.project {
|
||||
name = appName + "-core"
|
||||
}
|
||||
dependencies {
|
||||
compile files('lib/ucore.jar')
|
||||
}
|
@ -85,6 +85,14 @@ public class Control extends RendererModule{
|
||||
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(){
|
||||
weapons.clear();
|
||||
Renderer.clearTiles();
|
||||
|
@ -35,14 +35,13 @@ import io.anuke.ucore.scene.ui.layout.*;
|
||||
import io.anuke.ucore.util.Timers;
|
||||
|
||||
public class UI extends SceneModule{
|
||||
Table itemtable, weapontable, tools;
|
||||
Table itemtable, weapontable, tools, loadingtable;
|
||||
SettingsDialog prefs;
|
||||
KeybindDialog keys;
|
||||
Dialog about, menu, restart, tutorial, levels, upgrades;
|
||||
Tooltip tooltip;
|
||||
|
||||
VisibilityProvider play = () -> !GameState.is(State.menu);
|
||||
|
||||
VisibilityProvider nplay = () -> GameState.is(State.menu);
|
||||
|
||||
public UI() {
|
||||
@ -368,23 +367,17 @@ public class UI extends SceneModule{
|
||||
aleft();
|
||||
abottom();
|
||||
int base = baseCameraScale;
|
||||
int min = base-zoomScale*2;
|
||||
int max = base+zoomScale;
|
||||
new button("+", ()->{
|
||||
if(control.cameraScale < base){
|
||||
control.cameraScale = base;
|
||||
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);
|
||||
if(control.cameraScale < max){
|
||||
control.setCameraScale(control.cameraScale+zoomScale);
|
||||
}
|
||||
}).size(Unit.dp.inPixels(40));
|
||||
|
||||
new button("-", ()->{
|
||||
if(control.cameraScale > base-zoomScale){
|
||||
control.cameraScale = base-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);
|
||||
if(control.cameraScale > min){
|
||||
control.setCameraScale(control.cameraScale-zoomScale);
|
||||
}
|
||||
}).size(Unit.dp.inPixels(40));
|
||||
|
||||
@ -453,6 +446,14 @@ public class UI extends SceneModule{
|
||||
}};
|
||||
}}.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.addIButton("icon-cancel", Unit.dp.inPixels(42), ()->{
|
||||
player.recipe = null;
|
||||
@ -466,7 +467,6 @@ public class UI extends SceneModule{
|
||||
AndroidInput.place();
|
||||
});
|
||||
|
||||
|
||||
scene.add(tools);
|
||||
|
||||
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(){
|
||||
prefs.show();
|
||||
}
|
||||
|
@ -87,6 +87,7 @@ public class World{
|
||||
}
|
||||
|
||||
public static void loadMap(int id){
|
||||
|
||||
spawnpoints.clear();
|
||||
|
||||
int size = mapPixmaps[id].getWidth();
|
||||
|
@ -9,6 +9,7 @@ import io.anuke.mindustry.World;
|
||||
import io.anuke.ucore.core.Settings;
|
||||
import io.anuke.ucore.scene.ui.*;
|
||||
import io.anuke.ucore.scene.ui.layout.Unit;
|
||||
import io.anuke.ucore.util.Timers;
|
||||
|
||||
public class LevelDialog extends Dialog{
|
||||
Label[] scores = new Label[maps.length];
|
||||
@ -28,8 +29,15 @@ public class LevelDialog extends Dialog{
|
||||
addCloseButton();
|
||||
getButtonTable().addButton("Play", ()->{
|
||||
hide();
|
||||
World.loadMap(selectedMap);
|
||||
Vars.control.play();
|
||||
Vars.ui.showLoading();
|
||||
Timers.run(16, ()->{
|
||||
World.loadMap(selectedMap);
|
||||
Vars.control.play();
|
||||
});
|
||||
|
||||
Timers.run(18, ()->{
|
||||
Vars.ui.hideLoading();
|
||||
});
|
||||
});
|
||||
|
||||
ButtonGroup<ImageButton> mapgroup = new ButtonGroup<>();
|
||||
|
@ -4,7 +4,7 @@ sourceCompatibility = 1.8
|
||||
sourceSets.main.java.srcDirs = [ "src/" ]
|
||||
|
||||
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) {
|
||||
main = project.mainClassName
|
||||
|
Reference in New Issue
Block a user