public void Write(int row,int col,string s,Color4 color,Color4 bgcolor) { int c = col; bool update = false; //todo: bounds check? int start_col = -1; int end_col = -1; foreach(char ch in s){ if(c >= memory.objs.GetLength(1)){ break; } colorchar cch = new colorchar(ch,color,bgcolor); if(!memory[row,c].Equals(cch)){ memory[row,c] = cch; update = true; if(start_col == -1){ start_col = c; } end_col = c; } ++c; } if(update && !NoUpdate){ UpdateSurface(start_col + row * memory.objs.GetLength(1),end_col + row * memory.objs.GetLength(1)); //todo: fix all this 1D indexing, for speed. } }
public void Write(int row,int col,char ch,Color4 color,Color4 bgcolor) { this[row,col] = new colorchar(ch,color,bgcolor); }
public void Write(int row,int col,colorchar ch) { this[row,col] = ch; }
public void Fill(colorchar fill_char) { int rows = memory.objs.GetLength(0); int cols = memory.objs.GetLength(1); for(int i=0;i<rows;++i){ for(int j=0;j<cols;++j){ memory[i,j] = fill_char; } } UpdateSurface(0,rows*cols - 1); }
public void Write(int row,int col,char ch) { //todo: every combination goes here. 3 indexers * 3-4 colorchar parameter configurations, per data type. this[row,col] = new colorchar(ch); }
public void DrawBorder(colorchar n,colorchar s,colorchar e,colorchar w,colorchar ne,colorchar nw,colorchar se,colorchar sw) { int rows = memory.objs.GetLength(0); int cols = memory.objs.GetLength(1); memory[0,0] = nw; memory[0,cols-1] = ne; memory[rows-1,0] = sw; memory[rows-1,cols-1] = se; for(int j=1;j<cols-1;++j){ memory[0,j] = n; memory[rows-1,j] = s; } for(int i=1;i<rows-1;++i){ memory[i,0] = w; memory[i,cols-1] = e; } UpdateSurface(0,rows*cols - 1); }
public void DrawBorder(colorchar top_bottom_char,colorchar right_left_char,colorchar corner_char) { DrawBorder(top_bottom_char,top_bottom_char,right_left_char,right_left_char,corner_char,corner_char,corner_char,corner_char); }
public void DrawBorder(colorchar edge_char,colorchar corner_char) { DrawBorder(edge_char,edge_char,edge_char,edge_char,corner_char,corner_char,corner_char,corner_char); }
public void DrawBorder(colorchar border_char) { DrawBorder(border_char,border_char,border_char,border_char,border_char,border_char,border_char,border_char); }
public void Clear(Color4 clear_color) { int rows = memory.objs.GetLength(0); int cols = memory.objs.GetLength(1); colorchar cch = new colorchar(' ',clear_color,clear_color); for(int i=0;i<rows;++i){ for(int j=0;j<cols;++j){ memory[i,j] = cch; } } UpdateSurface(0,rows*cols - 1); }