This function returns and x,y position for a given character number. It is used for positioning each character of text */
| 131 | It is used for positioning each character of text |
| 132 | */ |
| 133 | void |
| 134 | getPositionForCharNumber(int n, int *x, int *y) |
| 135 | { |
| 136 | int renderW, renderH; |
| 137 | SDL_RenderGetLogicalSize(renderer, &renderW, &renderH); |
| 138 | |
| 139 | int x_padding = 16; /* padding space on left and right side of screen */ |
| 140 | int y_padding = 32; /* padding space at top of screen */ |
| 141 | /* figure out the number of characters that can fit horizontally across the screen */ |
| 142 | int max_x_chars = (renderW - 2 * x_padding) / GLYPH_SIZE_SCREEN; |
| 143 | int line_separation = 5; /* pixels between each line */ |
| 144 | *x = (n % max_x_chars) * GLYPH_SIZE_SCREEN + x_padding; |
| 145 | #ifdef TEST_INPUT_RECT |
| 146 | *y = renderH - GLYPH_SIZE_SCREEN; |
| 147 | #else |
| 148 | *y = (n / max_x_chars) * (GLYPH_SIZE_SCREEN + line_separation) + y_padding; |
| 149 | #endif |
| 150 | } |
| 151 | |
| 152 | void |
| 153 | drawGlyph(int glyph, int positionIndex) |
no test coverage detected