Bonjour,
j'ai trouvé un tuto de sfml:
https://fr.sfml-dev.org/tutorials/2....-events-fr.php
L'auteur y a mit du code qui ne compile pas:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28 #include <iostream> #include <SFML/Window.hpp> int main(){ sf::Window window(sf::VideoMode(200,200),"exemple-event",sf::Style::Default); sf::Event event; while(window.isOpen()) while(window.pollEvent(event)) switch(event.type){ case sf::Event::Closed: window.close(); case sf::Event::KeyPressed: if (event.key.scancode == sf::Keyboard::Scan::Escape){ std::cout << "the escape key was pressed" << std::endl; std::cout << "scancode: " << event.key.scancode << std::endl; std::cout << "code: " << event.key.code << std::endl; std::cout << "control: " << event.key.control << std::endl; std::cout << "alt: " << event.key.alt << std::endl; std::cout << "shift: " << event.key.shift << std::endl; std::cout << "system: " << event.key.system << std::endl; std::cout << "description: " << sf::Keyboard::getDescription(event.key.scancode).toAnsiString() << std::endl; std::cout << "localize: " << sf::Keyboard::localize(event.key.scancode) << std::endl; std::cout << "delocalize: " << sf::Keyboard::delocalize(event.key.code) << std::endl; break; } } return 0; }une idée?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 $ g++ main.cpp -lsfml-window main.cpp: In function int main(): main.cpp:13:23: error: struct sf::Event::KeyEvent has no member named scancode 13 | if (event.key.scancode == sf::Keyboard::Scan::Escape){ | ^~~~~~~~ main.cpp:13:49: error: sf::Keyboard::Scan has not been declared 13 | if (event.key.scancode == sf::Keyboard::Scan::Escape){ | ^~~~ main.cpp:15:50: error: struct sf::Event::KeyEvent has no member named scancode 15 | std::cout << "scancode: " << event.key.scancode << std::endl; | ^~~~~~~~ main.cpp:21:57: error: getDescription is not a member of sf::Keyboard 21 | std::cout << "description: " << sf::Keyboard::getDescription(event.key.scancode).toAnsiString() << std::endl; | ^~~~~~~~~~~~~~ main.cpp:21:82: error: struct sf::Event::KeyEvent has no member named scancode 21 | std::cout << "description: " << sf::Keyboard::getDescription(event.key.scancode).toAnsiString() << std::endl; | ^~~~~~~~ main.cpp:22:54: error: localize is not a member of sf::Keyboard 22 | std::cout << "localize: " << sf::Keyboard::localize(event.key.scancode) << std::endl; | ^~~~~~~~ main.cpp:22:73: error: struct sf::Event::KeyEvent has no member named scancode 22 | std::cout << "localize: " << sf::Keyboard::localize(event.key.scancode) << std::endl; | ^~~~~~~~ main.cpp:23:56: error: delocalize is not a member of sf::Keyboard 23 | std::cout << "delocalize: " << sf::Keyboard::delocalize(event.key.code) << std::endl; | ^~~~~~~~~~
Partager