#ifndef RENDER_H #define RENDER_H #include "terminal.h" #include #include class Render { private: int speed; int effect; int fd; int overlimit; Terminal &term; std::vector color_history; const char **image_data; // vector to hold multiple images -- just in case. int image_size; public: Render(int fd, Terminal &term); void reset(void); void sleep(void); int ms_sleep(unsigned int ms); void color(int color); void pos_goto(int x, int y); void send(char ch); // render_effect void send(std::string &string_out); // render // to change: Make this a vector (in the case we set multiple images) void set_image(const char **lines, int size); // render_image void reset_image(void); private: void process_trigger(std::string str, size_t &pos); int digit(std::string str, size_t &pos, int digits = 1); int send_image(int x, int y); int send_image(void); }; struct render { int speed; int effect; }; void reset_render(void); int ms_sleep(unsigned int ms); void render_sleep(void); void write_color(int fd, int color); void send_goto(int fd, int x, int y); /* int send_file(int fd, char *filename); int send_file(int fd, int x, int y, char *filename); */ const char *process_trigger(int fd, const char *cp); void process_trigger(int fd, std::string str, size_t &pos); void render_effect(int fd, char ch); /* void render(int fd, const char *string_out, int len); */ void render(int fd, std::string &string_out); void render_image(const char **lines, int size); // Use this in everything, so it is easily changed! #define TRIGGER "\x16" // "@" // "^" // "\x16" // Max limit we'll sleep before ignoring effects/speed. #define SLEEP_LIMIT 30 #endif