git repos / blockattack-game

commit 7cc28ffd

sago007 · 2020-06-20 21:40
7cc28ffdc79404eb008895ad3662054fb29a660f patch · browse files
parent 45d3631658de19807a017227427f8a09d644fbc4

Move more naturally around on the virtual keyboard
Moving off to the left now moves to the line end and going of right moves to the beginning

Changed files

M source/code/DialogBox.cpp before
diff --git a/source/code/DialogBox.cpp b/source/code/DialogBox.cpp index ba54c14..4b23303 100644 --- a/source/code/DialogBox.cpp +++ b/source/code/DialogBox.cpp
@@ -269,9 +269,18 @@ void DialogBox::ProcessInput(const SDL_Event& event, bool& processed) {
rk->cursorRight();
}
if (isRightEvent(event)) {
+ if ( (virtualKeyboard.selectedChar+1)/keyboardRowLimit != virtualKeyboard.selectedChar/keyboardRowLimit ) {
+ virtualKeyboard.selectedChar -= keyboardRowLimit;
+ }
++virtualKeyboard.selectedChar;
+ if (virtualKeyboard.selectedChar >= static_cast<int>(virtualKeyboard.gamePadCharFields.size())) {
+ virtualKeyboard.selectedChar -= virtualKeyboard.selectedChar%keyboardRowLimit;
+ }
}
if (isLeftEvent(event)) {
+ if ( (virtualKeyboard.selectedChar-1)/keyboardRowLimit != virtualKeyboard.selectedChar/keyboardRowLimit || virtualKeyboard.selectedChar == 0 ) {
+ virtualKeyboard.selectedChar += keyboardRowLimit;
+ }
--virtualKeyboard.selectedChar;
}
if (isDownEvent(event)) {