diff options
author | Jonas Gunz <himself@jonasgunz.de> | 2019-03-16 22:01:12 +0100 |
---|---|---|
committer | Jonas Gunz <himself@jonasgunz.de> | 2019-03-16 22:01:12 +0100 |
commit | bc0a389d3600561a74d5a700370ae5e2537fdb94 (patch) | |
tree | be4b7bd74f151099c981b60a158ee65fcbd1557a /src/cRender.h | |
parent | f4e7ec209ec70f855999668e58c23b20227da84d (diff) | |
download | termgl-bc0a389d3600561a74d5a700370ae5e2537fdb94.tar.gz |
Reworked color for xterm compatible terminals. #6
_color can now be set as (FG | BG | MOD)
Diffstat (limited to 'src/cRender.h')
-rw-r--r-- | src/cRender.h | 52 |
1 files changed, 33 insertions, 19 deletions
diff --git a/src/cRender.h b/src/cRender.h index 6dd75fb..42c3388 100644 --- a/src/cRender.h +++ b/src/cRender.h @@ -9,8 +9,9 @@ #ifdef __linux__ #include <unistd.h> #include <sys/ioctl.h> + #include <stdint.h> - typedef int WORD; + typedef uint32_t WORD; #elif _WIN32 #include <Windows.h> #else @@ -27,6 +28,7 @@ //Colors #ifdef _WIN32 + #define _COL_BLACK 0x00 #define _COL_BLUE 0x01 #define _COL_GREEN 0x02 @@ -36,23 +38,37 @@ #define _COL_DARK_WHITE 0x07 #define _COL_INTENSITY 0x08 #define _COL_DEFAULT 0xFF + #elif __linux__ - #define _COL_BLACK 30 - #define _COL_BLUE 34 - #define _COL_GREEN 32 - #define _COL_YELLOW 33 - #define _COL_RED 31 - #define _COL_WHITE 37 - #define _COL_DEFAULT 0 - - //Linux Specific - #define _COL_BOLD 1 - #define _COL_BOLD_OFF 21 - #define _COL_UNDERLINE 4 + + //FG + #define _COL_DEFAULT 0x00 + #define _COL_BLACK 0x1e//30 + #define _COL_RED 0x1f//31 + #define _COL_GREEN 0x20//32 + #define _COL_YELLOW 0x21//33 + #define _COL_BLUE 0x22//34 + #define _COL_WHITE 0x25//37 + + //BG + #define _COL_BLACK_BG 0x1e00 + 0x0a00//30 + #define _COL_RED_BG 0x1f00 + 0x0a00//31 + #define _COL_GREEN_BG 0x2000 + 0x0a00//32 + #define _COL_YELLOW_BG 0x2100 + 0x0a00//33 + #define _COL_BLUE_BG 0x2200 + 0x0a00//34 + #define _COL_WHITE_BG 0x2500 + 0x0a00//37 + + //MOD + #define _COL_BOLD 0x010000 + #define _COL_UNDERLINE 0x040000 + #define _COL_INVERSE 0x070000 + + //Not needed + #define _COL_BOLD_OFF 21 #define _COL_UNDERLINE_OFF 24 - #define _COL_INVERSE 7 - #define _COL_INVERSE_OFF 27 -#endif + #define _COL_INVERSE_OFF 27 + +#endif // __linux__ using namespace std; @@ -78,12 +94,11 @@ public: virtual ~cRender(); /** Draws _c @ _pos in screenbuffer - * Returns _COLLOSION_ if _pos is already set to !cBackround + * _color can be combined by OR: (FG | BG | MOD). Anyone can be left out. */ int drawPoint(char _c, sPos _pos, WORD _color); /** draws Line from _pos1 to _pos2 in screenbuffer - * x Value of pos1 MUSTNT exceed the x value of pos2! */ int drawLine(char _c, sPos _pos1, sPos _pos2, WORD _color); @@ -93,7 +108,6 @@ public: int drawText(string _s, sPos _pos, WORD _color); /** writes rectangle to screenbuffer - * x Value of pos1 MUSTNT exceed the x value of pos2! */ int drawRectangle(char _border, char _fill, sPos _pos1, sPos _pos2, WORD _borderColor, WORD _fillColor); |