Files
sdl-test/src/vscreen.c
T

36 lines
853 B
C

#include "../include/vscreen.h"
#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_Rect cell;
cell.w = dest.w / VSCREEN_COLUMN_COUNT;
cell.h = dest.h / VSCREEN_ROW_COUNT;
int row = 0;
unsigned char backgroundColor = 0x00;
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++;
}
}