running now asteroids.rc on startup and cleanup of debug messages

main
Martin Felis (berta) 2010-04-06 00:12:26 +02:00
parent e7e0b39e82
commit f862a952e5
8 changed files with 19 additions and 14 deletions

10
asteroids.rc Normal file
View File

@ -0,0 +1,10 @@
# controls
bind up +forward
bind left +turnleft
bind right +turnright
bind space attack
# set some game variables
set ship_maxspeed 10
set ship_acceleration 10
set ship_rotationspeed 180

View File

@ -14,7 +14,7 @@ namespace asteroids {
bool AsteroidEntity::CollisionEvent (Engine::EntityBase* entity_state) { bool AsteroidEntity::CollisionEvent (Engine::EntityBase* entity_state) {
GameEntityType other_type = (GameEntityType) entity_state->mType; GameEntityType other_type = (GameEntityType) entity_state->mType;
Engine::LogMessage ("CONTACT OF AN ASTEROID"); Engine::LogDebug ("CONTACT OF AN ASTEROID");
if (other_type == GameEntityTypeRocket) { if (other_type == GameEntityTypeRocket) {
// First remove the rocket // First remove the rocket

View File

@ -11,10 +11,6 @@ int Controller::OnInit (int argc, char *argv[]) {
mBindings[SDLK_h] = "+turnleft"; mBindings[SDLK_h] = "+turnleft";
mBindings[SDLK_g] = "+turnright"; mBindings[SDLK_g] = "+turnright";
mBindings[SDLK_UP] = "+forward";
mBindings[SDLK_LEFT] = "+turnleft";
mBindings[SDLK_RIGHT] = "+turnright";
mBindings[SDLK_SPACE] = "attack"; mBindings[SDLK_SPACE] = "attack";
mBindings[SDLK_F8] = "toggleconsole"; mBindings[SDLK_F8] = "toggleconsole";

View File

@ -146,7 +146,9 @@ void MenuOverlay::DrawGameRunning() {
void MenuOverlay::DrawPlayerDied () { void MenuOverlay::DrawPlayerDied () {
std::ostringstream topbar_stream; std::ostringstream topbar_stream;
topbar_stream << "You died ..."; topbar_stream << "You died ...";
Engine::DrawGLString ( right * 0.5 - 80, bottom * 0.5 - 8, topbar_stream.str().c_str ()); Engine::DrawGLString ( right * 0.5 - 40, bottom * 0.5 - 8 - 32, topbar_stream.str().c_str ());
Engine::DrawGLString ( right * 0.5 - 90, bottom * 0.5 + 8, "Press [Return] to continue.");
} }
void MenuOverlay::DrawGameOverScreen() { void MenuOverlay::DrawGameOverScreen() {

View File

@ -85,9 +85,8 @@ int Model::DoLoadLevel (const char* filename) {
while (level_file >> entity_type_str) { while (level_file >> entity_type_str) {
if (entity_type_str[0] == '#') { if (entity_type_str[0] == '#') {
std::cout << "Read Comment: " << entity_type_str;
getline (level_file, entity_type_str); getline (level_file, entity_type_str);
std::cout << entity_type_str << std::endl; Engine::LogDebug ("Read Comment: %s", entity_type_str.c_str());
continue; continue;
} }

View File

@ -99,8 +99,6 @@ void ShipEntity::Attack () {
if (!mAlive) if (!mAlive)
return; return;
Engine::LogMessage ("ATTACK");
Engine::EntityPhysicState* entity_physic = Engine::GetEntityPhysicState (mId); Engine::EntityPhysicState* entity_physic = Engine::GetEntityPhysicState (mId);
vector3d attack_dir (1., 0., 0.); vector3d attack_dir (1., 0., 0.);

View File

@ -82,7 +82,7 @@ bool View::AccelerateEventHandler::HandleEvent (const Engine::EventBasePtr &even
if (event->mEventType == EventAccelerateStart) if (event->mEventType == EventAccelerateStart)
mView->mShipThrustSprite.ResetAnimation(); mView->mShipThrustSprite.ResetAnimation();
Engine::LogMessage ("Received Acceleration Event: %d", event->mEventType); Engine::LogDebug ("Received Acceleration Event: %d", event->mEventType);
return true; return true;
} }
@ -108,7 +108,7 @@ bool View::ShipExplodeEventHandler::HandleEvent (const Engine::EventBasePtr &eve
} }
} }
Engine::LogMessage ("Received Ship Explode Event: %d", event->mEventType); Engine::LogDebug ("Received Ship Explode Event: %d", event->mEventType);
return true; return true;
} }

View File

@ -22,7 +22,7 @@ int main (int argc, char* argv[]) {
engine.SetPhysics (new asteroids::Physics); engine.SetPhysics (new asteroids::Physics);
engine.SetView (new asteroids::View); engine.SetView (new asteroids::View);
SetLogPrintLevel (Engine::LogLevelDebug); SetLogPrintLevel (Engine::LogLevelMessage);
if (engine.Init (argc, argv) != 0) { if (engine.Init (argc, argv) != 0) {
cout << "Could not start engine!" << endl; cout << "Could not start engine!" << endl;
@ -32,7 +32,7 @@ int main (int argc, char* argv[]) {
engine.GetView()->SetGridSize (8,8); engine.GetView()->SetGridSize (8,8);
dynamic_cast<asteroids::Physics*>(engine.GetPhysics())->SetWorldSize (28, 20); dynamic_cast<asteroids::Physics*>(engine.GetPhysics())->SetWorldSize (28, 20);
SetLogPrintLevel (Engine::LogLevelDebug); Engine::RunCommand ("exec asteroids.rc");
engine.MainLoop (); engine.MainLoop ();