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; }
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; }
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; }
public int TotalYOffsetPx(CellLayout layout) { return y_offset_px + layout.VerticalOffsetPx; }
//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; }