Progress on game screen and circular visualizer
This commit is contained in:
@@ -99,10 +99,12 @@ public class RhythmBullet extends Game {
|
||||
|
||||
queueAssets();
|
||||
setScreen(initialScreen);
|
||||
|
||||
System.out.println("pixels per unit: " + pixels_per_unit);
|
||||
|
||||
screenWidth = Gdx.graphics.getWidth();
|
||||
screenHeight = Gdx.graphics.getHeight();
|
||||
}
|
||||
|
||||
public void checkAssetQueue() {
|
||||
if (!initComplete) {
|
||||
if (assetManager.update()) {
|
||||
@@ -168,7 +170,8 @@ public class RhythmBullet extends Game {
|
||||
screenWidth = Gdx.graphics.getWidth();
|
||||
screenHeight = Gdx.graphics.getHeight();
|
||||
|
||||
pixels_per_unit = screenHeight/WORLD_HEIGHT;
|
||||
pixels_per_unit = (int) (screenHeight/Float.valueOf(WORLD_HEIGHT));
|
||||
System.out.println("pixels per unit: " + pixels_per_unit);
|
||||
|
||||
if (initComplete) {
|
||||
Gdx.app.debug("Resize", "Pre-transition is happening. Using resolution " + width + "x" + height);
|
||||
|
@@ -1,75 +0,0 @@
|
||||
package zero1hd.rhythmbullet.graphics.meshes;
|
||||
|
||||
import zero1hd.rhythmbullet.RhythmBullet;
|
||||
|
||||
public class CircularVisualizerMesh {
|
||||
private int x, y;
|
||||
private int componentCount = 2 + 4;
|
||||
private float[] verts;
|
||||
|
||||
public CircularVisualizerMesh() {
|
||||
}
|
||||
|
||||
public void applyPositionChanges() {
|
||||
verts = new float[calculateVertices(x, y, RhythmBullet.pixels_per_unit) * componentCount];
|
||||
}
|
||||
|
||||
private void createCircleVertices(int centerX, int centerY, int radius) {
|
||||
int x = radius - 1;
|
||||
int y = 0;
|
||||
int dx = 1;
|
||||
int dy = 1;
|
||||
int err = dx - (radius << 1);
|
||||
|
||||
while (x >= y)
|
||||
{
|
||||
putVertex(centerX + x, centerY + y);
|
||||
putVertex(centerX + y, centerY + x);
|
||||
putVertex(centerX - y, centerY + x);
|
||||
putVertex(centerX - x, centerY + y);
|
||||
putVertex(centerX - x, centerY - y);
|
||||
putVertex(centerX - y, centerY - x);
|
||||
putVertex(centerX + y, centerY - x);
|
||||
putVertex(centerX + x, centerY - y);
|
||||
|
||||
if (err <= 0) {
|
||||
y++;
|
||||
err += dy;
|
||||
dy += 2;
|
||||
} else {
|
||||
x--;
|
||||
dx += 2;
|
||||
err += dx - (radius << 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int calculateVertices(int centerX, int centerY, int radius) {
|
||||
int x = radius - 1;
|
||||
int y = 0;
|
||||
int dx = 1;
|
||||
int dy = 1;
|
||||
int err = dx - (radius << 1);
|
||||
int vertCount = 0;
|
||||
while (x >= y)
|
||||
{
|
||||
vertCount += 8;
|
||||
|
||||
if (err <= 0) {
|
||||
y++;
|
||||
err += dy;
|
||||
dy += 2;
|
||||
} else {
|
||||
x--;
|
||||
dx += 2;
|
||||
err += dx - (radius << 1);
|
||||
}
|
||||
}
|
||||
|
||||
return vertCount;
|
||||
}
|
||||
|
||||
private void putVertex(int x, int y) {
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user