void decrementCursor() { if (getCursorX() < 1) { if (getCursorY() < 1) { setCursorY(0); setCursorX(current_video_mode->width); } else { setCursorY(getCursorY() - 1); setCursorX(current_video_mode->width); } return; } setCursorX(getCursorX() - 1); }
void incrementCursor() { if (getCursorX() >= current_video_mode->width) { setCursorX(0); if (getCursorY() >= current_video_mode->height - 1) { newLine(); setCursorY(current_video_mode->height - 1); } else setCursorY(getCursorY() + 1); return; } else { setCursorX(getCursorX() + 1); } }
void model_loader_app::onMouseButton(int button, int action, int mods) { OpenGLApp::onMouseButton(button, action, mods); float x = getCursorX(); float y = info.windowHeight - getCursorY(); x = (x/(float)info.windowWidth - 0.5) * 2.0; y = (y/(float)info.windowHeight - 0.5) * 2.0; if(action == GLFW_PRESS) { if(x>=0.2 && x <=0.45 && y >= -0.9 && y < -0.75) { bRightPressed = true; } if(x<=-0.2 && x >=-0.45 && y >= -0.9 && y < -0.75) { bLeftPressed = true; } } else { if(bLeftPressed) { mMesh->changeAnim(false); } if(bRightPressed) mMesh->changeAnim(); bLeftPressed = false; bRightPressed = false; } }
// Standard getchar char getchar() { char c; int sx = getCursorX(); int sy = getCursorY(); while ((c = getC()) != '\n') { if (c != 0) { if (c != 0x0f) { if (c != '\r' || getCursorY() > sy || getCursorX() > sx) putchar(c); } else { putTab(); } } } putchar(c); return c; }
// Clears the screen from the given cursor to the end of the page. // And rolls the cursor back. void clear_screen_topdown() { int i = 0; int x = getCursorX(); int y = getCursorY(); setCursor(FALSE); while (i++ < (current_video_mode->width * (current_video_mode->height - y)) - x) { putchar(' '); } setCursor(TRUE); setCursorX(x); setCursorY(y); }
void video_reload() { int x, y; int old_x = getCursorX(); int old_y = getCursorY(); setCursor(FALSE); for(x = 0; x < current_video_mode->width; ++x) { for(y = 0; y < current_video_mode->height; ++y) { setCursorX(x); setCursorY(y); putC(current_video_mode->screen[x][y]); } } setCursor(TRUE); setCursorX(old_x); setCursorY(old_y); }
Palette::Palette(QWidget *parent) : QMainWindow(parent), ui(new Ui::Palette), settings("./sweeper.ini", QSettings::IniFormat), pSettings(PaletteSettings(settings)) { pSettings.commitSettings(); ui->setupUi(this); setWindowModality(Qt::ApplicationModal); setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint); win = getWindowUnderCursor(); int newX = getCursorX() - (width()/2); int newY = getCursorY() - (height()/2); move(newX, newY); state = QUuid(); QMap<QString, HoverWatchState> &bob = pSettings.cells; for(QMap<QString, HoverWatchState>::const_iterator i = bob.constBegin(); i != bob.constEnd(); ++i) { HoverWatch *hv = new HoverWatch(i.value()); cells.push_front(hv); int x, y; mapLocStr(i.key(), &x, &y); ui->grid->addWidget(hv, x, y); } //and now let all the hoverwatches connect to each other and us... for(QVector<HoverWatch*>::iterator it = cells.begin(); it != cells.end(); ++it) { for(QVector<HoverWatch*>::iterator jt = cells.begin(); jt != cells.end(); ++jt) { connect(*it, SIGNAL(hoverActivated(QUuid)), *jt, SLOT(reactToHover(QUuid))); connect(*it, SIGNAL(hoverActivated(QUuid)), this, SLOT(setState(QUuid))); } } }
void Ui::Ncurses::setCursorX(int x) { moveCursor(x, getCursorY()); }
void Ui::Ncurses::carriageReturn() { moveCursor(0, getCursorY() + 1); }