all repos — mgba @ aae1564db4d257fbd01249a3c020d400a8d36579

mGBA Game Boy Advance Emulator

Qt: Make LoadSaveState row/column manipulation a bit more readable
Jeffrey Pfau jeffrey@endrift.com
Thu, 23 Apr 2015 23:59:44 -0700
commit

aae1564db4d257fbd01249a3c020d400a8d36579

parent

73dd9ed3f8f5db02b18266f1373e15a652165839

1 files changed, 5 insertions(+), 5 deletions(-)

jump to
M src/platform/qt/LoadSaveState.cppsrc/platform/qt/LoadSaveState.cpp

@@ -61,13 +61,13 @@

bool LoadSaveState::eventFilter(QObject* object, QEvent* event) { if (event->type() == QEvent::KeyPress) { int column = m_currentFocus % 3; - int row = m_currentFocus - column; + int row = m_currentFocus / 3; switch (static_cast<QKeyEvent*>(event)->key()) { case Qt::Key_Up: - row += 6; + row += 2; break; case Qt::Key_Down: - row += 3; + row += 1; break; case Qt::Key_Left: column += 2;

@@ -94,8 +94,8 @@ default:

return false; } column %= 3; - row %= 9; - m_currentFocus = column + row; + row %= 3; + m_currentFocus = column + row * 3; m_slots[m_currentFocus]->setFocus(); return true; }