Fimbulwinter Project  Pre-Alpha
An Ragnarok Online Emulator
Common/show_message.hpp
00001 #ifndef _SHOWMSG_H_
00002 #define _SHOWMSG_H_
00003 
00004 // [EN] Adapted from eAthena
00005 // [PT] Adaptado do projeto eAthena
00006 
00007 // for help with the console colors look here:
00008 // http://www.edoceo.com/liberum/?doc=printf-with-color
00009 // some code explanation (used here):
00010 // \033[2J : clear screen and go up/left (0, 0 position)
00011 // \033[K  : clear line from actual position to end of the line
00012 // \033[0m : reset color parameter
00013 // \033[1m : use bold for font
00014 #define CL_RESET        "\033[0m"
00015 #define CL_CLS          "\033[2J"
00016 #define CL_CLL          "\033[K"
00017 
00018 // font settings
00019 #define CL_BOLD         "\033[1m"
00020 #define CL_NORM         CL_RESET
00021 #define CL_NORMAL       CL_RESET
00022 #define CL_NONE         CL_RESET
00023 
00024 // foreground color and bold font (bright color on windows)
00025 #define CL_WHITE        "\033[1;37m"
00026 #define CL_GRAY         "\033[1;30m"
00027 #define CL_RED          "\033[1;31m"
00028 #define CL_GREEN        "\033[1;32m"
00029 #define CL_YELLOW       "\033[1;33m"
00030 #define CL_BLUE         "\033[1;34m"
00031 #define CL_MAGENTA      "\033[1;35m"
00032 #define CL_CYAN         "\033[1;36m"
00033 
00034 // background color
00035 #define CL_BG_BLACK             "\033[40m"
00036 #define CL_BG_RED               "\033[41m"
00037 #define CL_BG_GREEN             "\033[42m"
00038 #define CL_BG_YELLOW    "\033[43m"
00039 #define CL_BG_BLUE              "\033[44m"
00040 #define CL_BG_MAGENTA   "\033[45m"
00041 #define CL_BG_CYAN              "\033[46m"
00042 #define CL_BG_WHITE             "\033[47m"
00043 
00044 // foreground color and normal font (normal color on windows)
00045 #define CL_LT_BLACK             "\033[0;30m"
00046 #define CL_LT_RED               "\033[0;31m"
00047 #define CL_LT_GREEN             "\033[0;32m"
00048 #define CL_LT_YELLOW    "\033[0;33m"
00049 #define CL_LT_BLUE              "\033[0;34m"
00050 #define CL_LT_MAGENTA   "\033[0;35m"
00051 #define CL_LT_CYAN              "\033[0;36m"
00052 #define CL_LT_WHITE             "\033[0;37m"
00053 
00054 // foreground color and bold font (bright color on windows)
00055 #define CL_BT_BLACK             "\033[1;30m"
00056 #define CL_BT_RED               "\033[1;31m"
00057 #define CL_BT_GREEN             "\033[1;32m"
00058 #define CL_BT_YELLOW    "\033[1;33m"
00059 #define CL_BT_BLUE              "\033[1;34m"
00060 #define CL_BT_MAGENTA   "\033[1;35m"
00061 #define CL_BT_CYAN              "\033[1;36m"
00062 #define CL_BT_WHITE             "\033[1;37m"
00063 
00064 #define CL_WTBL                 "\033[37;44m"   // white on blue
00065 #define CL_XXBL                 "\033[0;44m"    // default on blue
00066 #define CL_PASS                 "\033[0;32;42m" // green on green
00067 
00068 #define CL_SPACE                "           "   // space aquivalent of the print messages
00069 
00070 extern int stdout_with_ansisequence; // If the color ansi sequences are to be used. [flaviojs]
00071 extern char timestamp_format[20]; // For displaying Timestamps [Skotlex]
00072 
00073 enum msg_type 
00074 {
00075         MSG_NONE,
00076         MSG_STATUS,
00077         MSG_SQL,
00078         MSG_INFORMATION,
00079         MSG_NOTICE,
00080         MSG_WARNING,
00081         MSG_DEBUG,
00082         MSG_ERROR,
00083         MSG_FATALERROR
00084 };
00085 
00086 extern void ClearScreen(void);
00087 extern int ShowSub(enum msg_type t,const char *string, ...); 
00088 extern int ShowMessage(const char *, ...); 
00089 extern int ShowStatus(const char *, ...); 
00090 extern int ShowSQL(const char *, ...); 
00091 extern int ShowInfo(const char *, ...); 
00092 extern int ShowNotice(const char *, ...); 
00093 extern int ShowWarning(const char *, ...); 
00094 extern int ShowDebug(const char *, ...); 
00095 extern int ShowError(const char *, ...); 
00096 extern int ShowFatalError(const char *, ...); 
00097 
00098 #endif
 All Classes Functions