From 47ed4bed2e8e9848b944e593387d312a422b9e0a Mon Sep 17 00:00:00 2001
From: Allanis <allanis.saracraft.studios@gmail.com>
Date: Sat, 20 Jan 2018 18:28:37 +0000
Subject: [PATCH] [Add] 'i' to toggle debug info. [Change] esc to close instead
 of 'q'

---
 README         | 4 ++--
 src/l3d.h      | 1 +
 src/main.cpp   | 6 ++++--
 src/player.cpp | 2 +-
 4 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/README b/README
index 9577f6e..3827069 100644
--- a/README
+++ b/README
@@ -42,7 +42,7 @@ External View:
 Special:
 ~~~~~~~~
 
-q - quit.
-i - show some ugly debug info.
+ESC - quit.
+i   - show some ugly debug info.
 
 
diff --git a/src/l3d.h b/src/l3d.h
index 742b91b..6f34726 100644
--- a/src/l3d.h
+++ b/src/l3d.h
@@ -73,6 +73,7 @@ public:
   static View* GetView(void)            { return currentView; }
   static StarSystem* GetSelectedSystem(void);
 
+  static bool               showDebugInfo;
   static int                playerLocSecX;
   static int                playerLocSecY;
   static int                playerLocSysIdx;
diff --git a/src/main.cpp b/src/main.cpp
index eb4d31d..30859d1 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -51,6 +51,7 @@ GLUquadric*       L3D::gluQuadric;
 int               L3D::playerLocSecX;
 int               L3D::playerLocSecY;
 int               L3D::playerLocSysIdx;
+bool              L3D::showDebugInfo;
 
 void L3D::Init(IniConfig& config) {
   int width  = config.Int("ScrWidth");
@@ -156,7 +157,8 @@ void L3D::HandleEvents(void) {
     Gui::HandleSDLEvent(&event);
     switch(event.type) {
     case SDL_KEYDOWN:
-      if(event.key.keysym.sym == SDLK_q) L3D::Quit();
+      if(event.key.keysym.sym == SDLK_ESCAPE) L3D::Quit();
+      if(event.key.keysym.sym == SDLK_i) L3D::showDebugInfo = !L3D::showDebugInfo;
 #ifdef DEBUG
       if(event.key.keysym.sym == SDLK_F12) {
         /* Add test object. */
@@ -284,7 +286,7 @@ void L3D::MainLoop(void) {
 
     Gui::Draw();
 #ifdef DEBUG
-    {
+    if(L3D::showDebugInfo) {
       Gui::Screen::EnterOrtho();
       glColor3f(1, 1, 1);
       glTranslatef(0, Gui::Screen::GetHeight()-20, 0);
diff --git a/src/player.cpp b/src/player.cpp
index fa5f0d4..61164f0 100644
--- a/src/player.cpp
+++ b/src/player.cpp
@@ -234,7 +234,7 @@ void Player::DrawHUD(const Frame* cam_frame) {
     glEnd();
   }
 
-  {
+  if(L3D::showDebugInfo) {
     char buf[1024];
     glPushMatrix();
     glTranslatef(0, 440, 0);