示例#1
0
 public static CellLayout CreateGrid(Surface s,int rows,int cols,int cell_height_px,int cell_width_px,int v_offset_px,int h_offset_px,PositionFromIndex z = null)
 {
     CellLayout c = new CellLayout();
     c.CellHeightPx = cell_height_px;
     c.CellWidthPx = cell_width_px;
     c.VerticalOffsetPx = v_offset_px;
     c.HorizontalOffsetPx = h_offset_px;
     c.X = idx => (idx % cols) * c.CellWidthPx;
     c.Y = idx => (idx / cols) * c.CellHeightPx;
     c.Z = z;
     if(s != null){
         s.layouts.Add(c);
     }
     return c;
 }
示例#2
0
        public PositionFromIndex Z = null; //Z isn't used unless the VBO object has PositionDimensions set to 3.

        #endregion Fields

        #region Methods

        public static CellLayout Create(Surface s,int cell_height_px,int cell_width_px,int v_offset_px,int h_offset_px,PositionFromIndex x,PositionFromIndex y,PositionFromIndex z = null)
        {
            CellLayout c = new CellLayout(); //todo: fix x/y order for entire file?
            c.CellHeightPx = cell_height_px;
            c.CellWidthPx = cell_width_px;
            c.VerticalOffsetPx = v_offset_px;
            c.HorizontalOffsetPx = h_offset_px;
            c.X = x;
            c.Y = y;
            c.Z = z;
            if(s != null){
                s.layouts.Add(c);
            }
            return c;
        }
示例#3
0
 public static CellLayout CreateIso(Surface s,int rows,int cols,int cell_height_px,int cell_width_px,int v_offset_px,int h_offset_px,int cell_v_offset_px,int cell_h_offset_px,PositionFromIndex z = null,PositionFromIndex elevation = null)
 {
     CellLayout c = new CellLayout();
     c.CellHeightPx = cell_height_px;
     c.CellWidthPx = cell_width_px;
     c.VerticalOffsetPx = v_offset_px;
     c.HorizontalOffsetPx = h_offset_px;
     c.X = idx => (rows - 1 - (idx/cols) + (idx%cols)) * cell_h_offset_px;
     if(elevation == null){
         c.Y = idx => ((idx/cols) + (idx%cols)) * cell_v_offset_px;
     }
     else{
         c.Y = idx => ((idx/cols) + (idx%cols)) * cell_v_offset_px + elevation(idx);
     }
     c.Z = z;
     if(s != null){
         s.layouts.Add(c);
     }
     return c;
 }
示例#4
0
 public int TotalYOffsetPx(CellLayout layout)
 {
     return y_offset_px + layout.VerticalOffsetPx;
 }
示例#5
0
 //public void XOffsetPx(){ return x_offset_px; }
 //public void YOffsetPx(){ return y_offset_px; }
 public int TotalXOffsetPx(CellLayout layout)
 {
     return x_offset_px + layout.HorizontalOffsetPx;
 }