-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
Milestone
Description
Here is a small code that show what currently happens :
#include <SFML/Window.hpp>
#include <iostream>
#include <clocale>
int main(int argc, char** argv) {
std::setlocale(LC_ALL, "en_US.UTF-8");
sf::Window wnd(sf::VideoMode(100, 100), "test window");
while (wnd.isOpen()) {
sf::Event event;
while (wnd.pollEvent(event)) {
if (event.type == sf::Event::KeyPressed)
std::wcout << "[KeyPressed] key code: " << event.key.code << std::endl;
else if (event.type == sf::Event::KeyReleased)
std::wcout << "[KeyReleased] key code: " << event.key.code << std::endl;
else if (event.type == sf::Event::TextEntered)
std::wcout << "[TextEntered] unicode: " << event.text.unicode <<
"\tcharacter: " << static_cast<wchar_t>(event.text.unicode) << std::endl;
else if (event.type == sf::Event::Closed)
wnd.close();
}
wnd.display();
}
}Here are two outputs (from two different keyboard layouts) and their corresponding expected output.
A
current output
[KeyPressed] key code: 43
[KeyPressed] key code: 55
[KeyReleased] key code: 55
[KeyReleased] key code: 43
[KeyPressed] key code: 4
[TextEntered] unicode: 101 character: e
[KeyReleased] key code: 4
expected output
[KeyPressed] key code: 43
[KeyPressed] key code: 55
[KeyReleased] key code: 55
[KeyReleased] key code: 43
[KeyPressed] key code: 4
[TextEntered] unicode: 233 character: é
[KeyReleased] key code: 4
B
current output
[KeyPressed] key code: 55
[KeyReleased] key code: 55
[KeyPressed] key code: 4
[TextEntered] unicode: 101 character: 'e'
[KeyReleased] key code: 4
expected output
[KeyPressed] key code: 55
[KeyReleased] key code: 55
[KeyPressed] key code: 4
[TextEntered] unicode: 233 character: 'é'
[KeyReleased] key code: 4
(43 is the right alt, 55 is ´ and 4 is e)