]> git.sur5r.net Git - cc65/blob - include/tgi.h
TGI Implementation
[cc65] / include / tgi.h
1 /*****************************************************************************/
2 /*                                                                           */
3 /*                                     tgi.h                                 */
4 /*                                                                           */
5 /*                            Tiny graphics interface                        */
6 /*                                                                           */
7 /*                                                                           */
8 /*                                                                           */
9 /* (C) 2002      Ullrich von Bassewitz                                       */
10 /*               Wacholderweg 14                                             */
11 /*               D-70597 Stuttgart                                           */
12 /* EMail:        uz@musoftware.de                                            */
13 /*                                                                           */
14 /*                                                                           */
15 /* This software is provided 'as-is', without any expressed or implied       */
16 /* warranty.  In no event will the authors be held liable for any damages    */
17 /* arising from the use of this software.                                    */
18 /*                                                                           */
19 /* Permission is granted to anyone to use this software for any purpose,     */
20 /* including commercial applications, and to alter it and redistribute it    */
21 /* freely, subject to the following restrictions:                            */
22 /*                                                                           */
23 /* 1. The origin of this software must not be misrepresented; you must not   */
24 /*    claim that you wrote the original software. If you use this software   */
25 /*    in a product, an acknowledgment in the product documentation would be  */
26 /*    appreciated but is not required.                                       */
27 /* 2. Altered source versions must be plainly marked as such, and must not   */
28 /*    be misrepresented as being the original software.                      */
29 /* 3. This notice may not be removed or altered from any source              */
30 /*    distribution.                                                          */
31 /*                                                                           */
32 /*****************************************************************************/
33
34
35
36 #ifndef _TGI_H
37 #define _TGI_H
38
39
40
41 #ifndef _TGI_MODE_H
42 #include "tgi/tgi-mode.h"
43 #endif
44 #ifndef _TGI_ERROR_H
45 #include "tgi/tgi-error.h"
46 #endif
47
48
49
50 /*****************************************************************************/
51 /*                                   Data                                    */
52 /*****************************************************************************/
53
54
55
56 struct palettetype {
57     unsigned char   r;          /* Red component */
58     unsigned char   g;          /* Green component */
59     unsigned char   b;          /* Blue component */
60 };
61
62
63
64 /*****************************************************************************/
65 /*                                 Functions                                 */
66 /*****************************************************************************/
67
68
69
70 void __fastcall__ tgi_load (unsigned char mode);
71 /* Install the matching driver for the given mode. Will just load the driver
72  * and check if loading was successul. Will not switch to gaphics mode.
73  */
74
75 void __fastcall__ tgi_load_driver (const char* name);
76 /* Install the given driver. This function is identical to tgi_load with the
77  * only difference that the name of the driver is specified explicitly. You
78  * should NOT use this function in most cases, use tgi_load() instead.
79  */
80
81 void __fastcall__ tgi_unload (void);
82 /* Unload the currently loaded driver. */
83
84 void __fastcall__ tgi_init (unsigned char mode);
85 /* Initialize the given graphics mode. */
86
87 void __fastcall__ tgi_done (void);
88 /* End graphics mode, switch back to text mode. Will NOT unload the driver! */
89
90 unsigned char __fastcall__ tgi_geterror (void);
91 /* Return the error code for the last operation. This will also clear the
92  * error.
93  */
94
95 void __fastcall__ tgi_clear (void);
96 /* Clear the screen */
97
98 unsigned char __fastcall__ tgi_getmaxcolor (void);
99 /* Return the maximum supported color number (the number of colors would
100  * then be getmaxcolor()+1).
101  */
102
103 unsigned __fastcall__ tgi_getmaxx (void);
104 /* Return the maximum x coordinate. The resolution in x direction is
105  * getmaxx() + 1
106  */
107
108 unsigned __fastcall__ tgi_getmaxy (void);
109 /* Return the maximum y coordinate. The resolution in y direction is
110  * getmaxy() + 1
111  */
112
113 unsigned __fastcall__ tgi_getxres (void);
114 /* Return the resolution in X direction */
115
116 unsigned __fastcall__ tgi_getyres (void);
117 /* Return the resolution in Y direction */
118
119 void __fastcall__ tgi_setcolor (unsigned char color);
120 /* Set the current drawing color */
121
122 unsigned char __fastcall__ tgi_getcolor (void);
123 /* Return the current drawing color */
124
125 unsigned char __fastcall__ tgi_getbkcolor (void);
126 /* Return the current background color */
127
128 void __fastcall__ tgi_setbkcolor (unsigned char color);
129 /* Set the background color */
130
131 unsigned char __fastcall__ tgi_getpixel (int x, int y);
132 /* Get the color value of a pixel */
133
134 void __fastcall__ tgi_setpixel (int x, int y);
135 /* Plot a point in the current drawing color */
136
137 void __fastcall__ tgi_line (int x1, int y1, int x2, int y2);
138 /* Draw a line in the current drawing color */
139
140 void __fastcall__ tgi_lineto (int x2, int y2);
141 /* Draw a line in the current drawing color from the graphics cursor to the
142  * new end point.
143  */
144
145 void __fastcall__ tgi_circle (int x, int y, unsigned char radius);
146 /* Draw a circle in the current drawing color */
147
148 void __fastcall__ tgi_outtext (int x, int y, const char* text);
149 /* Print a text in graphics mode */
150
151 void __fastcall__ tgi_bar (int x1, int y1, int x2, int y2);
152 /* Draw a bar (a filled rectangle) using the current color */
153
154
155
156 /* End of tgi.h */
157 #endif
158
159
160