mandelbrot

simple mandelbrot visualizer
Index Commits Files Refs README LICENSE
sdl_extra.c (655B)
   1 #include "sdl_extra.h"
   2 
   3 status_t SDL_setup(SDL_Window **win, SDL_Renderer **rend) {
   4     if (SDL_Init(SDL_INIT_VIDEO) != 0)
   5         return ERROR_SDL_INIT;
   6 
   7     *win = SDL_CreateWindow(
   8         WIN_TITLE,
   9         SDL_WINDOWPOS_CENTERED,
  10         SDL_WINDOWPOS_CENTERED,
  11         800,
  12         600,
  13         SDL_WINDOW_RESIZABLE
  14     );
  15 
  16     *rend = SDL_CreateRenderer(*win, -1, SDL_RENDERER_ACCELERATED);
  17 
  18     if ((*win == NULL) || (*rend == NULL))
  19         return ERROR_NULL_POINTER;
  20 
  21     return OK;
  22 }
  23 
  24 status_t SDL_cleanup(SDL_Window *win, SDL_Renderer *rend) {
  25     if((win == NULL) || (rend == NULL))
  26         return ERROR_NULL_POINTER;
  27 
  28     SDL_DestroyRenderer(rend);
  29     SDL_DestroyWindow(win);
  30     SDL_Quit();
  31     return OK;
  32 }