Hi guys,
I would like to create a grid of characters or a row of strings that is spaced out equally both horizontal and vertical.
what is the best way of doing it?
Hi guys,
I would like to create a grid of characters or a row of strings that is spaced out equally both horizontal and vertical.
what is the best way of doing it?
hi
For one you could always use a monospace font, but that’s probably not the look you’re going for…
Otherwise the easiest way to do it, is to have 2 for loops, one counting up the x-, the other one y-coordinate. Then you could render each letter by itself at the corresponding coordinates.
something like this:
for(int ix=0;ix<ofGetWidth();ix+=20){
for(int iy=0;iy<ofGetHeight();iy++){
ofDrawBitmapString("a",ix,iy);
}
}
The above example should render the letter a on a equally spaced grid covering your whole drawing area.
Is this what you are looking for?
greets ph
public class testttt{
public static void main(String[]args){
char sym1 = ‘+’;
char sym2 = ‘-’;
int line = 0;
do
{
if(line % 2 == 0){
for(int i = 0; i < 10; i++){
if((i==0) || (i==3) || (i==6) || (i==9)){
System.out.print(sym1);
}
else
{
System.out.print(sym2);
}
}
}else {
for(int i = 0; i <4; i++){
System.out.print(’|’);
}
}
line++;
System.out.print("\n");
}while(line != 7);
}
}
If you only want to print the grid itself and ignore the input a simple way is like this