Skip to content

Commit

Permalink
Add function to print the demo keybindings
Browse files Browse the repository at this point in the history
  • Loading branch information
ll-nick committed Nov 15, 2024
1 parent 58c1ff0 commit 838b797
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions demo/include/utils/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ int dotsInRadius(const Position& center,
const demo::EnvironmentModel::ConstPtr& environmentModel,
int pathEndNeighborhoodRadius);

void printKeybindings();

} // namespace utils
3 changes: 3 additions & 0 deletions demo/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@
#include "demo/pacman_agent.hpp"
#include "demo/types.hpp"
#include "utils/pacman_wrapper.hpp"
#include "utils/utils.hpp"

using namespace demo;
using namespace utils;
using namespace arbitration_graphs;

int main() {
try {
printKeybindings();

PacmanWrapper demo;
PacmanAgent agent(demo.game());

Expand Down
14 changes: 14 additions & 0 deletions demo/src/utils.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include <iostream>

#include "utils/utils.hpp"

namespace utils {
Expand Down Expand Up @@ -31,4 +33,16 @@ int dotsInRadius(const Position& center,
return nDots;
}

void printKeybindings() {
std::cout << "\n"
<< "\033[1;36m=====================================\033[0m\n"
<< "\033[1;37m CONTROLS \033[0m\n"
<< "\033[1;36m=====================================\033[0m\n"
<< " \033[1;32mESC/Q\033[0m - Quit the demo\n"
<< " \033[1;32mSpace\033[0m - Pause the demo\n"
<< " \033[1;32mP\033[0m - Toggle path visualization\n"
<< "\033[1;36m=====================================\033[0m\n"
<< '\n';
}

} // namespace utils

0 comments on commit 838b797

Please sign in to comment.