You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
notcurses/src/tetris/movelateral.h

22 lines
380 B
C

void MoveLateral(int direction) { // pass in -1 for left, 1 for right
int shift = 2 * direction;
int y, x;
if(PrepForMove(&y, &x)){
curpiece_->move(y, x + shift);
if(InvalidMove()){
curpiece_->move(y, x);
}else{
x += shift;
nc_.render();
}
}
}
inline void MoveLeft() {
MoveLateral(-1);
}
inline void MoveRight() {
MoveLateral(1);
}