MCPcopy Create free account
hub / github.com/Panzerschrek/Chasm-Reverse / ProcessEvents

Method ProcessEvents

PanzerChasm/menu.cpp:2379–2428  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2377}
2378
2379void Menu::ProcessEvents( const SystemEvents& events )
2380{
2381 for( const SystemEvent& event : events )
2382 {
2383 switch( event.type )
2384 {
2385 case SystemEvent::Type::Key:
2386 if(
2387 event.event.key.pressed &&
2388 event.event.key.key_code == KeyCode::Escape )
2389 {
2390 if( current_menu_ != nullptr )
2391 {
2392 current_menu_->PlayMenuSound( Sound::SoundId::MenuOn );
2393 MenuBase* const new_menu= current_menu_->GetParent();
2394 if( new_menu != current_menu_ )
2395 {
2396 if( new_menu != nullptr )
2397 new_menu->OnActivated();
2398 current_menu_= new_menu;
2399 }
2400 }
2401 else
2402 {
2403 current_menu_= root_menu_.get();
2404 current_menu_->PlayMenuSound( Sound::SoundId::MenuOn );
2405 current_menu_->OnActivated();
2406 }
2407 }
2408 break;
2409
2410 case SystemEvent::Type::CharInput: break;
2411 case SystemEvent::Type::MouseKey: break;
2412 case SystemEvent::Type::MouseMove: break;
2413 case SystemEvent::Type::Wheel: break;
2414 case SystemEvent::Type::Quit: break;
2415 };
2416
2417 if( current_menu_ != nullptr )
2418 {
2419 MenuBase* const new_menu= current_menu_->ProcessEvent( event );
2420 if( new_menu != current_menu_ )
2421 {
2422 if( new_menu != nullptr )
2423 new_menu->OnActivated();
2424 current_menu_= new_menu;
2425 }
2426 }
2427 }
2428}
2429
2430void Menu::ProcessEventsWhileNonactive( const SystemEvents& events )
2431{

Callers 1

LoopMethod · 0.45

Calls 4

PlayMenuSoundMethod · 0.80
GetParentMethod · 0.80
OnActivatedMethod · 0.80
ProcessEventMethod · 0.80

Tested by

no test coverage detected