GWT things

This commit is contained in:
Anuken
2017-04-30 03:21:22 -04:00
parent 923dac1b4e
commit 13ac9f2d8f
9 changed files with 39 additions and 20 deletions

View File

@@ -2,6 +2,7 @@ package io.anuke.moment;
import static io.anuke.moment.world.TileType.tilesize;
import com.badlogic.gdx.Application.ApplicationType;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input.Buttons;
import com.badlogic.gdx.Input.Keys;
@@ -11,7 +12,6 @@ import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2;
import io.anuke.gif.GifRecorder;
import io.anuke.moment.ai.Pathfind;
import io.anuke.moment.entities.Enemy;
import io.anuke.moment.entities.TileEntity;
@@ -29,7 +29,7 @@ import io.anuke.ucore.util.Mathf;
import io.anuke.ucore.util.Timers;
public class Control extends RendererModule<Moment>{
GifRecorder recorder = new GifRecorder(batch);
//GifRecorder recorder = new GifRecorder(batch);
int rangex = 10, rangey = 10;
float breaktime = 0;
float breakdur = 50;
@@ -245,8 +245,8 @@ public class Control extends RendererModule<Moment>{
@Override
public void update(){
//if(Gdx.input.isKeyJustPressed(Keys.ESCAPE) && Gdx.app.getType() == ApplicationType.Desktop)
// Gdx.app.exit();
if(Gdx.input.isKeyJustPressed(Keys.ESCAPE) && Gdx.app.getType() == ApplicationType.Desktop)
Gdx.app.exit();
if(!main.playing){
clearScreen();
@@ -262,7 +262,7 @@ public class Control extends RendererModule<Moment>{
drawDefault();
recorder.update();
//recorder.update();
}
@Override
@@ -402,7 +402,7 @@ public class Control extends RendererModule<Moment>{
buffers.remove("shadow");
buffers.add("shadow", (int) (Gdx.graphics.getWidth() / cameraScale), (int) (Gdx.graphics.getHeight() / cameraScale));
rangex = (int) (width / tilesize / cameraScale);
rangey = (int) (height / tilesize / cameraScale);
rangex = (int) (width / tilesize / cameraScale/2)+1;
rangey = (int) (height / tilesize / cameraScale/2)+1;
}
}

View File

@@ -70,9 +70,10 @@ public class Moment extends ModuleController<Moment>{
generate();
items.put(Item.stone, 200);
items.put(Item.iron, 200);
items.put(Item.steel, 200);
items.put(Item.stone, 20);
//items.put(Item.stone, 200);
//items.put(Item.iron, 200);
//items.put(Item.steel, 200);
player = new Player().add();

View File

@@ -4,6 +4,7 @@ import static io.anuke.moment.world.TileType.tilesize;
import java.util.function.BooleanSupplier;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.utils.Array;
@@ -43,6 +44,12 @@ public class UI extends SceneModule<Moment>{
Dialog.closePadR = -1;
Dialog.closePadT = 4;
}
void drawBackground(){
//float w = gwidth();
//float h = gheight();
Draw.rect("player", 0, 0, 100, 100);
}
@Override
public void update(){
@@ -80,7 +87,12 @@ public class UI extends SceneModule<Moment>{
}
}else{
scene.getBatch().getProjectionMatrix().setToOrtho2D(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
scene.getBatch().begin();
drawBackground();
scene.getBatch().end();
}
super.update();
@@ -95,11 +107,6 @@ public class UI extends SceneModule<Moment>{
return (i / 4f) + "x";
});
/*
* prefs.sliderPref("difficulty", "Difficulty", 1, 0, 3, i->{ return
* (i/3f) + "x"; });
*/
keys = new KeybindDialog();
about = new Dialog("About");
@@ -322,6 +329,14 @@ public class UI extends SceneModule<Moment>{
itemtable.background("button");
get().setVisible(play);
Label fps = new Label("");
fps.update(()->{
fps.setText(Gdx.graphics.getFramesPerSecond() + " FPS");
});
row();
add(fps);
}}.end();
//wave table...

View File

@@ -13,7 +13,7 @@ import io.anuke.ucore.util.Angles;
public class Player extends DestructibleEntity{
Vector2 direction = new Vector2();
float speed = 2f;
float speed = 1f;
float rotation;
float reload;
Weapon weapon = Weapon.blaster;

View File

@@ -558,7 +558,7 @@ public enum TileType{
}
//TODO readd
//if(tile.entity.shots > 0){
if(tile.entity.shots > 0){
Enemy enemy = findTarget(tile, range);
if(enemy != null){
tile.entity.rotation = MathUtils.lerpAngleDeg(tile.entity.rotation, Angles.predictAngle(tile.worldx(), tile.worldy(), enemy.x, enemy.y, enemy.xvelocity, enemy.yvelocity, bullet.speed - 0.1f), 0.2f);
@@ -567,7 +567,7 @@ public enum TileType{
tile.entity.shots--;
}
}
//}
}
}
void shoot(Tile tile){