00001 #ifndef CONSOLE_HPP
00002 #define CONSOLE_HPP
00003
00004
00005
00006
00007 #include <stdlib.h>
00008 #include <stdio.h>
00009 #include <string.h>
00010 #include <gccore.h>
00011 #include "../skins/skin.h"
00012
00013 class Console
00014 {
00015 public:
00016 Console();
00017 ~Console();
00018
00019 static const int BLACK = 0;
00020 static const int DARK_RED = 1;
00021 static const int DARK_GREEN = 2;
00022 static const int DARK_YELLOW = 3;
00023 static const int DARK_BLUE = 4;
00024 static const int DARK_MAGENTA = 5;
00025 static const int DARK_CYAN = 6;
00026 static const int GRAY = 7;
00027 static const int DARK_GRAY = 10;
00028 static const int RED = 11;
00029 static const int GREEN = 12;
00030 static const int YELLOW = 13;
00031 static const int BLUE = 14;
00032 static const int MAGENTA = 15;
00033 static const int CYAN = 16;
00034 static const int WHITE =17;
00035
00036
00037 void clearConsole(int bgcolor);
00038 void clearArea(int startX,int startY, int rows, int cols, int bgcolor);
00039 void moveCursor (int row, int column);
00040 void backspace();
00041
00042
00043 void setColor(int fgcolor,int bgcolor);
00044
00045
00046 void drawString (int x, int y, int color, int bgcolor, const char *msg);
00047 void centerString (int y, int color, int bgcolor, const char *msg);
00048
00049
00050 void drawWindow (int startX,int startY,int rows,int cols, int bgColor,int title_textColor,int title_textlineColor,int title_bgColor, int shadowColor, int declColor, const char* windowTitle);
00051
00052
00053
00054
00055
00056 void clearConsole();
00057 void clearConsoleArea(int startX,int startY, int rows, int cols);
00058 void clearPrimaryArea(int startX,int startY, int rows, int cols);
00059 void clearSecondaryArea(int startX,int startY, int rows, int cols);
00060
00061
00062 void drawStringPrimary (int x, int y, const char *msg);
00063 void drawStringPrimaryAlternate (int x, int y, const char *msg);
00064 void drawStringSecondary (int x, int y, const char *msg);
00065 void drawStringSecondaryAlternate (int x, int y, const char *msg);
00066
00067 void centerStringPrimary (int y, const char *msg);
00068 void centerStringPrimaryAlternate (int y, const char *msg);
00069 void centerStringSecondary (int y, const char *msg);
00070 void centerStringSecondaryAlternate (int y, const char *msg);
00071
00072
00073 void drawPrimaryWindow (int startX,int startY,int rows,int cols, const char* windowTitle);
00074 void drawSecondaryWindow (int startX,int startY,int rows,int cols, const char* windowTitle);
00075
00076 void registerSkin(Skin skin);
00077
00078
00079
00080
00081 private:
00082 int translateColor(int color);
00083 bool isBrightColor(int color);
00084 bool skinRegistered;
00085 bool isSkinRegistered(){return skinRegistered;};
00086 void handleSkinRegistrationError();
00087
00088 Skin registeredSkin;
00089
00090 };
00091
00092 #endif