Firstly, these are "only" warnings. This is legal C++, and will compile and run. A warning means that the compiler has identified something unusual, that might lead to problems, or lead to the program doing something that you don't expect, or else something that might indicate you've made a mistake.
While you can ignore warnings, it's generally a good idea to understand them, examine the code that's causing them, and fix them where possible.
I'm not familiar with C:B, but a quick Google search (which you could have done yourself, trivially) tells me that the compiler is warning you that there are some possible values of the enum that aren't handled by cases in your switch statement. So, for example,
event.type can take values other than
Closed or
KeyReleased, and if it does have one of those other values, then it won't trigger any of the cases in your switch problem.
This is perfectly legal, but it's the sort of thing that can sometimes mean that the developer has accidentally forgotten to write a case handling a possible value, so the compiler writers thought it would be helpful to warn you when it happens.
Some developers would say that if this is what you genuinely want to happen, then it would be good style to add a default block that does nothing, e.g.
20 21 22 23 24 25 26 27 28 29 30 31
|
// Close window : exit
switch(event.type){
case sf::Event::Closed: window.close();break;
case sf::Event::KeyReleased:
switch(event.key.code){
// ...
}
break;
}
default:
// Do nothing for other event types
break;
|
Your code then documents that the missing case statements are not accidental, but that you intended it to work this way.