/*
The GPLv3 License (GPLv3)
Copyright (c) 2022 Akos Horvath
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
#pragma once
#include
#include
#include
#include
#include
#include
#include "utils.h"
#include "mandelbrot.h"
using namespace Util;
namespace Mandelbrot {
class Graphics {
public:
std::string title;
int w, h;
SDL_Window *window;
TTF_Font* font;
SDL_Renderer *renderer;
SDL_Surface *textSurface;
SDL_Surface *surface;
SDL_Surface *screenSurface;
SDL_PixelFormat* pformat;
Vec2mp from;
Vec2mp to;
int tcount;
int maxiter;
bool running;
bool mouseDown;
Vec2i m_start;
Vec2i m_end;
Graphics(int w, int h, std::string title);
Graphics(int w, int h, std::string title, int tcount, int maxiter);
void initFont(const std::string path, uint16_t size);
void drawText(const std::string string);
void setPixel(uint16_t x, uint16_t y, uint32_t pixel);
void plot(Mandelbrotc const &m);
void mainLoop();
void drawPoint(const Vec2i &pos, const rgb &col);
void drawSelectionRectangle();
void zoom(Mandelbrotc &m);
};
} // namespace Mandelbrot