Update olcPGEX_PopUpMenu.h

pull/113/head
Javidx9 5 years ago committed by GitHub
parent 4750278b31
commit 1201f569e7
  1. 18
      Extensions/olcPGEX_PopUpMenu.h

@ -56,7 +56,7 @@
Author Author
~~~~~~ ~~~~~~
David Barr, aka javidx9, ©OneLoneCoder 2019, 2020 David Barr, aka javidx9, ©OneLoneCoder 2019, 2020
*/ */
@ -131,17 +131,17 @@
~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~
// Send key events to menu // Send key events to menu
if (GetKey(olc::Key::UP).bPressed) mm.OnUp(); if (GetKey(olc::Key::UP).bPressed) man.OnUp();
if (GetKey(olc::Key::DOWN).bPressed) mm.OnDown(); if (GetKey(olc::Key::DOWN).bPressed) man.OnDown();
if (GetKey(olc::Key::LEFT).bPressed) mm.OnLeft(); if (GetKey(olc::Key::LEFT).bPressed) man.OnLeft();
if (GetKey(olc::Key::RIGHT).bPressed) mm.OnRight(); if (GetKey(olc::Key::RIGHT).bPressed) man.OnRight();
if (GetKey(olc::Key::Z).bPressed) mm.OnBack(); if (GetKey(olc::Key::Z).bPressed) man.OnBack();
// "Confirm/Action" Key does something, if it returns non-null // "Confirm/Action" Key does something, if it returns non-null
// then a menu item has been selected. The specific item will // then a menu item has been selected. The specific item will
// be returned // be returned
olc::popup::Menu* command = nullptr; olc::popup::Menu* command = nullptr;
if (GetKey(olc::Key::SPACE).bPressed) command = mm.OnConfirm(); if (GetKey(olc::Key::SPACE).bPressed) command = man.OnConfirm();
if (command != nullptr) if (command != nullptr)
{ {
std::string sLastAction = std::string sLastAction =
@ -149,7 +149,7 @@
" ID: " + std::to_string(command->GetID()); " ID: " + std::to_string(command->GetID());
// Optionally close menu? // Optionally close menu?
mm.Close(); man.Close();
} }
*/ */
@ -582,4 +582,4 @@ namespace olc
#endif #endif
#endif #endif

Loading…
Cancel
Save