~l3kn/quad

6074b4e9a3647e9041d5fd090f5b2be871eb1a4c — Leon Rische 6 months ago 66f1841
Add timestamps to BMP file names
1 files changed, 19 insertions(+), 1 deletions(-)

M quad.c
M quad.c => quad.c +19 -1
@@ 3,6 3,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

#include <SDL2/SDL.h>



@@ 32,7 33,24 @@ int selectorX = PADDING;
int selectorY = PADDING;

void saveBMP() {
  SDL_SaveBMP(grammarSurface, "quad-render.bmp");
  time_t currentTime;
  struct tm* info;
  time(&currentTime);
  info = localtime(&currentTime);

  char path[50];
  strftime(path, 50, "quad_%F_%T.bmp", info);

  SDL_Surface* surface = SDL_GetWindowSurface(window);
	SDL_RenderReadPixels(windowRenderer,
	                     NULL,
	                     SDL_PIXELFORMAT_ARGB8888,
	                     surface->pixels,
	                     surface->pitch);

  SDL_SaveBMP(surface, path);
  printf("BMP saved to %s\n", path);
  SDL_FreeSurface(surface);
}

void renderRule(SDL_Renderer* renderer) {