AddDigit(c - '0');
break;
case 'w': case 'W':
- case 'i': case 'I':
MoveUp();
break;
case 's': case 'S':
- case 'k': case 'K':
MoveDown();
break;
case 'a': case 'A':
- case 'j': case 'J':
MoveLeft();
break;
case 'd': case 'D':
- case 'l': case 'L':
MoveRight();
break;
+ case 'i': case 'I':
+ SweepUp();
+ break;
+ case 'k': case 'K':
+ SweepDown();
+ break;
+ case 'j': case 'J':
+ SweepLeft();
+ break;
+ case 'l': case 'L':
+ SweepRight();
+ break;
case 'r': case 'R':
SetRed();
break;
ConsumeNumber();
}
+ void SweepUp() {
+ int distance = GetAbsoluteNumber(1, h) % h;
+ for (int i = 0; i < distance; ++i) {
+ y = (y + h - 1) % h;
+ Paste();
+ }
+ text_dirty = true;
+ ConsumeNumber();
+ }
+
+ void SweepDown() {
+ int distance = GetAbsoluteNumber(1, h) % h;
+ for (int i = 0; i < distance; ++i) {
+ y = (y + 1) % h;
+ Paste();
+ }
+ text_dirty = true;
+ ConsumeNumber();
+ }
+
+ void SweepLeft() {
+ int distance = GetAbsoluteNumber(1, w) % w;
+ for (int i = 0; i < distance; ++i) {
+ x = (x + w - 1) % w;
+ Paste();
+ }
+ text_dirty = true;
+ ConsumeNumber();
+ }
+
+ void SweepRight() {
+ int distance = GetAbsoluteNumber(1, w) % w;
+ for (int i = 0; i < distance; ++i) {
+ x = (x + 1) % w;
+ Paste();
+ }
+ text_dirty = true;
+ ConsumeNumber();
+ }
+
void SetColor(const gfx::ColorRGB &c) {
cells[y * w + x] = c;
}