10 #include <game_manager/level/level.hpp> 
   13 #include <ST_util/string_util.hpp> 
   22     gMessage_bus = msg_bus;
 
   31     if (load_input_conf() != 0) {
 
   35     for (
const auto &i: actions_buttons) {
 
   36         for (
const auto &key: i.second) {
 
   37             if (key != ST::key::UNKNOWN) {
 
   38                 gMessage_bus->send_msg(
new message(REGISTER_KEY, 
static_cast<uint8_t
>(key), 
nullptr));
 
   42     std::string temp = 
"game/levels/" + name + 
"/assets.list";
 
   43     gMessage_bus->send_msg(
new message(LOAD_LIST, make_data(temp)));
 
   51     std::string temp = 
"game/levels/" + name + 
"/assets.list";
 
   52     gMessage_bus->send_msg(
new message(UNLOAD_LIST, make_data(temp)));
 
   53     for (
const auto &i: actions_buttons) {
 
   54         for (
const auto &key: i.second) {
 
   55             if (key != ST::key::UNKNOWN) {
 
   56                 gMessage_bus->send_msg(
new message(UNREGISTER_KEY, 
static_cast<uint8_t
>(key), 
nullptr));
 
   60     actions_buttons.clear();
 
   61     gMessage_bus->send_msg(
new message(LOAD_LIST, make_data(temp)));
 
   63     for (
const auto &i: actions_buttons) {
 
   64         for (
const auto &key: i.second) {
 
   65             if (key != ST::key::UNKNOWN) {
 
   66                 gMessage_bus->send_msg(
new message(REGISTER_KEY, 
static_cast<uint8_t
>(key), 
nullptr));
 
   86     actions_buttons.clear();
 
  103     for (
const auto &i: actions_buttons) {
 
  104         for (
const auto &key: i.second) {
 
  105             if (key != ST::key::UNKNOWN) {
 
  106                 gMessage_bus->send_msg(
new message(UNREGISTER_KEY, 
static_cast<uint8_t
>(key), 
nullptr));
 
  111     std::string temp = 
"game/levels/" + name + 
"/assets.list";
 
  112     gMessage_bus->send_msg(
new message(UNLOAD_LIST, make_data(temp)));
 
  115     actions_buttons.clear();
 
  121     text_objects.clear();
 
  134     std::string temp = 
"game/levels/" + name + 
"/inputConf.cfg";
 
  135     file.open(temp.c_str());
 
  136     if (file.is_open()) {
 
  137         gMessage_bus->send_msg(
new message(LOG_INFO, make_data<std::string>(
"Loading " + temp)));
 
  141         while (!file.eof()) {
 
  142             auto a = 
static_cast<char>(file.get());
 
  146                     a = 
static_cast<char>(file.get());;
 
  148             } 
else if (a == 
'=') {
 
  150             } 
else if (actionRead == 0 && a == 
'\n') { 
 
  152             } 
else if (actionRead == 0) {
 
  154             } 
else if (a == 
'\n' || file.eof()) {
 
  155                 std::istringstream buf(button);
 
  156                 std::istream_iterator<std::string> beg(buf), end;
 
  157                 std::vector<std::string> tokens(beg, end);
 
  158                 actions_buttons.emplace(ST::hash_string(action), std::vector<ST::key>());
 
  159                 std::vector<ST::key> *buttons_for_action = &actions_buttons.at(ST::hash_string(action));
 
  160                 for (
const auto &token: tokens) {
 
  161                     buttons_for_action->emplace_back(key_index(token));
 
  172         gMessage_bus->send_msg(
new message(LOG_ERROR, make_data<std::string>(
"File " + temp + 
" not found")));
 
  183 ST::key ST::level::key_index(
const std::string &arg) {
 
  184     key index = key::UNKNOWN;
 
  187     } 
else if (arg == 
"right") {
 
  189     } 
else if (arg == 
"up") {
 
  191     } 
else if (arg == 
"down") {
 
  193     } 
else if (arg == 
"a") {
 
  195     } 
else if (arg == 
"b") {
 
  197     } 
else if (arg == 
"c") {
 
  199     } 
else if (arg == 
"d") {
 
  201     } 
else if (arg == 
"e") {
 
  203     } 
else if (arg == 
"f") {
 
  205     } 
else if (arg == 
"g") {
 
  207     } 
else if (arg == 
"h") {
 
  209     } 
else if (arg == 
"i") {
 
  211     } 
else if (arg == 
"j") {
 
  213     } 
else if (arg == 
"k") {
 
  215     } 
else if (arg == 
"l") {
 
  217     } 
else if (arg == 
"m") {
 
  219     } 
else if (arg == 
"n") {
 
  221     } 
else if (arg == 
"o") {
 
  223     } 
else if (arg == 
"p") {
 
  225     } 
else if (arg == 
"q") {
 
  227     } 
else if (arg == 
"r") {
 
  229     } 
else if (arg == 
"s") {
 
  231     } 
else if (arg == 
"t") {
 
  233     } 
else if (arg == 
"u") {
 
  235     } 
else if (arg == 
"v") {
 
  237     } 
else if (arg == 
"w") {
 
  239     } 
else if (arg == 
"x") {
 
  241     } 
else if (arg == 
"y") {
 
  243     } 
else if (arg == 
"z") {
 
  245     } 
else if (arg == 
"1") {
 
  247     } 
else if (arg == 
"2") {
 
  249     } 
else if (arg == 
"3") {
 
  251     } 
else if (arg == 
"4") {
 
  253     } 
else if (arg == 
"5") {
 
  255     } 
else if (arg == 
"6") {
 
  257     } 
else if (arg == 
"7") {
 
  259     } 
else if (arg == 
"8") {
 
  261     } 
else if (arg == 
"9") {
 
  263     } 
else if (arg == 
"0") {
 
  265     } 
else if (arg == 
"escape") {
 
  267     } 
else if (arg == 
"enter") {
 
  269     } 
else if (arg == 
"spacebar") {
 
  270         index = key::SPACEBAR;
 
  271     } 
else if (arg == 
"tilde") {
 
  273     } 
else if (arg == 
"lshift") {
 
  275     } 
else if (arg == 
"backspace") {
 
  276         index = key::BACKSPACE;
 
  277     } 
else if (arg == 
"backslash") {
 
  278         index = key::BACKSLASH;
 
  279     } 
else if (arg == 
"capslock") {
 
  280         index = key::CAPSLOCK;
 
  281     } 
else if (arg == 
"comma") {
 
  283     } 
else if (arg == 
"equals") {
 
  285     } 
else if (arg == 
"lalt") {
 
  287     } 
else if (arg == 
"lctrl") {
 
  289     } 
else if (arg == 
"lbracket") {
 
  290         index = key::LBRACKET;
 
  291     } 
else if (arg == 
"rbracket") {
 
  292         index = key::RBRACKET;
 
  293     } 
else if (arg == 
"minus") {
 
  295     } 
else if (arg == 
"delete") {
 
  297     } 
else if (arg == 
"ralt") {
 
  299     } 
else if (arg == 
"rctrl") {
 
  301     } 
else if (arg == 
"semicolon") {
 
  302         index = key::SEMICOLON;
 
  303     } 
else if (arg == 
"slash") {
 
  305     } 
else if (arg == 
"tab") {
 
  307     } 
else if (arg == 
"mouseLeft") {
 
  308         index = key::MOUSELEFT;
 
  309     } 
else if (arg == 
"mouseMiddle") {
 
  310         index = key::MOUSEMIDDLE;
 
  311     } 
else if (arg == 
"mouseRight") {
 
  312         index = key::MOUSERIGHT;
 
  313     } 
else if (arg == 
"controllerA") {
 
  314         index = key::CONTROLLER_BUTTON_A;
 
  315     } 
else if (arg == 
"controllerB") {
 
  316         index = key::CONTROLLER_BUTTON_B;
 
  317     } 
else if (arg == 
"controllerX") {
 
  318         index = key::CONTROLLER_BUTTON_X;
 
  319     } 
else if (arg == 
"controllerY") {
 
  320         index = key::CONTROLLER_BUTTON_Y;
 
  321     } 
else if (arg == 
"controllerSelect") {
 
  322         index = key::CONTROLLER_BUTTON_SELECT;
 
  323     } 
else if (arg == 
"controllerStart") {
 
  324         index = key::CONTROLLER_BUTTON_START;
 
  325     } 
else if (arg == 
"controllerLeftStick") {
 
  326         index = key::CONTROLLER_BUTTON_LEFTSTICK;
 
  327     } 
else if (arg == 
"controllerRightStick") {
 
  328         index = key::CONTROLLER_BUTTON_RIGHTSTICK;
 
  329     } 
else if (arg == 
"controllerLeftShoulder") {
 
  330         index = key::CONTROLLER_BUTTON_LEFTSHOULDER;
 
  331     } 
else if (arg == 
"controllerRightShoulder") {
 
  332         index = key::CONTROLLER_BUTTON_RIGHTSHOULDER;
 
  333     } 
else if (arg == 
"controllerDpadUp") {
 
  334         index = key::CONTROLLER_BUTTON_DPAD_UP;
 
  335     } 
else if (arg == 
"controllerDpadDown") {
 
  336         index = key::CONTROLLER_BUTTON_DPAD_DOWN;
 
  337     } 
else if (arg == 
"controllerDpadLeft") {
 
  338         index = key::CONTROLLER_BUTTON_DPAD_LEFT;
 
  339     } 
else if (arg == 
"controllerDpadRight") {
 
  340         index = key::CONTROLLER_BUTTON_DPAD_RIGHT;
 
  341     } 
else if (arg == 
"controllerRightTrigger") {
 
  342         index = key::CONTROLLER_BUTTON_RIGHT_TRIGGER;
 
  343     } 
else if (arg == 
"controllerLeftTrigger") {
 
  344         index = key::CONTROLLER_BUTTON_LEFT_TRIGGER;
 
std::string get_name() const
 
level(const std::string &, message_bus *)
 
The central messaging system of the engine. All subsystem make extensive use of it.
 
A message object passed around in the message bus. Holds anything created with make_data<>().