//header e codice .cpp scritti da Furia Manuel(manvb.net) utilizzando le WinApi.
//specificare l'autore originale in caso di utilizzo
//Queste funzioni permettono di manipolare la console a proprio piacimento
#ifndef consoleio_h
#define consoleio_h
#include <windows.h>
#include <iostream>
using namespace std;
struct rect{
int w;
int h;
int x;
int y;
};
class color{
public:
void set(char foreground, char background);
void set(short int color);
short int get();
void convert(short int color, char& foreground, char& background);
private:
short int color;
};
class gui{
public:
int w;
int h;
color guicolor;
int cursorsize;
bool showcursor;
void save();
void restore();
void refresh();
private:
char consolesco[500][500];
char consolesch[500][500];
};
bool intern(rect objrec, int x, int y);
const char CBlack = 0, CBlue = 1, CGreen = 2, CAqua = 3, CRed = 4, CPurple = 5, CBrown = 6, CLGray = 7;
const char CGray = 8, CLBlue = 9, CLGreen = 10, CLAqua = 11, CLRed = 12, CLPurple = 13, CLYellow = 14, CWhite = 15;
struct posxy{
int x;
int y;
};
struct mclick{
int x;
int y;
bool click, doubleclick, left, right, center, move;
};
void mousemode();
int setcolor(unsigned short color);
int setcolor(char forecolor, char backcolor);
unsigned short getcurcolor();
void settitle(char* titolo);
int setbuffer(int w, int h);
void gotocoord (int x, int y);
void resetscr (char fchar, short int color);
void colortext(char* text, char forecolor, char backcolor);
void colortext(char* text, unsigned short color);
int getcolxy(int x, int y);
int getcolxy(int x, int y, char& foreground, char& background);
void setsize(int w, int h);
void maximize();
char getchrxy(int x, int y);
int setchrxy(int x, int y, char chr);
char readkey(bool show = false);
mclick scanmouse();
char scankey();
void beep();
void setcursor(int size, bool visible);
posxy getcoord();
int setcolxy(int x, int y, char foreground, char background);
int setcolxy(int x, int y, short int color);
extern gui console;
void ini();
#endif