inventoryMenuProperties.charsPerEntry = 13;
inventoryMenuProperties.rowGap = 8;
inventoryMenuProperties.cursor = &menuCursor;
- itemMenuProperties.selectedCursor = &menuActiveCursor;
+ inventoryMenuProperties.selectedCursor = &menuActiveCursor;
inventoryMenuProperties.font = &menuFont;
// TODO: disabled font
inventoryMenuProperties.disabledFont = &menuFont;
using geometry::Vector;
using graphics::Font;
using graphics::Frame;
+using std::swap;
namespace menu {
menu.SetSelected();
itemMenu.SetActive();
}
+ } else if (itemMenu.IsActive()) {
+ itemMenu.SetDualSelection();
+ } else if (itemMenu.SelectedIndex() == itemMenu.SecondaryIndex()) {
+ switch (menu.Selected()) {
+ case CHOICE_USE:
+ // TODO: implement item use
+ break;
+ case CHOICE_SORT:
+ // invalid state, recover
+ menu.SetActive();
+ itemMenu.SetInactive();
+ break;
+ case CHOICE_DROP:
+ // TODO: implement item drop
+ break;
+ }
+ } else {
+ parent->Game().state->inventory.SwapEntriesAt(
+ itemMenu.SelectedIndex(),
+ itemMenu.SecondaryIndex());
+ itemMenu.SwapSelected();
+ itemMenu.SetActive();
}
}
if (input.JustPressed(Input::ACTION_B)) {
if (menu.IsActive()) {
Ctrl().PopState();
- } else {
+ } else if (itemMenu.IsActive()) {
menu.SetActive();
itemMenu.SetInactive();
+ } else {
+ itemMenu.SetActive();
}
}
}