From 2011cca37acc6164cf9fda85d8beec9f82ac07c8 Mon Sep 17 00:00:00 2001 From: BynaryCobweb Date: Mon, 12 Dec 2016 19:38:18 +0100 Subject: [PATCH] Ajout de l'aide sur les commandes de l'affichage --- simulation/main.cpp | 25 +++++++++++++++++++-- simulation/rendering/RenderableTrajectory.h | 2 +- simulation/utils.h | 4 ++-- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/simulation/main.cpp b/simulation/main.cpp index 1754b90..a252a7a 100644 --- a/simulation/main.cpp +++ b/simulation/main.cpp @@ -123,7 +123,7 @@ void printHelp() { << "Usage : \n\tsimulation [arguments...]" << std::endl << std::endl << "Commandes disponibles : " << std::endl; - printCommandDict(commands, COMMAND_COUNT, HELP_COMMAND_SIZE); + printCommandDict(commands, COMMAND_COUNT, ':', HELP_COMMAND_SIZE); std::cout << std::endl; } @@ -382,10 +382,31 @@ void input(GLFWwindow * window) { } } -#define KEY_COMMAND_COUNT +#define KEY_COMMAND_COUNT 15 +#define KEY_COMMAND_SIZE 20 void printKeys() { std::cout << "\nCommandes de la caméra : " << std::endl; + + std::string commands[KEY_COMMAND_COUNT][2] = { + {"Enter", "Affiche ce message"}, + {"Ctrl+Shift+Enter", "Réinitialise la simulation courante"}, + {"Tab", "Passer à la simulation suivante"}, + {"Shift+Tab", "Passer à la simulation précédente"}, + {"Ctrl+Q", "Quitter l'application"}, + {"Space", "Met en pause ou relance la simulation"}, + {"B", "Change l'écoulement du temps du futur vers le passé."}, + {"F", "Rétablit l'équilibre temporel"}, + {"+", "Accélère la simulation"}, + {"-", "Ralentit la simulation"}, + {"P", "Fait disparaître / réapparaitre les astres"}, + {"T", "Fait disparaître / réapparaitre les trajectoires"}, + {"Ctrl+T", "Réinitialise les trajectoires"}, + {"0", "Met la caméra en vue de dessus"}, + {"[1-9]", "Centre la caméra sur la planète portant le numéro indiqué"} + }; + + printCommandDict(commands, KEY_COMMAND_COUNT, ':', KEY_COMMAND_SIZE); } void glfwKeyCallback(GLFWwindow *window, int key, int scancode, int action, int mods) { diff --git a/simulation/rendering/RenderableTrajectory.h b/simulation/rendering/RenderableTrajectory.h index ff0c2a1..20a1472 100644 --- a/simulation/rendering/RenderableTrajectory.h +++ b/simulation/rendering/RenderableTrajectory.h @@ -13,7 +13,7 @@ class RenderableTrajectory : public Renderable { public : -RenderableTrajectory(int maxPointCount = DEFAULT_MAX_POINT_COUNT); + RenderableTrajectory(int maxPointCount = DEFAULT_MAX_POINT_COUNT); void setColor(float r, float g, float b); glm::vec3 getColor() { diff --git a/simulation/utils.h b/simulation/utils.h index 02123d9..fc487ca 100644 --- a/simulation/utils.h +++ b/simulation/utils.h @@ -64,7 +64,7 @@ inline glm::vec3 randBrightColor() { return glm::vec3(r, g, b); } -inline void printCommandDict(std::string commands[][2], int commandCount, +inline void printCommandDict(std::string commands[][2], int commandCount, char delimiter = ':', int commandSize = 20, int descriptionSize = 200) { for (int i = 0 ; i < commandCount ; i++) { @@ -78,7 +78,7 @@ inline void printCommandDict(std::string commands[][2], int commandCount, std::string spaces(numSpaces, ' '); //TODO descriptionSize - std::cout << "\t" << command << spaces << ": " << description << std::endl; + std::cout << "\t" << command << spaces << delimiter << " " << description << std::endl; } }