Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
fazo96 committed Aug 8, 2015
1 parent c37675d commit 2d6b895
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions core/src/com/mygdx/game/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public boolean touchUp(int i, int i1, int i2, int i3) {
@Override
public boolean touchDragged(int i, int i1, int i2) {
//renderer.translate(Gdx.input.getDeltaX(), -Gdx.input.getDeltaY(), 0);
camera.translate(-Gdx.input.getDeltaX()*camera.zoom, Gdx.input.getDeltaY()*camera.zoom);
camera.translate(-Gdx.input.getDeltaX() * camera.zoom, Gdx.input.getDeltaY() * camera.zoom);
camera.update();
return true;
}
Expand All @@ -70,17 +70,20 @@ public boolean mouseMoved(int i, int i1) {
@Override
public boolean scrolled(int i) {
/*
if (i>0) {
renderer.scale(0.9f, 0.9f, 1);
} else {
renderer.scale(1.1f, 1.1f, 1);
}
*/
if (i>0) {
renderer.scale(0.9f, 0.9f, 1);
} else {
renderer.scale(1.1f, 1.1f, 1);
}
*/
camera.zoom += i;
if(camera.zoom < 1f) camera.zoom = 1f;
else if(camera.zoom > 10) camera.zoom = 10;
if (camera.zoom < 1f) {
camera.zoom = 1f;
} else if (camera.zoom > 10) {
camera.zoom = 10;
}
camera.update();
Log.log(Log.DEBUG, "Camera zoom: "+camera.zoom+" Delta: "+i);
Log.log(Log.DEBUG, "Camera zoom: " + camera.zoom + " Delta: " + i);
return true;
}
};
Expand All @@ -101,18 +104,18 @@ public boolean scrolled(int i) {
public Game() {
this(new World(null));
}
public Game(World world){

public Game(World world) {
this.world = world;
world.start();
}

@Override
public void resize(int width, int height){
public void resize(int width, int height) {
camera.setToOrtho(false, width, height);
camera.update();
}

@Override
public void render() {
// Draw
Expand All @@ -132,9 +135,11 @@ public void render() {
// Render only half the elements because the list gets
// modified by another thread? Who cares, it's a simulation
// not some videogame
Log.log(Log.DEBUG, "Failed to complete rendering");
}
}
} catch (ConcurrentModificationException ex) {
Log.log(Log.DEBUG, "Failed to complete rendering");
}
renderer.setColor(0.3f, 0.3f, 0.3f, 1);
// draw borders
Expand Down

0 comments on commit 2d6b895

Please sign in to comment.