/** * Copyright (c) 2021 Dominic Masters * * This software is released under the MIT License. * https://opensource.org/licenses/MIT */ #pragma once #include "../libs.h" /** Maximum number of columns a grid can have */ #define GRID_COLUMN_COUNT_MAX 16 /** Maximum number of rows a grid can have */ #define GRID_ROW_COUNT_MAX GRID_COLUMN_COUNT_MAX /** Cell size for "auto", basically to fill the remaining space evenly */ #define GRID_CEL_SIZE_AUTO -1 /** Definitio of a grid */ typedef struct { /** Count of columns/rows in the grid */ uint8_t columns, rows; /** Cell Definitions, used to control how the cells will size themselves */ float columnDefinitions[GRID_COLUMN_COUNT_MAX]; float rowDefinitions[GRID_COLUMN_COUNT_MAX]; /** Settings to control gutters (space between cells) and border (of grid) */ float gutterX, gutterY; float borderX, borderY; /** Calculated sizes and positions for each cell */ float columnSizes[GRID_COLUMN_COUNT_MAX]; float columnPositions[GRID_COLUMN_COUNT_MAX]; float rowSizes[GRID_ROW_COUNT_MAX]; float rowPositions[GRID_COLUMN_COUNT_MAX]; /** Cached size of the grid */ float width, height; } grid_t;