Created a test pattern in the client's screen.

This commit is contained in:
2021-12-14 20:32:11 -06:00
parent 31ea565754
commit 5bda17331c
4 changed files with 25 additions and 14 deletions
+24 -2
View File
@@ -2,13 +2,35 @@
#include <SDL2/SDL_image.h>
#include <SDL2/SDL_render.h>
#include <SDL2/SDL_surface.h>
#include <stdio.h>
void renderClientScreen(SDL_Renderer* renderer) {
SDL_Rect dest;
SDL_RenderGetViewport(renderer, &dest);
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
SDL_Rect cell;
cell.w = dest.w / VSCREEN_COLUMN_COUNT;
cell.h = dest.h / VSCREEN_ROW_COUNT;
int row = 0;
unsigned char backgroundColor = 0x00;
SDL_RenderFillRect(renderer, &dest);
for (int i = 0; i < VSCREEN_ROW_COUNT; i++) {
for(int j = 0; j <VSCREEN_COLUMN_COUNT; j++) {
SDL_SetRenderDrawColor(renderer, backgroundColor, backgroundColor, backgroundColor, 255);
cell.x = j * cell.w;
cell.y = i * cell.h;
SDL_RenderFillRect(renderer, &cell);
backgroundColor ^= 0xFF;
}
backgroundColor ^= 0xFF;
row++;
}
}