add font drawing and faster surface-based rendering, command-line options
This commit is contained in:
14
graphics.h
14
graphics.h
@ -20,8 +20,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#pragma once
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include <SDL2/SDL_pixels.h>
|
||||
#include <SDL2/SDL_ttf.h>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <chrono>
|
||||
#include "utils.h"
|
||||
#include "mandelbrot.h"
|
||||
|
||||
@ -34,9 +37,16 @@ namespace Mandelbrot {
|
||||
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;
|
||||
@ -44,6 +54,10 @@ namespace Mandelbrot {
|
||||
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);
|
||||
|
Reference in New Issue
Block a user