1 /** EMULib Emulation Library *********************************/
2 /**                                                         **/
3 /**                        Console.h                        **/
4 /**                                                         **/
5 /** This file contains platform-independent definitions and **/
6 /** declarations for the EMULib-based console.              **/
7 /**                                                         **/
8 /** Copyright (C) Marat Fayzullin 2005-2009                 **/
9 /**     You are not allowed to distribute this software     **/
10 /**     commercially. Please, notify me, if you make any    **/
11 /**     changes to this file.                               **/
12 /*************************************************************/
13 #ifndef CONSOLE_H
14 #define CONSOLE_H
15 
16 #include "EMULib.h"
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 /** Special Characters ***************************************/
23 /** These are special characters implemented in the default **/
24 /** font and used in various standard dialogs.              **/
25 /*************************************************************/
26 #define CON_ARROW  0x01
27 #define CON_CHECK  0x02
28 #define CON_FOLDER 0x03
29 #define CON_FILE   0x04
30 #define CON_LESS   0x05
31 #define CON_MORE   0x06
32 #define CON_BUTTON 0x07
33 #define CON_BS     0x08
34 #define CON_TAB    0x09
35 #define CON_DOTS   0x0B
36 #define CON_ENTER  0x0D
37 #define CON_INSERT 0x0E
38 #define CON_DELETE 0x0F
39 #define CON_FUNC   0x10 /* 10 keys */
40 #define CON_ESCAPE 0x1B
41 
42 /** CONSetFont Modes *****************************************/
43 /** Special font designators passed to CONSetFont().        **/
44 /*************************************************************/
45 #define FNT_NORMAL (const unsigned char *)0
46 #define FNT_BOLD   (const unsigned char *)1
47 
48 /** CONInput() Modes *****************************************/
49 /** These are passed to CONInput().                         **/
50 /*************************************************************/
51 #define CON_TEXT   0x00000000
52 #define CON_DEC    0x80000000
53 #define CON_HEX    0x40000000
54 #define CON_HIDE   0x20000000
55 
56 /** CONSetColor()/CONSetFont() *******************************/
57 /** Set current foreground and background colors, and font. **/
58 /*************************************************************/
59 void CONSetColor(pixel FGColor,pixel BGColor);
60 void CONSetFont(const unsigned char *Font);
61 
62 /** CONClear() ***********************************************/
63 /** Clear screen with a given color.                        **/
64 /*************************************************************/
65 void CONClear(pixel BGColor);
66 
67 /** CONBox() *************************************************/
68 /** Draw a filled box with a given color.                   **/
69 /*************************************************************/
70 void CONBox(int X,int Y,int Width,int Height,pixel BGColor);
71 
72 /** CONFrame() ***********************************************/
73 /** Draw a frame with a given color.                        **/
74 /*************************************************************/
75 void CONFrame(int X,int Y,int Width,int Height,pixel BGColor);
76 
77 /** CONChar() ************************************************/
78 /** Print a character at given coordinates.                 **/
79 /*************************************************************/
80 void CONChar(int X,int Y,char V);
81 
82 /** PrintXY() ************************************************/
83 /** Print text at given pixel coordinates in given colors.  **/
84 /** When BG=-1, use transparent background.                 **/
85 /*************************************************************/
86 void PrintXY(Image *Img,const char *S,int X,int Y,pixel FG,int BG);
87 
88 /** CONPrint() ***********************************************/
89 /** Print a text at given coordinates with current colors.  **/
90 /*************************************************************/
91 void CONPrint(int X,int Y,const char *S);
92 
93 /** CONPrintN() **********************************************/
94 /** Print a text at given coordinates with current colors.  **/
95 /** Truncate with "..." if text length exceeds N.           **/
96 /*************************************************************/
97 void CONPrintN(int X,int Y,const char *S,int N);
98 
99 /** CONMsg() *************************************************/
100 /** Show a message box.                                     **/
101 /*************************************************************/
102 void CONMsg(int X,int Y,int W,int H,pixel FGColor,pixel BGColor,const char *Title,const char *Text);
103 
104 /** CONInput() ***********************************************/
105 /** Show an input box. Input modes (text/hex/dec) are ORed  **/
106 /** to the Length argument.                                 **/
107 /*************************************************************/
108 char *CONInput(int X,int Y,pixel FGColor,pixel BGColor,const char *Title,char *Input,unsigned int Length);
109 
110 /** CONWindow() **********************************************/
111 /** Show a titled window.                                   **/
112 /*************************************************************/
113 void CONWindow(int X,int Y,int W,int H,pixel FGColor,pixel BGColor,const char *Title);
114 
115 /** CONMenu() ************************************************/
116 /** Show a menu.                                            **/
117 /*************************************************************/
118 int CONMenu(int X,int Y,int W,int H,pixel FGColor,pixel BGColor,const char *Items,int Item);
119 
120 /** CONFile() ************************************************/
121 /** Show a file selector.                                   **/
122 /*************************************************************/
123 const char *CONFile(pixel FGColor,pixel BGColor,const char *Ext);
124 
125 #ifdef __cplusplus
126 }
127 #endif
128 #endif /* CONSOLE_H */
129