mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-10 01:29:05 -04:00
mathtext poc: enable scrolling
This commit is contained in:
parent
2852ff736c
commit
312d15d0f9
@ -63,6 +63,7 @@ int main(void){
|
||||
std::unique_ptr<Plane> nstd(nc.get_stdplane());
|
||||
int y, dimy, dimx;
|
||||
nc.get_term_dim(&dimy, &dimx);
|
||||
nstd->set_scrolling(true);
|
||||
do{
|
||||
nstd->putstr(c);
|
||||
nstd->get_cursor_yx(&y, nullptr);
|
||||
|
@ -54,8 +54,7 @@ public:
|
||||
#include "stain.h"
|
||||
#include "lock.h"
|
||||
#include "movedown.h"
|
||||
#include "moveleft.h"
|
||||
#include "moveright.h"
|
||||
#include "movelateral.h"
|
||||
#include "rotate.h"
|
||||
|
||||
private:
|
||||
|
@ -1,8 +1,9 @@
|
||||
void MoveLeft() {
|
||||
void MoveLateral(int direction) { // pass in -1 for left, 1 for right
|
||||
int shift = 2 * direction;
|
||||
const std::lock_guard<std::mutex> lock(mtx_);
|
||||
int y, x;
|
||||
if(PrepForMove(&y, &x)){
|
||||
if(!curpiece_->move(y, x - 2)){
|
||||
if(!curpiece_->move(y, x + shift)){
|
||||
throw TetrisNotcursesErr("move()");
|
||||
}
|
||||
if(InvalidMove()){
|
||||
@ -10,10 +11,18 @@ void MoveLeft() {
|
||||
throw TetrisNotcursesErr("move()");
|
||||
}
|
||||
}else{
|
||||
x -= 2;
|
||||
x += shift;
|
||||
if(!nc_.render()){
|
||||
throw TetrisNotcursesErr("render()");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline void MoveLeft() {
|
||||
MoveLateral(-1);
|
||||
}
|
||||
|
||||
inline void MoveRight() {
|
||||
MoveLateral(1);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user