#include "graphics.h" #include "utils.h" #include #include #include using namespace Mandelbrot; Graphics::Graphics(int w, int h, std::string title) : w(w), h(h), title(title) { SDL_Window *window = SDL_CreateWindow(this->title.c_str(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, this->w, this->h, 0); if (!window) { std::cout << "Could not create window. " << SDL_GetError() << std::endl; exit(EXIT_FAILURE); } this->window = window; SDL_Renderer *r = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED); if (!r) { std::cout << "Could not create renderer. " << SDL_GetError() << std::endl; exit(EXIT_FAILURE); } this->renderer = r; } void Graphics::drawPoint(const Vec2i &pos, const rgb &col) { SDL_RenderDrawPoint(this->renderer, pos.x, pos.y); } void Graphics::plot(const Vec2bf &from, const Vec2bf &to) { for (double i = 0.0; i < this->w; i++) { for (double j = 0.0; j < this->h; j++) { BigFloat f = from.x + (i / this->w) * (from.x - to.x); } } }