diff --git a/asteroids/Model.cc b/asteroids/Model.cc index 8cec6b1..4864ad3 100644 --- a/asteroids/Model.cc +++ b/asteroids/Model.cc @@ -57,7 +57,7 @@ int Model::OnInit (int argc, char* argv[]) { // Reset the newest highscore entry index which may be used for highlighting // the newest entry. - mNewestHighscoreEntryIndex = 99999; + mNewestHighscoreEntryIndex = std::numeric_limits::max(); // initialize event handlers and register them Engine::RegisterListener (this, EventGameOver); diff --git a/asteroids/View.cc b/asteroids/View.cc index f3d6ae5..09141a0 100644 --- a/asteroids/View.cc +++ b/asteroids/View.cc @@ -49,9 +49,9 @@ int View::OnInit (int argc, char* argv[]) { int i; for (i = 0; i < 200; i++) { BackgroundStar star; - star.position[0] = rand() / float(RAND_MAX); - star.position[1] = rand() / float(RAND_MAX); - star.position[2] = rand() / float(RAND_MAX); + star.position[0] = rand() / float(RAND_MAX) * 1.2; + star.position[1] = rand() / float(RAND_MAX) * 1.2; + star.position[2] = rand() / float(RAND_MAX) * 1.2; mBackgroundStars.push_back (star); } @@ -211,10 +211,12 @@ void View::DrawStars() { mBackgroundStars.at(i).position -= vector3d(Engine::GetFrameDuration() * 0.7 * mBackgroundStars.at(i).position[1] / world_width, 0., 0.); - if (mBackgroundStars.at(i).position[0] < 0.) - mBackgroundStars.at(i).position[0] += 1.; - if (mBackgroundStars.at(i).position[0] >= 1.) - mBackgroundStars.at(i).position[0] -= 1.; + // we move the stars a little more such that they are not blende out too early + // \todo compute proper bounds from Physics world size! + if (mBackgroundStars.at(i).position[0] < -0.1) + mBackgroundStars.at(i).position[0] += 1.2; + if (mBackgroundStars.at(i).position[0] >= 1.1) + mBackgroundStars.at(i).position[0] -= 1.2; } glEnd(); diff --git a/asteroids/main.cc b/asteroids/main.cc index f5facf3..028bbd6 100644 --- a/asteroids/main.cc +++ b/asteroids/main.cc @@ -51,7 +51,7 @@ int main (int argc, char* argv[]) { SDL_WM_SetCaption("Asteroids -BETA1-","Asteroids -BETA 1-"); engine.GetView()->SetGridSize (8,8); - dynamic_cast(engine.GetPhysics())->SetWorldSize (28, 20); + dynamic_cast(engine.GetPhysics())->SetWorldSize (26, 20); // run the default commands and load the configuration Engine::RunCommand ("exec asteroids.rc");