GWT things
This commit is contained in:
@@ -50,6 +50,7 @@ project(":html") {
|
|||||||
compile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion"
|
compile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion"
|
||||||
compile "com.badlogicgames.gdx:gdx:$gdxVersion:sources"
|
compile "com.badlogicgames.gdx:gdx:$gdxVersion:sources"
|
||||||
compile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion:sources"
|
compile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion:sources"
|
||||||
|
compile "com.badlogicgames.gdx:gdx-ai:1.8.0:sources"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,6 +61,7 @@ project(":core") {
|
|||||||
dependencies {
|
dependencies {
|
||||||
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"
|
||||||
|
compile fileTree(dir: '../core/lib', include: '*.jar')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
BIN
core/lib/ucore.jar
Normal file
BIN
core/lib/ucore.jar
Normal file
Binary file not shown.
@@ -2,6 +2,7 @@ package io.anuke.moment;
|
|||||||
|
|
||||||
import static io.anuke.moment.world.TileType.tilesize;
|
import static io.anuke.moment.world.TileType.tilesize;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.Application.ApplicationType;
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.Input.Buttons;
|
import com.badlogic.gdx.Input.Buttons;
|
||||||
import com.badlogic.gdx.Input.Keys;
|
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.Rectangle;
|
||||||
import com.badlogic.gdx.math.Vector2;
|
import com.badlogic.gdx.math.Vector2;
|
||||||
|
|
||||||
import io.anuke.gif.GifRecorder;
|
|
||||||
import io.anuke.moment.ai.Pathfind;
|
import io.anuke.moment.ai.Pathfind;
|
||||||
import io.anuke.moment.entities.Enemy;
|
import io.anuke.moment.entities.Enemy;
|
||||||
import io.anuke.moment.entities.TileEntity;
|
import io.anuke.moment.entities.TileEntity;
|
||||||
@@ -29,7 +29,7 @@ import io.anuke.ucore.util.Mathf;
|
|||||||
import io.anuke.ucore.util.Timers;
|
import io.anuke.ucore.util.Timers;
|
||||||
|
|
||||||
public class Control extends RendererModule<Moment>{
|
public class Control extends RendererModule<Moment>{
|
||||||
GifRecorder recorder = new GifRecorder(batch);
|
//GifRecorder recorder = new GifRecorder(batch);
|
||||||
int rangex = 10, rangey = 10;
|
int rangex = 10, rangey = 10;
|
||||||
float breaktime = 0;
|
float breaktime = 0;
|
||||||
float breakdur = 50;
|
float breakdur = 50;
|
||||||
@@ -245,8 +245,8 @@ public class Control extends RendererModule<Moment>{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(){
|
public void update(){
|
||||||
//if(Gdx.input.isKeyJustPressed(Keys.ESCAPE) && Gdx.app.getType() == ApplicationType.Desktop)
|
if(Gdx.input.isKeyJustPressed(Keys.ESCAPE) && Gdx.app.getType() == ApplicationType.Desktop)
|
||||||
// Gdx.app.exit();
|
Gdx.app.exit();
|
||||||
|
|
||||||
if(!main.playing){
|
if(!main.playing){
|
||||||
clearScreen();
|
clearScreen();
|
||||||
@@ -262,7 +262,7 @@ public class Control extends RendererModule<Moment>{
|
|||||||
|
|
||||||
drawDefault();
|
drawDefault();
|
||||||
|
|
||||||
recorder.update();
|
//recorder.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -402,7 +402,7 @@ public class Control extends RendererModule<Moment>{
|
|||||||
buffers.remove("shadow");
|
buffers.remove("shadow");
|
||||||
buffers.add("shadow", (int) (Gdx.graphics.getWidth() / cameraScale), (int) (Gdx.graphics.getHeight() / cameraScale));
|
buffers.add("shadow", (int) (Gdx.graphics.getWidth() / cameraScale), (int) (Gdx.graphics.getHeight() / cameraScale));
|
||||||
|
|
||||||
rangex = (int) (width / tilesize / cameraScale);
|
rangex = (int) (width / tilesize / cameraScale/2)+1;
|
||||||
rangey = (int) (height / tilesize / cameraScale);
|
rangey = (int) (height / tilesize / cameraScale/2)+1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,9 +70,10 @@ public class Moment extends ModuleController<Moment>{
|
|||||||
|
|
||||||
generate();
|
generate();
|
||||||
|
|
||||||
items.put(Item.stone, 200);
|
items.put(Item.stone, 20);
|
||||||
items.put(Item.iron, 200);
|
//items.put(Item.stone, 200);
|
||||||
items.put(Item.steel, 200);
|
//items.put(Item.iron, 200);
|
||||||
|
//items.put(Item.steel, 200);
|
||||||
|
|
||||||
player = new Player().add();
|
player = new Player().add();
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import static io.anuke.moment.world.TileType.tilesize;
|
|||||||
|
|
||||||
import java.util.function.BooleanSupplier;
|
import java.util.function.BooleanSupplier;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
|
|
||||||
@@ -43,6 +44,12 @@ public class UI extends SceneModule<Moment>{
|
|||||||
Dialog.closePadR = -1;
|
Dialog.closePadR = -1;
|
||||||
Dialog.closePadT = 4;
|
Dialog.closePadT = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void drawBackground(){
|
||||||
|
//float w = gwidth();
|
||||||
|
//float h = gheight();
|
||||||
|
Draw.rect("player", 0, 0, 100, 100);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(){
|
public void update(){
|
||||||
@@ -80,7 +87,12 @@ public class UI extends SceneModule<Moment>{
|
|||||||
}
|
}
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
scene.getBatch().getProjectionMatrix().setToOrtho2D(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
||||||
|
scene.getBatch().begin();
|
||||||
|
|
||||||
|
drawBackground();
|
||||||
|
|
||||||
|
scene.getBatch().end();
|
||||||
}
|
}
|
||||||
|
|
||||||
super.update();
|
super.update();
|
||||||
@@ -95,11 +107,6 @@ public class UI extends SceneModule<Moment>{
|
|||||||
return (i / 4f) + "x";
|
return (i / 4f) + "x";
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
|
||||||
* prefs.sliderPref("difficulty", "Difficulty", 1, 0, 3, i->{ return
|
|
||||||
* (i/3f) + "x"; });
|
|
||||||
*/
|
|
||||||
|
|
||||||
keys = new KeybindDialog();
|
keys = new KeybindDialog();
|
||||||
|
|
||||||
about = new Dialog("About");
|
about = new Dialog("About");
|
||||||
@@ -322,6 +329,14 @@ public class UI extends SceneModule<Moment>{
|
|||||||
itemtable.background("button");
|
itemtable.background("button");
|
||||||
|
|
||||||
get().setVisible(play);
|
get().setVisible(play);
|
||||||
|
|
||||||
|
Label fps = new Label("");
|
||||||
|
fps.update(()->{
|
||||||
|
fps.setText(Gdx.graphics.getFramesPerSecond() + " FPS");
|
||||||
|
});
|
||||||
|
row();
|
||||||
|
add(fps);
|
||||||
|
|
||||||
}}.end();
|
}}.end();
|
||||||
|
|
||||||
//wave table...
|
//wave table...
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import io.anuke.ucore.util.Angles;
|
|||||||
|
|
||||||
public class Player extends DestructibleEntity{
|
public class Player extends DestructibleEntity{
|
||||||
Vector2 direction = new Vector2();
|
Vector2 direction = new Vector2();
|
||||||
float speed = 2f;
|
float speed = 1f;
|
||||||
float rotation;
|
float rotation;
|
||||||
float reload;
|
float reload;
|
||||||
Weapon weapon = Weapon.blaster;
|
Weapon weapon = Weapon.blaster;
|
||||||
|
|||||||
@@ -558,7 +558,7 @@ public enum TileType{
|
|||||||
}
|
}
|
||||||
|
|
||||||
//TODO readd
|
//TODO readd
|
||||||
//if(tile.entity.shots > 0){
|
if(tile.entity.shots > 0){
|
||||||
Enemy enemy = findTarget(tile, range);
|
Enemy enemy = findTarget(tile, range);
|
||||||
if(enemy != null){
|
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);
|
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--;
|
tile.entity.shots--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void shoot(Tile tile){
|
void shoot(Tile tile){
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit trunk//EN" "http://google-web-toolkit.googlecode.com/svn/trunk/distro-source/core/src/gwt-module.dtd">
|
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit trunk//EN" "http://google-web-toolkit.googlecode.com/svn/trunk/distro-source/core/src/gwt-module.dtd">
|
||||||
<module rename-to="html">
|
<module rename-to="html">
|
||||||
<inherits name='com.badlogic.gdx.backends.gdx_backends_gwt' />
|
<inherits name='com.badlogic.gdx.backends.gdx_backends_gwt' />
|
||||||
|
|
||||||
<inherits name='Moment' />
|
<inherits name='Moment' />
|
||||||
<inherits name='uCore' />
|
<inherits name='uCore' />
|
||||||
|
<inherits name='com.badlogic.gdx.ai' />
|
||||||
<entry-point class='io.anuke.moment.client.HtmlLauncher' />
|
<entry-point class='io.anuke.moment.client.HtmlLauncher' />
|
||||||
<set-configuration-property name='xsiframe.failIfScriptTag' value='FALSE'/>
|
<set-configuration-property name='xsiframe.failIfScriptTag' value='FALSE'/>
|
||||||
<set-configuration-property name="gdx.assetpath" value="../core/assets" />
|
<set-configuration-property name="gdx.assetpath" value="../core/assets" />
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<script src="soundmanager2-jsmin.js"></script>
|
<script src="soundmanager2-jsmin.js"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body onkeydown="preventUseOfDefaultKeys(event);">
|
<body onkeydown="preventUseOfDefaultKeys(event);" oncontextmenu="return false;">
|
||||||
<div align="center" id="embed-html"></div>
|
<div align="center" id="embed-html"></div>
|
||||||
<script type="text/javascript" src="html/html.nocache.js"></script>
|
<script type="text/javascript" src="html/html.nocache.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
Reference in New Issue
Block a user