public TextPanel(GLWindow parent_window,int rows,int cols,int cell_h_px,int cell_w_px,int v_offset_px,int h_offset_px,string font_filename,int char_width_px,int padding_between_chars_px,bool antialiased_font)
 {
     memory = new PosArray<colorchar>(rows,cols);
     colorchar cch = TextPanel.GetBlackChar();
     for(int i=0;i<rows;++i){
         for(int j=0;j<cols;++j){
             memory[i,j] = cch;
         }
     }
     height = rows * cell_h_px;
     width = cols * cell_w_px;
     string shader = antialiased_font? Shader.AAFontFS() : Shader.FontFS();
     surface = Surface.Create(parent_window,font_filename,shader,false,2,4,4); //todo: maybe a bool to control whether the panel gets added to the window's list?
     SpriteType.DefineSingleRowSprite(surface,char_width_px,padding_between_chars_px); //also todo, TransparentFontFS exists now...?
     CellLayout.CreateGrid(surface,rows,cols,cell_h_px,cell_w_px,0,0);
     surface.SetOffsetInPixels(h_offset_px,v_offset_px);
     surface.SetEasyLayoutCounts(rows*cols);
     surface.DefaultUpdatePositions();
     UpdateSurface(0,rows*cols-1);
 }
Esempio n. 2
0
 public static Surface Create(GLWindow window_,string texture_filename,params int[] vertex_attrib_counts)
 {
     return Create(window_,texture_filename,Shader.DefaultFS(),false,vertex_attrib_counts);
 }
Esempio n. 3
0
 public static Surface Create(GLWindow window_,string texture_filename,string frag_shader,bool has_depth,params int[] vertex_attrib_counts)
 {
     Surface s = new Surface();
     s.window = window_;
     int dims = has_depth? 3 : 2;
     s.UseDepthBuffer = has_depth;
     VertexAttributes attribs = VertexAttributes.Create(vertex_attrib_counts);
     s.vbo = VBO.Create(dims,attribs);
     s.texture = Texture.Create(texture_filename);
     s.shader = Shader.Create(s.texture.TextureIndex,frag_shader);
     if(window_ != null){
         window_.Surfaces.Add(s);
     }
     return s;
 }