int main() { int x, y; atStart("Example 3", 80, 24); /* Create the window. */ /* Load custom characters. */ load_font(); /* Main loop. */ while (atIsRunning()) { /* Draw the map using custom characters. */ for (y = 0; y < 10; ++y) for (x = 0; x < 15; ++x) atDrawChar(x, y, ATC_GREEN, atGetBgColor(), CHAR_PINE); atDrawString(0, 10, ATC_WHITE, atGetBgColor(), "Pine trees!"); /* Update the window. */ atUpdate(); /* Clear the backbuffer. */ atClear(); /* Grab events to allow the user to close the window. */ atGetKey(); } atStop(); /* Close the window. */ return 0; }
Position VisiblePosition::previousVisiblePosition(const Position &pos) { if (pos.isNull() || atStart(pos)) return Position(); Position test = deepEquivalent(pos); Position downstreamTest = test.downstream(StayInBlock); bool acceptAnyVisiblePosition = !isCandidate(test); Position current = test; while (!atStart(current)) { current = previousPosition(current); if (isCandidate(current) && (acceptAnyVisiblePosition || (downstreamTest != current.downstream(StayInBlock)))) { return current; } } return Position(); }
void TextReaderBase::ungetCharacter() { Q_ASSERT(!atStart()); Q_ASSERT(bufferPos>0); --bufferPos; --pos; --linePos; /* if(bufferPos-2>0 && buffer.at(bufferPos-2)=='\n'){ --lineNo; int lastNewlineIx=buffer.lastIndexOf('\n', bufferPos-1); if(lastNewlineIx==-1){ linePos=buffer.size()-2; }else{ linePos=buffer.mid(lastNewlineIx+1).size()-1; } }*/ }