Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Bycob committed Dec 12, 2016
2 parents 3642f72 + 180d4ea commit 9b3c5f7
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
25 changes: 23 additions & 2 deletions simulation/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,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;
}

Expand Down Expand Up @@ -418,10 +418,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) {
Expand Down
2 changes: 1 addition & 1 deletion simulation/rendering/RenderableTrajectory.h
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions simulation/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand All @@ -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;
}
}

Expand Down

0 comments on commit 9b3c5f7

Please sign in to comment.