Skip to content
Permalink
b9087497bc
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
35 lines (32 sloc) 747 Bytes
class Console {
int _textSize = 10;
int _bufferSize = 40;
int _xOffset = 20;
int _yOffset = 20;
ArrayList<String> _stringList;
Console() {
_stringList = new ArrayList<String> ();
}
void print(String s) {
_stringList.add(s);
}
void draw() {
pushStyle();
noStroke();
fill(0,0,0,150);
rect(0,0,400,_yOffset + (_bufferSize + 1) * _textSize);
fill(30,250,30);
textSize(_textSize);
int index = 0;
int c = 0;
if (_stringList.size() - _bufferSize > 0) {
index = (_stringList.size() - _bufferSize) - 1;
}
while(index < _stringList.size()) {
text(_stringList.get(index), _xOffset, _yOffset + c * _textSize);
index++;
c++;
}
popStyle();
}
}