diff --git a/main.c b/main.c index be6891d..919a1b1 100755 --- a/main.c +++ b/main.c @@ -9,21 +9,6 @@ int startw=1900; int starth=1100; -void putPixelRGB(SDL_Renderer* renderer, int x, int y, unsigned char r,unsigned char g,unsigned char b){ -SDL_SetRenderDrawColor(renderer,(Uint8)r,(Uint8)g,(Uint8)b,255); -SDL_RenderDrawPoint(renderer,x,y); -} - -void putRectRGB(SDL_Renderer* renderer, int x, int y, int size, unsigned char r,unsigned char g,unsigned char b){ - -SDL_Rect tmp_rect; -tmp_rect.w = tmp_rect.h = size; -tmp_rect.x=x; -tmp_rect.y=y; -SDL_SetRenderDrawColor(renderer,(Uint8)r,(Uint8)g,(Uint8)b,255); -SDL_RenderFillRect(renderer,&tmp_rect); -} - void iterate_game(int **grid, int** nextgrid, int cols, int rows){ for (int i=0; ix=i*boxsize; + box_rect->y=j*boxsize; + SDL_RenderFillRect(renderer,box_rect); } } } @@ -105,7 +88,7 @@ int main(int argc, char *argv[]) SDL_GetWindowSize(window, &w, &h); printf("Window dimensions: %dx%d\n", w, h); - int boxsize=15; + int boxsize=8; int cols=w/boxsize; int rows=h/boxsize; SDL_Log("cols %d rows %d\n\n\n\n",cols,rows); @@ -127,8 +110,11 @@ int main(int argc, char *argv[]) } } + SDL_Rect box_rect; + box_rect.w = box_rect.h = boxsize-1; - draw(renderer,window,cols,rows,0,0,boxsize,grid,nextgrid,w,h); + + draw(renderer,window,cols,rows,0,0,boxsize,grid,nextgrid,w,h,&box_rect); bool quit = false; SDL_Event e; @@ -171,7 +157,7 @@ int main(int argc, char *argv[]) } float mouseoutX=gmouseX; float mouseoutY=gmouseY; - draw(renderer,window,cols,rows,mouseoutX,mouseoutY,boxsize,grid,nextgrid,w,h); + draw(renderer,window,cols,rows,mouseoutX,mouseoutY,boxsize,grid,nextgrid,w,h,&box_rect); //SDL_Delay(10); }