2016-12-27 19:12:41 +00:00
|
|
|
/*
|
|
|
|
* @Author: klmp200
|
|
|
|
* @Date: 2016-12-27 19:59:21
|
|
|
|
* @Last Modified by: klmp200
|
2016-12-28 22:26:58 +00:00
|
|
|
* @Last Modified time: 2016-12-28 23:26:39
|
2016-12-27 19:12:41 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <SDL2/SDL.h>
|
|
|
|
#include <pixel.h>
|
|
|
|
#include <matrix.h>
|
2016-12-28 22:26:58 +00:00
|
|
|
#include <CellElement.h>
|
2016-12-27 19:12:41 +00:00
|
|
|
|
2016-12-28 20:39:42 +00:00
|
|
|
void SetPixel(SDL_Renderer *renderer, int x, int y, bool value){
|
|
|
|
|
|
|
|
if (value){
|
|
|
|
SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255);
|
|
|
|
} else {
|
|
|
|
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
|
|
|
|
}
|
|
|
|
SDL_RenderDrawPoint(renderer, x, y);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DisplayMatrixSDL(SCREEN *screen, Matrix m){
|
|
|
|
int i;
|
|
|
|
int j;
|
|
|
|
|
|
|
|
SDL_SetRenderDrawColor(screen->renderer, 0, 0, 0, 0);
|
|
|
|
SDL_RenderClear(screen->renderer);
|
|
|
|
|
|
|
|
for (i=0;i<m.rowCount;i++){
|
|
|
|
for (j=0;j<m.colCount;j++){
|
|
|
|
SetPixel(screen->renderer, i, j, GetCellValue(m, j, i));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SDL_RenderPresent(screen->renderer);
|
2016-12-27 19:12:41 +00:00
|
|
|
}
|