In the API documentation of SDL for the Union event it says that the the field type is shared among all the event(objects) in the union,how is this possible?
also for example this is perfectly legal
while(SDL_PollEvent(&event)){
if(event.type == SDL_KEYDOWN){
cout << "key down" << endl;
}
and this is also works which logically makes more sense to me ,but I'm not sure how the first is even legal
while(SDL_PollEvent(&event)){
if(event.key.type == SDL_KEYDOWN){
cout << "key down" << endl;
}