Created a test pattern in the client's screen.
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
#ifndef _CAPP_H
|
||||
|
||||
#define _CAPP_H
|
||||
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -6,6 +6,7 @@
|
||||
#define VSCREEN_WIDTH 640
|
||||
#define VSCREEN_HEIGHT 480
|
||||
#define VSCREEN_COLUMN_COUNT 20
|
||||
#define VSCREEN_ROW_COUNT 20
|
||||
|
||||
void renderClientScreen(SDL_Renderer *);
|
||||
|
||||
|
||||
@@ -63,8 +63,6 @@ int main(int argc, char* args[]) {
|
||||
|
||||
handleInput();
|
||||
|
||||
//blit(player.texture, player.x, player.y);
|
||||
|
||||
presentScene();
|
||||
|
||||
SDL_Delay(16);
|
||||
|
||||
+24
-2
@@ -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++;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user