return true;
}
private void RenderLoop() {
BufferStrategy Strategy = getBufferStrategy();
final double RotXDegF = ((Math.PI / 180) * 2);
final double RotYDegF = ((Math.PI / 180) * 1);
final float RotXSin = (float) Math.sin(RotXDegF);
final float RotXCos = (float) Math.cos(RotXDegF);
final float RotYSin = (float) Math.sin(RotYDegF);
final float RotYCos = (float) Math.cos(RotYDegF);
final float RotLXSin = (float) Math.sin(-2 * RotXDegF);
final float RotLXCos = (float) Math.cos(-2 * RotXDegF);
final float RotLYSin = (float) Math.sin(3 * RotYDegF);
final float RotLYCos = (float) Math.cos(3 * RotYDegF);
long FPSTimer = System.currentTimeMillis();
long FrameStartTime;
int FramesPerSec = 0;
System.out.println("\n\n");
for (;;) {
FrameStartTime = System.currentTimeMillis();
if (FrameStartTime >= (FPSTimer + 1000)) {
FPSTimer = FrameStartTime;
System.out.print("\rFrames per second: " + FramesPerSec
+ " ");
FramesPerSec = 0;
}
FramesPerSec++;
for (int i = (Shapes.length - 1); i >= 0; --i) {
Shapes[i].RotatePointsX(RotXSin, RotXCos);
Shapes[i].RotatePointsY(RotYSin, RotYCos);
}
Lights[0].GetLocation().RotateX(RotLXSin, RotLXCos);
Lights[0].GetLocation().RotateY(RotLYSin, RotLYCos);
Lights[1].GetLocation().RotateX(RotLXSin, RotLXCos);
Arrays.sort(Shapes);
RenderGraphics2D.setColor(ScreenTrans.SCREEN_BGCOLOR);
RenderGraphics2D.fillRect(0, 0, ScreenTrans.SCREEN_WIDTH,
ScreenTrans.SCREEN_HEIGHT);
for (int i = (Shapes.length - 1); i >= 0; --i) {
Shapes[i].DrawShape(RenderGraphics2D, Lights);
}
LightManager.DrawLights(RenderGraphics2D, Lights);
Graphics Screen = Strategy.getDrawGraphics();
try {
Screen.drawImage(RenderImage, 0, 0, null);
} finally {
Screen.dispose();
}
Strategy.show();
int FrameRenderTime = (int) (System.currentTimeMillis() - FrameStartTime);
if (FrameRenderTime < 30) {
try {