void PlayerController::ProcessEvent(sf::Event event) { switch (event.type) { case sf::Event::MouseButtonPressed: if (event.mouseButton.button == sf::Mouse::Left) { left_down_ = true; } else if (event.mouseButton.button == sf::Mouse::Right) { right_down_ = true; } break; case sf::Event::MouseButtonReleased: if (event.mouseButton.button == sf::Mouse::Left) { left_down_ = false; } else if (event.mouseButton.button == sf::Mouse::Right) { right_down_ = false; } break; case sf::Event::MouseMoved: mouse_x_ = event.mouseMove.x; mouse_y_ = event.mouseMove.y; break; case sf::Event::KeyPressed: printf("key down: %d / %c\n", event.key.code, CodeToChar(event.key.code)); break; case sf::Event::KeyReleased: printf("key up: %d / %c\n", event.key.code, CodeToChar(event.key.code)); break; default: break; } }
// Convert first UTF-8 symbol of "src" into ASCII-7 character. // "ascii_table" specifies whether to use ASCII-7 translation tables. // Length of the retrieved UTF-8 symbol is returned in "*seq_len" // (if "seq_len" is not NULL). // Return resulting ASCII-7 character. // NOTE: If the UTF-8 symbol has no ASCII-7 equivalent, then return // kOutrangeChar or hSkipChar. // char StringToChar(const string& src, size_t* seq_len, bool ascii_table, EConversionStatus* status) { long dst_code; // UTF-code symbol code unsigned char dst_char; // Result character EConversionStatus stat; // Temporary status // Process one UTF character dst_code = StringToCode(src, seq_len, &stat); if (status) *status = stat; // If it was happily if (stat == eSuccess) { // Conversion if (ascii_table) { // Convert into appropriate 7-bit character via conversion table dst_char = CodeToChar(dst_code, status); return dst_char; } else { // if character greater than 127 (0x7F) than substitute it // with kOutrangeChar, else leave it as is. if (dst_code > 0x7F) { RETURN_S (kOutrangeChar, eOutrangeChar); } } } // Was error translate char return (char)dst_code; }