• Fichier: tgi.html
  • Path: /invader_nes/InvaderNES/build/cc65/html/tgi.html
  • File size: 43.61 KB
  • MIME-type: text/html
  • Charset: utf-8
 
Retour
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
 <LINK REL="stylesheet" TYPE="text/css" HREF="doc.css">
 <META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.71">
 <TITLE>Tiny Graphics Interface</TITLE>
</HEAD>
<BODY>
<H1>Tiny Graphics Interface</H1>

<H2>
<A HREF="mailto:uz@cc65.org">Ullrich von Bassewitz</A>,<BR>
<A HREF="mailto:polluks@sdf.lonestar.org">Stefan A. Haubenthal</A>,<BR>
<A HREF="mailto:greg.king5@verizon.net">Greg King</A></H2>
<HR>
<EM>The cc65 library provides functions for platform independent graphics.
Include the tgi.h header file to get the necessary definitions, see also
<CODE>samples/tgidemo.c</CODE> and <CODE>samples/mandelbrot.c</CODE>.</EM>
<HR>
<P>
<H2><A NAME="toc1">1.</A> <A HREF="tgi.html#s1">tgi.h</A></H2>

<UL>
<LI><A NAME="toc1.1">1.1</A> <A HREF="tgi.html#ss1.1">tgi_arc</A>
<LI><A NAME="toc1.2">1.2</A> <A HREF="tgi.html#ss1.2">tgi_bar</A>
<LI><A NAME="toc1.3">1.3</A> <A HREF="tgi.html#ss1.3">tgi_circle</A>
<LI><A NAME="toc1.4">1.4</A> <A HREF="tgi.html#ss1.4">tgi_clear</A>
<LI><A NAME="toc1.5">1.5</A> <A HREF="tgi.html#ss1.5">tgi_done</A>
<LI><A NAME="toc1.6">1.6</A> <A HREF="tgi.html#ss1.6">tgi_ellipse</A>
<LI><A NAME="toc1.7">1.7</A> <A HREF="tgi.html#ss1.7">tgi_free_vectorfont</A>
<LI><A NAME="toc1.8">1.8</A> <A HREF="tgi.html#ss1.8">tgi_getaspectratio</A>
<LI><A NAME="toc1.9">1.9</A> <A HREF="tgi.html#ss1.9">tgi_getcolor</A>
<LI><A NAME="toc1.10">1.10</A> <A HREF="tgi.html#ss1.10">tgi_getcolorcount</A>
<LI><A NAME="toc1.11">1.11</A> <A HREF="tgi.html#ss1.11">tgi_getdefpalette</A>
<LI><A NAME="toc1.12">1.12</A> <A HREF="tgi.html#ss1.12">tgi_geterror</A>
<LI><A NAME="toc1.13">1.13</A> <A HREF="tgi.html#ss1.13">tgi_geterrormsg</A>
<LI><A NAME="toc1.14">1.14</A> <A HREF="tgi.html#ss1.14">tgi_getmaxcolor</A>
<LI><A NAME="toc1.15">1.15</A> <A HREF="tgi.html#ss1.15">tgi_getmaxx</A>
<LI><A NAME="toc1.16">1.16</A> <A HREF="tgi.html#ss1.16">tgi_getmaxy</A>
<LI><A NAME="toc1.17">1.17</A> <A HREF="tgi.html#ss1.17">tgi_getpagecount</A>
<LI><A NAME="toc1.18">1.18</A> <A HREF="tgi.html#ss1.18">tgi_getpalette</A>
<LI><A NAME="toc1.19">1.19</A> <A HREF="tgi.html#ss1.19">tgi_getpixel</A>
<LI><A NAME="toc1.20">1.20</A> <A HREF="tgi.html#ss1.20">tgi_gettextheight</A>
<LI><A NAME="toc1.21">1.21</A> <A HREF="tgi.html#ss1.21">tgi_gettextwidth</A>
<LI><A NAME="toc1.22">1.22</A> <A HREF="tgi.html#ss1.22">tgi_getxres</A>
<LI><A NAME="toc1.23">1.23</A> <A HREF="tgi.html#ss1.23">tgi_getyres</A>
<LI><A NAME="toc1.24">1.24</A> <A HREF="tgi.html#ss1.24">tgi_gotoxy</A>
<LI><A NAME="toc1.25">1.25</A> <A HREF="tgi.html#ss1.25">tgi_init</A>
<LI><A NAME="toc1.26">1.26</A> <A HREF="tgi.html#ss1.26">tgi_install</A>
<LI><A NAME="toc1.27">1.27</A> <A HREF="tgi.html#ss1.27">tgi_install_vectorfont</A>
<LI><A NAME="toc1.28">1.28</A> <A HREF="tgi.html#ss1.28">tgi_ioctl</A>
<LI><A NAME="toc1.29">1.29</A> <A HREF="tgi.html#ss1.29">tgi_line</A>
<LI><A NAME="toc1.30">1.30</A> <A HREF="tgi.html#ss1.30">tgi_lineto</A>
<LI><A NAME="toc1.31">1.31</A> <A HREF="tgi.html#ss1.31">tgi_load_driver</A>
<LI><A NAME="toc1.32">1.32</A> <A HREF="tgi.html#ss1.32">tgi_load_vectorfont</A>
<LI><A NAME="toc1.33">1.33</A> <A HREF="tgi.html#ss1.33">tgi_outtext</A>
<LI><A NAME="toc1.34">1.34</A> <A HREF="tgi.html#ss1.34">tgi_outtextxy</A>
<LI><A NAME="toc1.35">1.35</A> <A HREF="tgi.html#ss1.35">tgi_pieslice</A>
<LI><A NAME="toc1.36">1.36</A> <A HREF="tgi.html#ss1.36">tgi_setaspectratio</A>
<LI><A NAME="toc1.37">1.37</A> <A HREF="tgi.html#ss1.37">tgi_setcolor</A>
<LI><A NAME="toc1.38">1.38</A> <A HREF="tgi.html#ss1.38">tgi_setdrawpage</A>
<LI><A NAME="toc1.39">1.39</A> <A HREF="tgi.html#ss1.39">tgi_setpalette</A>
<LI><A NAME="toc1.40">1.40</A> <A HREF="tgi.html#ss1.40">tgi_setpixel</A>
<LI><A NAME="toc1.41">1.41</A> <A HREF="tgi.html#ss1.41">tgi_settextscale</A>
<LI><A NAME="toc1.42">1.42</A> <A HREF="tgi.html#ss1.42">tgi_settextstyle</A>
<LI><A NAME="toc1.43">1.43</A> <A HREF="tgi.html#ss1.43">tgi_setviewpage</A>
<LI><A NAME="toc1.44">1.44</A> <A HREF="tgi.html#ss1.44">tgi_uninstall</A>
<LI><A NAME="toc1.45">1.45</A> <A HREF="tgi.html#ss1.45">tgi_unload</A>
</UL>

<HR>
<H2><A NAME="tgi.h"></A> <A NAME="s1">1.</A> <A HREF="#toc1">tgi.h</A></H2>

<H2><A NAME="tgi_arc"></A> <A NAME="ss1.1">1.1</A> <A HREF="#toc1.1">tgi_arc</A>
</H2>


<P>
<BLOCKQUOTE>
<DL>
<DT><B>Function</B><DD>
<P>Draw an elliptic arc in the current color.</P>
<DT><B>Header</B><DD>
<P><CODE>
<A HREF="#tgi.h">tgi.h</A></CODE></P>
<DT><B>Declaration</B><DD>
<P><CODE>void __fastcall__ tgi_arc (int x, int y,
unsigned char rx, unsigned char ry, unsigned sa, unsigned ea);</CODE></P>
<DT><B>Description</B><DD>
<P>The function draws an elliptic arc with center at x/y and
radii rx/ry using the current drawing color. The arc covers the angle
between sa and ea (startangle and endangle), which must be in the range
0..360.</P>
<DT><B>Notes</B><DD>
<P>
<UL>
<LI>The function is only available as fastcall function, so it may only
be used in presence of a prototype.</LI>
<LI>The function behaves unexpectedly or may crash if the angles are out
of range.</LI>
</UL>
</P>
<DT><B>Availability</B><DD>
<P>cc65</P>
<DT><B>See also</B><DD>
<P>
<A HREF="#tgi_bar">tgi_bar</A>,
<A HREF="#tgi_circle">tgi_circle</A>,
<A HREF="#tgi_ellipse">tgi_ellipse</A>,
<A HREF="#tgi_pieslice">tgi_pieslice</A>,
<A HREF="#tgi_setcolor">tgi_setcolor</A></P>
<DT><B>Example</B><DD>
<P>
<PRE>
/* Draw the upper half of an ellipse */
tgi_setcolor(TGI_COLOR_BLUE);
tgi_arc (50, 50, 40, 20, 0, 180);
</PRE>
</P>
</DL>
</BLOCKQUOTE>
</P>


<H2><A NAME="tgi_bar"></A> <A NAME="ss1.2">1.2</A> <A HREF="#toc1.2">tgi_bar</A>
</H2>


<P>
<BLOCKQUOTE>
<DL>
<DT><B>Function</B><DD>
<P>The function fills a rectangle on the drawpage with the current
color.</P>
<DT><B>Header</B><DD>
<P><CODE>
<A HREF="#tgi.h">tgi.h</A></CODE></P>
<DT><B>Declaration</B><DD>
<P><CODE>void __fastcall__ tgi_bar (int x1, int y1, int x2, int y2);</CODE></P>
<DT><B>Description</B><DD>
<P>The function fills a rectangle on the drawpage with the current
color.</P>
<DT><B>Notes</B><DD>
<P>
<UL>
<LI>The function is only available as fastcall function, so it may only
be used in presence of a prototype.</LI>
</UL>
</P>
<DT><B>Availability</B><DD>
<P>cc65</P>
<DT><B>See also</B><DD>
<P>Other tgi function</P>
<DT><B>Example</B><DD>
<P>
<PRE>
tgi_setcolor(TGI_COLOR_GREEN);
tgi_bar(10, 10, 100, 60);
</PRE>
</P>
</DL>
</BLOCKQUOTE>
</P>


<H2><A NAME="tgi_circle"></A> <A NAME="ss1.3">1.3</A> <A HREF="#toc1.3">tgi_circle</A>
</H2>


<P>
<BLOCKQUOTE>
<DL>
<DT><B>Function</B><DD>
<P>The function draws a circle in the current color.</P>
<DT><B>Header</B><DD>
<P><CODE>
<A HREF="#tgi.h">tgi.h</A></CODE></P>
<DT><B>Declaration</B><DD>
<P><CODE>void __fastcall__ tgi_circle (int x, int y, unsigned char radius);</CODE></P>
<DT><B>Description</B><DD>
<P>The function draws a circle in the current color.</P>
<DT><B>Notes</B><DD>
<P>
<UL>
<LI>The function is only available as fastcall function, so it may only
be used in presence of a prototype.</LI>
</UL>
</P>
<DT><B>Availability</B><DD>
<P>cc65</P>
<DT><B>See also</B><DD>
<P>
<A HREF="#tgi_arc">tgi_arc</A>,
<A HREF="#tgi_bar">tgi_bar</A>,
<A HREF="#tgi_ellipse">tgi_ellipse</A>,
<A HREF="#tgi_pieslice">tgi_pieslice</A>,
<A HREF="#tgi_setcolor">tgi_setcolor</A></P>
<DT><B>Example</B><DD>
<P>
<PRE>
tgi_setcolor(TGI_COLOR_BLACK);
tgi_circle(50, 40, 40);
</PRE>
</P>
</DL>
</BLOCKQUOTE>
</P>


<H2><A NAME="tgi_clear"></A> <A NAME="ss1.4">1.4</A> <A HREF="#toc1.4">tgi_clear</A>
</H2>


<P>
<BLOCKQUOTE>
<DL>
<DT><B>Function</B><DD>
<P>Clear the drawpage</P>
<DT><B>Header</B><DD>
<P><CODE>
<A HREF="#tgi.h">tgi.h</A></CODE></P>
<DT><B>Declaration</B><DD>
<P><CODE>void tgi_clear (void);</CODE></P>
<DT><B>Description</B><DD>
<P>Clear the drawpage</P>
<DT><B>Availability</B><DD>
<P>cc65</P>
<DT><B>See also</B><DD>
<P>Other tgi functions</P>
<DT><B>Example</B><DD>
<P>None.</P>
</DL>
</BLOCKQUOTE>
</P>


<H2><A NAME="tgi_done"></A> <A NAME="ss1.5">1.5</A> <A HREF="#toc1.5">tgi_done</A>
</H2>


<P>
<BLOCKQUOTE>
<DL>
<DT><B>Function</B><DD>
<P>End graphics mode, switch back to text mode.
Will NOT uninstall or unload the driver!</P>
<DT><B>Header</B><DD>
<P><CODE>
<A HREF="#tgi.h">tgi.h</A></CODE></P>
<DT><B>Declaration</B><DD>
<P><CODE>void tgi_done (void);</CODE></P>
<DT><B>Description</B><DD>
<P>End graphics mode, switch back to text mode.
Will NOT uninstall or unload the driver!</P>
<DT><B>Availability</B><DD>
<P>cc65</P>
<DT><B>See also</B><DD>
<P>Other tgi functions</P>
<DT><B>Example</B><DD>
<P>None.</P>
</DL>
</BLOCKQUOTE>
</P>


<H2><A NAME="tgi_ellipse"></A> <A NAME="ss1.6">1.6</A> <A HREF="#toc1.6">tgi_ellipse</A>
</H2>


<P>
<BLOCKQUOTE>
<DL>
<DT><B>Function</B><DD>
<P>The function draws an ellipse in the current color.</P>
<DT><B>Header</B><DD>
<P><CODE>
<A HREF="#tgi.h">tgi.h</A></CODE></P>
<DT><B>Declaration</B><DD>
<P><CODE>void __fastcall__ tgi_ellipse (int x, int y, unsigned char rx, unsigned char ry);</CODE></P>
<DT><B>Description</B><DD>
<P>The function draws an ellipse at position x/y with radii
rx and ry, using the current drawing color.</P>
<DT><B>Notes</B><DD>
<P>
<UL>
<LI>The function is only available as fastcall function, so it may only
be used in presence of a prototype.</LI>
</UL>
</P>
<DT><B>Availability</B><DD>
<P>cc65</P>
<DT><B>See also</B><DD>
<P>
<A HREF="#tgi_arc">tgi_arc</A>,
<A HREF="#tgi_bar">tgi_bar</A>,
<A HREF="#tgi_circle">tgi_circle</A>,
<A HREF="#tgi_pieslice">tgi_pieslice</A>,
<A HREF="#tgi_setcolor">tgi_setcolor</A></P>
<DT><B>Example</B><DD>
<P>
<PRE>
tgi_setcolor(TGI_COLOR_RED);
tgi_ellipse (50, 40, 40, 20);
</PRE>
</P>
</DL>
</BLOCKQUOTE>
</P>


<H2><A NAME="tgi_free_vectorfont"></A> <A NAME="ss1.7">1.7</A> <A HREF="#toc1.7">tgi_free_vectorfont</A>
</H2>


<P>
<BLOCKQUOTE>
<DL>
<DT><B>Function</B><DD>
<P>Free a vector font that was previously loaded into memory.</P>
<DT><B>Header</B><DD>
<P><CODE>
<A HREF="#tgi.h">tgi.h</A></CODE></P>
<DT><B>Declaration</B><DD>
<P><CODE>void __fastcall__ tgi_free_vectorfont (const tgi_vectorfont* font);</CODE></P>
<DT><B>Description</B><DD>
<P>Free a vector font that was previously loaded into memory.</P>
<DT><B>Notes</B><DD>
<P>
<UL>
<LI>The function is only available as fastcall function, so it may only
be used in presence of a prototype.</LI>
</UL>
</P>
<DT><B>Availability</B><DD>
<P>cc65</P>
<DT><B>See also</B><DD>
<P>
<A HREF="#tgi_load_vectorfont">tgi_load_vectorfont</A>,
<A HREF="#tgi_install_vectorfont">tgi_install_vectorfont</A></P>
<DT><B>Example</B><DD>
<P>None.</P>
</DL>
</BLOCKQUOTE>
</P>


<H2><A NAME="tgi_getaspectratio"></A> <A NAME="ss1.8">1.8</A> <A HREF="#toc1.8">tgi_getaspectratio</A>
</H2>


<P>
<BLOCKQUOTE>
 
<DL>
<DT><B>Function</B><DD>
<P>Return the pixel aspect ratio.</P>
<DT><B>Header</B><DD>
<P><CODE>
<A HREF="#tgi.h">tgi.h</A></CODE></P>
<DT><B>Declaration</B><DD>
<P><CODE>unsigned tgi_getaspectratio (void);</CODE></P>
<DT><B>Description</B><DD>
<P>The function returns the pixel aspect ratio for the current
driver and display as an 8.8 fixed point value. It may be used to correct
geometric shapes so they look correct on the display. As an example, a circle
with a radius of 100 pixels may look elliptic on some driver/display
combinations if the aspect ratio is not 1.00.</P>
<DT><B>Notes</B><DD>
<P>
<UL>
<LI>The aspect ratio is encoded in the TGI driver which assumes a "standard"
monitor for the given platform. The aspect ratio may be wrong if another
monitor is used.</LI>
<LI>No TGI function will use the aspect ratio. It is up to the programmer to
make use of it.</LI>
<LI>The 
<A HREF="#tgi_setaspectratio">tgi_setaspectratio</A> function can
be used to change the aspect ratio for a loaded driver. The value is not reset
by 
<A HREF="#tgi_init">tgi_init</A>, so if a driver is linked statically to
an application, switching into and out of graphics mode will not restore the
original aspect ratio.</LI>
</UL>
</P>
<DT><B>Availability</B><DD>
<P>cc65</P>
<DT><B>See also</B><DD>
<P>
<A HREF="#tgi_setaspectratio">tgi_setaspectratio</A></P>
<DT><B>Example</B><DD>
<P>None.</P>
</DL>
</BLOCKQUOTE>
</P>


<H2><A NAME="tgi_getcolor"></A> <A NAME="ss1.9">1.9</A> <A HREF="#toc1.9">tgi_getcolor</A>
</H2>


<P>
<BLOCKQUOTE>
<DL>
<DT><B>Function</B><DD>
<P>Return the current drawing color.</P>
<DT><B>Header</B><DD>
<P><CODE>
<A HREF="#tgi.h">tgi.h</A></CODE></P>
<DT><B>Declaration</B><DD>
<P><CODE>unsigned char tgi_getcolor (void);</CODE></P>
<DT><B>Description</B><DD>
<P>The actual color is an index to a palette. During tgi_init
you will get a default palette. The number of colors depend on the platform.
All platforms recognize at least TGI_COLOR_BLACK and TGI_COLOR_WHITE. But some
platforms have many more predefined colors. If you paint using TGI_COLOR_GREEN
and then you change the green of the palette to blue using tgi_setpalette then
after this painting in TGI_COLOR_GREEN will actually be blue.</P>
<DT><B>Availability</B><DD>
<P>cc65</P>
<DT><B>See also</B><DD>
<P>Other tgi functions</P>
<DT><B>Example</B><DD>
<P>
<PRE>
color = tgi_getcolor();
</PRE>
</P>
</DL>
</BLOCKQUOTE>
</P>


<H2><A NAME="tgi_getcolorcount"></A> <A NAME="ss1.10">1.10</A> <A HREF="#toc1.10">tgi_getcolorcount</A>
</H2>


<P>
<BLOCKQUOTE>
<DL>
<DT><B>Function</B><DD>
<P>Get the number of available colors.</P>
<DT><B>Header</B><DD>
<P><CODE>
<A HREF="#tgi.h">tgi.h</A></CODE></P>
<DT><B>Declaration</B><DD>
<P><CODE>unsigned char tgi_getcolorcount (void);</CODE></P>
<DT><B>Description</B><DD>
<P>Tgi platforms use indexed color palettes. This function
returns the number of entries we can use in the palette.</P>
<DT><B>Availability</B><DD>
<P>cc65</P>
<DT><B>See also</B><DD>
<P>Other tgi functions</P>
<DT><B>Example</B><DD>
<P>
<PRE>
if (tgi_getcolorcount() == 2) {
  printf("Only monochrome graphics is supported\n");
}
</PRE>
</P>
</DL>
</BLOCKQUOTE>
</P>


<H2><A NAME="tgi_getdefpalette"></A> <A NAME="ss1.11">1.11</A> <A HREF="#toc1.11">tgi_getdefpalette</A>
</H2>


<P>
<BLOCKQUOTE>
<DL>
<DT><B>Function</B><DD>
<P>Get the palette installed by default.</P>
<DT><B>Header</B><DD>
<P><CODE>
<A HREF="#tgi.h">tgi.h</A></CODE></P>
<DT><B>Declaration</B><DD>
<P><CODE>const unsigned char* tgi_getdefpalette (void);</CODE></P>
<DT><B>Description</B><DD>
<P>The tgi driver has a default palette that is active at startup.
The named colors TGI_COLOR_BLACK, TGI_COLOR_WHITE, TGI_COLOR_RED... need this
palette to work correctly.</P>
<DT><B>Availability</B><DD>
<P>cc65</P>
<DT><B>See also</B><DD>
<P>Other tgi functions</P>
<DT><B>Example</B><DD>
<P>None.</P>
</DL>
</BLOCKQUOTE>
</P>


<H2><A NAME="tgi_geterror"></A> <A NAME="ss1.12">1.12</A> <A HREF="#toc1.12">tgi_geterror</A>
</H2>


<P>
<BLOCKQUOTE>
<DL>
<DT><B>Function</B><DD>
<P>Return the error code for the last operation.
This will also clear the error.</P>
<DT><B>Header</B><DD>
<P><CODE>
<A HREF="#tgi.h">tgi.h</A></CODE></P>
<DT><B>Declaration</B><DD>
<P><CODE>unsigned char tgi_geterror (void);</CODE></P>
<DT><B>Description</B><DD>
<P>Return the error code for the last operation.
This will also clear the error.</P>
<DT><B>Availability</B><DD>
<P>cc65</P>
<DT><B>See also</B><DD>
<P>Other tgi functions</P>
<DT><B>Example</B><DD>
<P>None.</P>
</DL>
</BLOCKQUOTE>
</P>


<H2><A NAME="tgi_geterrormsg"></A> <A NAME="ss1.13">1.13</A> <A HREF="#toc1.13">tgi_geterrormsg</A>
</H2>


<P>
<BLOCKQUOTE>
<DL>
<DT><B>Function</B><DD>
<P>Get an error message describing the error.</P>
<DT><B>Header</B><DD>
<P><CODE>
<A HREF="#tgi.h">tgi.h</A></CODE></P>
<DT><B>Declaration</B><DD>
<P><CODE>const char* __fastcall__ tgi_geterrormsg (unsigned char code);</CODE></P>
<DT><B>Description</B><DD>
<P>Get an error message describing the error.</P>
<DT><B>Notes</B><DD>
<P>
<UL>
<LI>The function is only available as fastcall function, so it may only
be used in presence of a prototype.</LI>
</UL>
</P>
<DT><B>Availability</B><DD>
<P>cc65</P>
<DT><B>See also</B><DD>
<P>Other tgi functions</P>
<DT><B>Example</B><DD>
<P>None.</P>
</DL>
</BLOCKQUOTE>
</P>


<H2><A NAME="tgi_getmaxcolor"></A> <A NAME="ss1.14">1.14</A> <A HREF="#toc1.14">tgi_getmaxcolor</A>
</H2>


<P>
<BLOCKQUOTE>
<DL>
<DT><B>Function</B><DD>
<P>Get the highest index of the palette.</P>
<DT><B>Header</B><DD>
<P><CODE>
<A HREF="#tgi.h">tgi.h</A></CODE></P>
<DT><B>Declaration</B><DD>
<P><CODE>unsigned char tgi_getmaxcolor (void);</CODE></P>
<DT><B>Description</B><DD>
<P>Get the highest index of the palette.</P>
<DT><B>Availability</B><DD>
<P>cc65</P>
<DT><B>See also</B><DD>
<P>Other tgi functions</P>
<DT><B>Example</B><DD>
<P>None.</P>
</DL>
</BLOCKQUOTE>
</P>


<H2><A NAME="tgi_getmaxx"></A> <A NAME="ss1.15">1.15</A> <A HREF="#toc1.15">tgi_getmaxx</A>
</H2>


<P>
<BLOCKQUOTE>
<DL>
<DT><B>Function</B><DD>
<P>Get the maximum x coordinate that can be used on this screen.</P>
<DT><B>Header</B><DD>
<P><CODE>
<A HREF="#tgi.h">tgi.h</A></CODE></P>
<DT><B>Declaration</B><DD>
<P><CODE>unsigned tgi_getmaxx (void);</CODE></P>
<DT><B>Description</B><DD>
<P>Get the maximum x coordinate that can be used on this screen.</P>
<DT><B>Availability</B><DD>
<P>cc65</P>
<DT><B>See also</B><DD>
<P>Other tgi functions</P>
<DT><B>Example</B><DD>
<P>None.</P>
</DL>
</BLOCKQUOTE>
</P>


<H2><A NAME="tgi_getmaxy"></A> <A NAME="ss1.16">1.16</A> <A HREF="#toc1.16">tgi_getmaxy</A>
</H2>


<P>
<BLOCKQUOTE>
<DL>
<DT><B>Function</B><DD>
<P>Get the maximum y coordinate that can be used on this screen.</P>
<DT><B>Header</B><DD>
<P><CODE>
<A HREF="#tgi.h">tgi.h</A></CODE></P>
<DT><B>Declaration</B><DD>
<P><CODE>unsigned tgi_getmaxy (void);</CODE></P>
<DT><B>Description</B><DD>
<P>Get the maximum y coordinate that can be used on this screen.</P>
<DT><B>Availability</B><DD>
<P>cc65</P>
<DT><B>See also</B><DD>
<P>Other tgi functions</P>
<DT><B>Example</B><DD>
<P>None.</P>
</DL>
</BLOCKQUOTE>
</P>


<H2><A NAME="tgi_getpagecount"></A> <A NAME="ss1.17">1.17</A> <A HREF="#toc1.17">tgi_getpagecount</A>
</H2>


<P>
<BLOCKQUOTE>
<DL>
<DT><B>Function</B><DD>
<P>Return the number of screen pages available.</P>
<DT><B>Header</B><DD>
<P><CODE>
<A HREF="#tgi.h">tgi.h</A></CODE></P>
<DT><B>Declaration</B><DD>
<P><CODE>unsigned tgi_getpagecount (void);</CODE></P>
<DT><B>Description</B><DD>
<P>Return the number of screen pages available.</P>
<DT><B>Availability</B><DD>
<P>cc65</P>
<DT><B>See also</B><DD>
<P>
<A HREF="#tgi_setdrawpage">tgi_setdrawpage</A>,
<A HREF="#tgi_setviewpage">tgi_setviewpage</A></P>
<DT><B>Example</B><DD>
<P>None.</P>
</DL>
</BLOCKQUOTE>
</P>


<H2><A NAME="tgi_getpalette"></A> <A NAME="ss1.18">1.18</A> <A HREF="#toc1.18">tgi_getpalette</A>
</H2>


<P>
<BLOCKQUOTE>
<DL>
<DT><B>Function</B><DD>
<P>Get the palette installed.</P>
<DT><B>Header</B><DD>
<P><CODE>
<A HREF="#tgi.h">tgi.h</A></CODE></P>
<DT><B>Declaration</B><DD>
<P><CODE>const unsigned char* tgi_getpalette (void);</CODE></P>
<DT><B>Description</B><DD>
<P>Get the palette installed.</P>
<DT><B>Availability</B><DD>
<P>cc65</P>
<DT><B>See also</B><DD>
<P>Other tgi functions</P>
<DT><B>Example</B><DD>
<P>None.</P>
</DL>
</BLOCKQUOTE>
</P>


<H2><A NAME="tgi_getpixel"></A> <A NAME="ss1.19">1.19</A> <A HREF="#toc1.19">tgi_getpixel</A>
</H2>


<P>
<BLOCKQUOTE>
<DL>
<DT><B>Function</B><DD>
<P>Get the color of a pixel from the viewpage.</P>
<DT><B>Header</B><DD>
<P><CODE>
<A HREF="#tgi.h">tgi.h</A></CODE></P>
<DT><B>Declaration</B><DD>
<P><CODE>unsigned char __fastcall__ tgi_getpixel (int x, int y);</CODE></P>
<DT><B>Description</B><DD>
<P>Get the color of a pixel from the viewpage.</P>
<DT><B>Notes</B><DD>
<P>
<UL>
<LI>The function is only available as fastcall function, so it may only
be used in presence of a prototype.</LI>
</UL>
</P>
<DT><B>Availability</B><DD>
<P>cc65</P>
<DT><B>See also</B><DD>
<P>Other tgi functions.</P>
<DT><B>Example</B><DD>
<P>None.</P>
</DL>
</BLOCKQUOTE>
</P>


<H2><A NAME="tgi_gettextheight"></A> <A NAME="ss1.20">1.20</A> <A HREF="#toc1.20">tgi_gettextheight</A>
</H2>


<P>
<BLOCKQUOTE>
<DL>
<DT><B>Function</B><DD>
<P>Calculate the height of the text in pixels according to
the current text style.</P>
<DT><B>Header</B><DD>
<P><CODE>
<A HREF="#tgi.h">tgi.h</A></CODE></P>
<DT><B>Declaration</B><DD>
<P><CODE>unsigned __fastcall__ tgi_gettextheight (const char* s);</CODE></P>
<DT><B>Description</B><DD>
<P>Calculate the height of the text in pixels according to
the current text style.</P>
<DT><B>Notes</B><DD>
<P>
<UL>
<LI>The function is only available as fastcall function, so it may only
be used in presence of a prototype.</LI>
</UL>
</P>
<DT><B>Availability</B><DD>
<P>cc65</P>
<DT><B>See also</B><DD>
<P>Other tgi functions.</P>
<DT><B>Example</B><DD>
<P>None.</P>
</DL>
</BLOCKQUOTE>
</P>


<H2><A NAME="tgi_gettextwidth"></A> <A NAME="ss1.21">1.21</A> <A HREF="#toc1.21">tgi_gettextwidth</A>
</H2>


<P>
<BLOCKQUOTE>
<DL>
<DT><B>Function</B><DD>
<P>Calculate the width of the text in pixels according to the current text style.</P>
<DT><B>Header</B><DD>
<P><CODE>
<A HREF="#tgi.h">tgi.h</A></CODE></P>
<DT><B>Declaration</B><DD>
<P><CODE>unsigned __fastcall__ tgi_gettextwidth (const char* s);</CODE></P>
<DT><B>Description</B><DD>
<P>Calculate the width of the text in pixels according to the current text style.</P>
<DT><B>Notes</B><DD>
<P>
<UL>
<LI>The function is only available as fastcall function, so it may only
be used in presence of a prototype.</LI>
</UL>
</P>
<DT><B>Availability</B><DD>
<P>cc65</P>
<DT><B>See also</B><DD>
<P>Other tgi functions.</P>
<DT><B>Example</B><DD>
<P>None.</P>
</DL>
</BLOCKQUOTE>
</P>


<H2><A NAME="tgi_getxres"></A> <A NAME="ss1.22">1.22</A> <A HREF="#toc1.22">tgi_getxres</A>
</H2>


<P>
<BLOCKQUOTE>
<DL>
<DT><B>Function</B><DD>
<P>Get number of horisontal pixels on the screen.</P>
<DT><B>Header</B><DD>
<P><CODE>
<A HREF="#tgi.h">tgi.h</A></CODE></P>
<DT><B>Declaration</B><DD>
<P><CODE>unsigned tgi_getxres (void);</CODE></P>
<DT><B>Description</B><DD>
<P>Get number of horisontal pixels on the screen.
This is same as tgi_maxx()+1.</P>
<DT><B>Availability</B><DD>
<P>cc65</P>
<DT><B>See also</B><DD>
<P>Other tgi functions.</P>
<DT><B>Example</B><DD>
<P>None.</P>
</DL>
</BLOCKQUOTE>
</P>


<H2><A NAME="tgi_getyres"></A> <A NAME="ss1.23">1.23</A> <A HREF="#toc1.23">tgi_getyres</A>
</H2>


<P>
<BLOCKQUOTE>
<DL>
<DT><B>Function</B><DD>
<P>Get number of vertical pixels on the screen.</P>
<DT><B>Header</B><DD>
<P><CODE>
<A HREF="#tgi.h">tgi.h</A></CODE></P>
<DT><B>Declaration</B><DD>
<P><CODE>unsigned tgi_getyres (void);</CODE></P>
<DT><B>Description</B><DD>
<P>Get number of vertical pixels on the screen.
This is same as tgi_maxy()+1.</P>
<DT><B>Availability</B><DD>
<P>cc65</P>
<DT><B>See also</B><DD>
<P>Other tgi functions.</P>
<DT><B>Example</B><DD>
<P>None.</P>
</DL>
</BLOCKQUOTE>
</P>


<H2><A NAME="tgi_gotoxy"></A> <A NAME="ss1.24">1.24</A> <A HREF="#toc1.24">tgi_gotoxy</A>
</H2>


<P>
<BLOCKQUOTE>
<DL>
<DT><B>Function</B><DD>
<P>Set graphics cursor at x, y.</P>
<DT><B>Header</B><DD>
<P><CODE>
<A HREF="#tgi.h">tgi.h</A></CODE></P>
<DT><B>Declaration</B><DD>
<P><CODE>void __fastcall__ tgi_gotoxy (int x, int y);</CODE></P>
<DT><B>Description</B><DD>
<P>Set graphics cursor at x, y.</P>
<DT><B>Notes</B><DD>
<P>
<UL>
<LI>The function is only available as fastcall function, so it may only
be used in presence of a prototype.</LI>
</UL>
</P>
<DT><B>Availability</B><DD>
<P>cc65</P>
<DT><B>See also</B><DD>
<P>Other tgi functions.</P>
<DT><B>Example</B><DD>
<P>None.</P>
</DL>
</BLOCKQUOTE>
</P>


<H2><A NAME="tgi_init"></A> <A NAME="ss1.25">1.25</A> <A HREF="#toc1.25">tgi_init</A>
</H2>


<P>
<BLOCKQUOTE>
<DL>
<DT><B>Function</B><DD>
<P>Initialize the already loaded graphics driver.</P>
<DT><B>Header</B><DD>
<P><CODE>
<A HREF="#tgi.h">tgi.h</A></CODE></P>
<DT><B>Declaration</B><DD>
<P><CODE>void tgi_init (void);</CODE></P>
<DT><B>Description</B><DD>
<P>The tgi_init function will set the default palette to the
hardware.</P>
<DT><B>Notes</B><DD>
<P>
<UL>
<LI><CODE>tgi_init</CODE> will not clear the screen. This allows switching between
text and graphics mode on platforms that have separate memory areas for the
screens. If you want the screen cleared, call <CODE>
<A HREF="#tgi_clear">tgi_clear</A></CODE> after <CODE>tgi_init</CODE>.</LI>
</UL>
</P>
<DT><B>Availability</B><DD>
<P>cc65</P>
<DT><B>See also</B><DD>
<P>Other tgi functions.</P>
<DT><B>Example</B><DD>
<P>
<PRE>
tgi_install(tgi_static_stddrv); //Include the driver statically instead of loading it.
tgi_init(); //Set up the default palette and clear the screen.
</PRE>
</P>
</DL>
</BLOCKQUOTE>
</P>


<H2><A NAME="tgi_install"></A> <A NAME="ss1.26">1.26</A> <A HREF="#toc1.26">tgi_install</A>
</H2>


<P>
<BLOCKQUOTE>
<DL>
<DT><B>Function</B><DD>
<P>Install an already loaded driver and return an error code.</P>
<DT><B>Header</B><DD>
<P><CODE>
<A HREF="#tgi.h">tgi.h</A></CODE></P>
<DT><B>Declaration</B><DD>
<P><CODE>unsigned char __fastcall__ tgi_install (void* driver);</CODE></P>
<DT><B>Description</B><DD>
<P>The function installs a driver that was already loaded into
memory (or linked statically to the program). It returns an error code
(<CODE>TGI_ERR_OK</CODE> in case of success).</P>
<DT><B>Notes</B><DD>
<P>
<UL>
<LI>The function is only available as fastcall function, so it may only be
used in presence of a prototype.</LI>
</UL>
</P>
<DT><B>Availability</B><DD>
<P>cc65</P>
<DT><B>See also</B><DD>
<P>
<A HREF="#tgi_load_driver">tgi_load_driver</A>,
<A HREF="#tgi_uninstall">tgi_uninstall</A>,
<A HREF="#tgi_unload">tgi_unload</A></P>
<DT><B>Example</B><DD>
<P>
<PRE>
tgi_install(tgi_static_stddrv); //Include the driver statically instead of loading it.
tgi_init(); //Set up the default palette and clear the screen.
</PRE>
</P>
</DL>
</BLOCKQUOTE>
</P>


<H2><A NAME="tgi_install_vectorfont"></A> <A NAME="ss1.27">1.27</A> <A HREF="#toc1.27">tgi_install_vectorfont</A>
</H2>


<P>
<BLOCKQUOTE>
<DL>
<DT><B>Function</B><DD>
<P>Install an already loaded driver and return an error code.</P>
<DT><B>Header</B><DD>
<P><CODE>
<A HREF="#tgi.h">tgi.h</A></CODE></P>
<DT><B>Declaration</B><DD>
<P><CODE>void __fastcall__ tgi_install_vectorfont (const tgi_vectorfont* font);</CODE></P>
<DT><B>Description</B><DD>
<P>Install a vector font for use. More than one vector font can be loaded,
but only one can be active. This function is used to tell which one. Call
with a NULL pointer to uninstall the currently installed font.</P>
<DT><B>Notes</B><DD>
<P>
<UL>
<LI>The function is only available as fastcall function, so it may only be
used in presence of a prototype.</LI>
</UL>
</P>
<DT><B>Availability</B><DD>
<P>cc65</P>
<DT><B>See also</B><DD>
<P>
<A HREF="#tgi_load_vectorfont">tgi_load_vectorfont</A>,
<A HREF="#tgi_free_vectorfont">tgi_free_vectorfont</A></P>
<DT><B>Example</B><DD>
<P>None.</P>
</DL>
</BLOCKQUOTE>
</P>


<H2><A NAME="tgi_ioctl"></A> <A NAME="ss1.28">1.28</A> <A HREF="#toc1.28">tgi_ioctl</A>
</H2>


<P>
<BLOCKQUOTE>
<DL>
<DT><B>Function</B><DD>
<P>Platform dependent code extensions.</P>
<DT><B>Header</B><DD>
<P><CODE>
<A HREF="#tgi.h">tgi.h</A></CODE></P>
<DT><B>Declaration</B><DD>
<P><CODE>unsigned __fastcall__ tgi_ioctl (unsigned char code, void* data);</CODE></P>
<DT><B>Description</B><DD>
<P>Some platforms have extra display hardware that is not
supported by standard tgi functions. You can extend the driver to support
this extra hardware using tgi_ioctl functions.</P>
<DT><B>Notes</B><DD>
<P>
<UL>
<LI>The function is only available as fastcall function, so it may only
be used in presence of a prototype.</LI>
<LI>These functions are not easily portable to other cc65 platforms.</LI>
</UL>
</P>
<DT><B>Availability</B><DD>
<P>cc65</P>
<DT><B>See also</B><DD>
<P>Other tgi functions.</P>
<DT><B>Example</B><DD>
<P>
<PRE>
#define tgi_sprite(spr) tgi_ioctl(0, (void*)(spr))
#define tgi_flip() tgi_ioctl(1, (void*)0)
#define tgi_setbgcolor(bgcol) tgi_ioctl(2, (void*)(bgcol))
#define tgi_setframerate(rate) tgi_ioctl(3, (void*)(rate))
#define tgi_busy() tgi_ioctl(4, (void*)0)
#define tgi_updatedisplay() tgi_ioctl(4, (void*)1)
if (!tgi_busy()) {
  tgi_sprite(&amp;background);
  tgi_setcolor(TGI_COLOR_BLUE);
  tgi_outttextxy(20,40,"Hello World");
  tgi_updatedisplay();
}
</PRE>
</P>
</DL>
</BLOCKQUOTE>
</P>


<H2><A NAME="tgi_line"></A> <A NAME="ss1.29">1.29</A> <A HREF="#toc1.29">tgi_line</A>
</H2>


<P>
<BLOCKQUOTE>
<DL>
<DT><B>Function</B><DD>
<P>Draw a line in the current drawing color.
The graphics cursor will be set to x2/y2 by this call.</P>
<DT><B>Header</B><DD>
<P><CODE>
<A HREF="#tgi.h">tgi.h</A></CODE></P>
<DT><B>Declaration</B><DD>
<P><CODE>void __fastcall__ tgi_line (int x1, int y1, int x2, int y2);</CODE></P>
<DT><B>Description</B><DD>
<P>Draw a line in the current drawing color.
The graphics cursor will be set to x2/y2 by this call.</P>
<DT><B>Notes</B><DD>
<P>
<UL>
<LI>The function is only available as fastcall function, so it may only
be used in presence of a prototype.</LI>
</UL>
</P>
<DT><B>Availability</B><DD>
<P>cc65</P>
<DT><B>See also</B><DD>
<P>Other tgi functions.</P>
<DT><B>Example</B><DD>
<P>None.</P>
</DL>
</BLOCKQUOTE>
</P>


<H2><A NAME="tgi_lineto"></A> <A NAME="ss1.30">1.30</A> <A HREF="#toc1.30">tgi_lineto</A>
</H2>


<P>
<BLOCKQUOTE>
<DL>
<DT><B>Function</B><DD>
<P>Draw a line in the current drawing color from the graphics
cursor to the new end point. The graphics cursor will be updated to x2/y2.</P>
<DT><B>Header</B><DD>
<P><CODE>
<A HREF="#tgi.h">tgi.h</A></CODE></P>
<DT><B>Declaration</B><DD>
<P><CODE>void __fastcall__ tgi_lineto (int x2, int y2);</CODE></P>
<DT><B>Description</B><DD>
<P>Draw a line in the current drawing color from the graphics
cursor to the new end point. The graphics cursor will be updated to x2/y2.</P>
<DT><B>Notes</B><DD>
<P>
<UL>
<LI>The function is only available as fastcall function, so it may only
be used in presence of a prototype.</LI>
</UL>
</P>
<DT><B>Availability</B><DD>
<P>cc65</P>
<DT><B>See also</B><DD>
<P>Other tgi functions.</P>
<DT><B>Example</B><DD>
<P>None.</P>
</DL>
</BLOCKQUOTE>
</P>


<H2><A NAME="tgi_load_driver"></A> <A NAME="ss1.31">1.31</A> <A HREF="#toc1.31">tgi_load_driver</A>
</H2>


<P>
<BLOCKQUOTE>
<DL>
<DT><B>Function</B><DD>
<P>Load and install the given driver.</P>
<DT><B>Header</B><DD>
<P><CODE>
<A HREF="#tgi.h">tgi.h</A></CODE></P>
<DT><B>Declaration</B><DD>
<P><CODE>void __fastcall__ tgi_load_driver (const char *name);</CODE></P>
<DT><B>Description</B><DD>
<P>Load and install the driver by name.
Will just load the driver and check if loading was successful.
Will not switch to graphics mode.</P>
<DT><B>Notes</B><DD>
<P>
<UL>
<LI>The function is only available as fastcall function, so it may only
be used in presence of a prototype.</LI>
</UL>
</P>
<DT><B>Availability</B><DD>
<P>cc65</P>
<DT><B>See also</B><DD>
<P>Other tgi functions.</P>
<DT><B>Example</B><DD>
<P>None.</P>
</DL>
</BLOCKQUOTE>
</P>


<H2><A NAME="tgi_load_vectorfont"></A> <A NAME="ss1.32">1.32</A> <A HREF="#toc1.32">tgi_load_vectorfont</A>
</H2>


<P>
<BLOCKQUOTE>
<DL>
<DT><B>Function</B><DD>
<P>Load the given vector font.</P>
<DT><B>Header</B><DD>
<P><CODE>
<A HREF="#tgi.h">tgi.h</A></CODE></P>
<DT><B>Declaration</B><DD>
<P><CODE>const tgi_vectorfont* __fastcall__ tgi_load_vectorfont (const char* name);</CODE></P>
<DT><B>Description</B><DD>
<P>Load a vector font into memory and return it. In case of errors, NULL is
returned and an error is set, which can be retrieved using tgi_geterror.
To use the font, it has to be installed using tgi_install_vectorfont.</P>
<DT><B>Notes</B><DD>
<P>
<UL>
<LI>The function is only available as fastcall function, so it may only
be used in presence of a prototype.</LI>
</UL>
</P>
<DT><B>Availability</B><DD>
<P>cc65</P>
<DT><B>See also</B><DD>
<P>
<A HREF="#tgi_install_vectorfont">tgi_install_vectorfont</A>,
<A HREF="#tgi_free_vectorfont">tgi_free_vectorfont</A></P>
<DT><B>Example</B><DD>
<P>None.</P>
</DL>
</BLOCKQUOTE>
</P>


<H2><A NAME="tgi_outtext"></A> <A NAME="ss1.33">1.33</A> <A HREF="#toc1.33">tgi_outtext</A>
</H2>


<P>
<BLOCKQUOTE>
<DL>
<DT><B>Function</B><DD>
<P>Output text at the current graphics cursor position.
The graphics cursor is moved to the end of the text.</P>
<DT><B>Header</B><DD>
<P><CODE>
<A HREF="#tgi.h">tgi.h</A></CODE></P>
<DT><B>Declaration</B><DD>
<P><CODE>void __fastcall__ tgi_outtext (const char* s);</CODE></P>
<DT><B>Description</B><DD>
<P>Output text at the current graphics cursor position.
The graphics cursor is moved to the end of the text.</P>
<DT><B>Notes</B><DD>
<P>
<UL>
<LI>The function is only available as fastcall function, so it may only
be used in presence of a prototype.</LI>
</UL>
</P>
<DT><B>Availability</B><DD>
<P>cc65</P>
<DT><B>See also</B><DD>
<P>Other tgi functions.</P>
<DT><B>Example</B><DD>
<P>None.</P>
</DL>
</BLOCKQUOTE>
</P>


<H2><A NAME="tgi_outtextxy"></A> <A NAME="ss1.34">1.34</A> <A HREF="#toc1.34">tgi_outtextxy</A>
</H2>


<P>
<BLOCKQUOTE>
<DL>
<DT><B>Function</B><DD>
<P>Output text at the given cursor position.
The graphics cursor is moved to the end of the text.</P>
<DT><B>Header</B><DD>
<P><CODE>
<A HREF="#tgi.h">tgi.h</A></CODE></P>
<DT><B>Declaration</B><DD>
<P><CODE>void __fastcall__ tgi_outtextxy (int x, int y, const char* s);</CODE></P>
<DT><B>Description</B><DD>
<P>Output text at the given cursor position.
The graphics cursor is moved to the end of the text.</P>
<DT><B>Notes</B><DD>
<P>
<UL>
<LI>The function is only available as fastcall function, so it may only
be used in presence of a prototype.</LI>
</UL>
</P>
<DT><B>Availability</B><DD>
<P>cc65</P>
<DT><B>See also</B><DD>
<P>Other tgi functions.</P>
<DT><B>Example</B><DD>
<P>None.</P>
</DL>
</BLOCKQUOTE>
</P>


<H2><A NAME="tgi_pieslice"></A> <A NAME="ss1.35">1.35</A> <A HREF="#toc1.35">tgi_pieslice</A>
</H2>


<P>
<BLOCKQUOTE>
<DL>
<DT><B>Function</B><DD>
<P>Draw an elliptic pie slice in the current color.</P>
<DT><B>Header</B><DD>
<P><CODE>
<A HREF="#tgi.h">tgi.h</A></CODE></P>
<DT><B>Declaration</B><DD>
<P><CODE>void __fastcall__ tgi_pie slice (int x, int y,
unsigned char rx, unsigned char ry, unsigned sa, unsigned ea);</CODE></P>
<DT><B>Description</B><DD>
<P>The function draws an elliptic pie slice with center at x/y
and radii rx/ry using the current drawing color. The pie slice covers the angle
between sa and ea (startangle and endangle), which must be in the range
0..360.</P>
<DT><B>Notes</B><DD>
<P>
<UL>
<LI>The function is only available as fastcall function, so it may only
be used in presence of a prototype.</LI>
<LI>The function behaves unexpectedly or may crash if the angles are out
of range.</LI>
</UL>
</P>
<DT><B>Availability</B><DD>
<P>cc65</P>
<DT><B>See also</B><DD>
<P>
<A HREF="#tgi_bar">tgi_arc</A>,
<A HREF="#tgi_bar">tgi_bar</A>,
<A HREF="#tgi_circle">tgi_circle</A>,
<A HREF="#tgi_ellipse">tgi_ellipse</A>,
<A HREF="#tgi_setcolor">tgi_setcolor</A></P>
<DT><B>Example</B><DD>
<P>
<PRE>
/* Draw the closed upper half of an ellipse */
tgi_setcolor(TGI_COLOR_BLUE);
tgi_pieslice (50, 50, 40, 20, 0, 180);
</PRE>
</P>
</DL>
</BLOCKQUOTE>
</P>


<H2><A NAME="tgi_setaspectratio"></A> <A NAME="ss1.36">1.36</A> <A HREF="#toc1.36">tgi_setaspectratio</A>
</H2>


<P>
<BLOCKQUOTE>
 
<DL>
<DT><B>Function</B><DD>
<P>Set the pixel aspect ratio.</P>
<DT><B>Header</B><DD>
<P><CODE>
<A HREF="#tgi.h">tgi.h</A></CODE></P>
<DT><B>Declaration</B><DD>
<P><CODE>void __fastcall__ tgi_setaspectratio (unsigned ratio);</CODE></P>
<DT><B>Description</B><DD>
<P>The function sets the pixel aspect ratio for the current
driver and display. The argument is an 8.8 fixed point value. The aspect ratio
may be used to correct geometric shapes so they look correct on a given
display. As an example, a circle with a radius of 100 pixels may look elliptic
on some driver/display combinations if the aspect ratio is not 1.00.</P>
<DT><B>Notes</B><DD>
<P>
<UL>
<LI>The aspect ratio is encoded in the TGI driver which assumes a "standard"
monitor for the given platform. The aspect ratio may be wrong if another
monitor is used.</LI>
<LI>No TGI function will use the aspect ratio. It is up to the programmer to
make use of it.</LI>
<LI>The <CODE>tgi_setaspectratio</CODE> function can be used to change the aspect
ratio for a loaded driver. The value is not reset by 
<A HREF="#tgi_init">tgi_init</A>, so if a driver is linked statically to an application,
switching into and out of graphics mode will not restore the original aspect
ratio.</LI>
<LI>The function is available only as a fastcall function; so, it may be used
only in the presence of a prototype.</LI>
</UL>
</P>
<DT><B>Availability</B><DD>
<P>cc65</P>
<DT><B>See also</B><DD>
<P>
<A HREF="#tgi_getaspectratio">tgi_getaspectratio</A></P>
<DT><B>Example</B><DD>
<P>None.</P>
</DL>
</BLOCKQUOTE>
</P>


<H2><A NAME="tgi_setcolor"></A> <A NAME="ss1.37">1.37</A> <A HREF="#toc1.37">tgi_setcolor</A>
</H2>


<P>
<BLOCKQUOTE>
<DL>
<DT><B>Function</B><DD>
<P>Set color to be used in future draw operations.</P>
<DT><B>Header</B><DD>
<P><CODE>
<A HREF="#tgi.h">tgi.h</A></CODE></P>
<DT><B>Declaration</B><DD>
<P><CODE>void __fastcall__ tgi_setcolor (unsigned char color);</CODE></P>
<DT><B>Description</B><DD>
<P>Set color to be used in future draw operations.</P>
<DT><B>Notes</B><DD>
<P>
<UL>
<LI>The function is only available as fastcall function, so it may only
be used in presence of a prototype.</LI>
</UL>
</P>
<DT><B>Availability</B><DD>
<P>cc65</P>
<DT><B>See also</B><DD>
<P>Other tgi functions.</P>
<DT><B>Example</B><DD>
<P>
<PRE>
tgi_setcolor(TGI_COLOR_BLACK);
tgi_bar(0,0,30,30);
tgi_setcolor(TGI_COLOR_WHITE);
tgi_bar(10,10,20,20);
</PRE>
</P>
</DL>
</BLOCKQUOTE>
</P>


<H2><A NAME="tgi_setdrawpage"></A> <A NAME="ss1.38">1.38</A> <A HREF="#toc1.38">tgi_setdrawpage</A>
</H2>


<P>
<BLOCKQUOTE>
<DL>
<DT><B>Function</B><DD>
<P>Set the page for drawing.</P>
<DT><B>Header</B><DD>
<P><CODE>
<A HREF="#tgi.h">tgi.h</A></CODE></P>
<DT><B>Declaration</B><DD>
<P><CODE>void __fastcall__ tgi_setdrawpage (unsigned char page);</CODE></P>
<DT><B>Description</B><DD>
<P>If the drawpage and the viewpage are the same then all drawing
is seen immediately as it is drawn. For double buffered games you can set the
drawpage to a different page than the viewpage. This lets you draw the next
screen in the background and when the screen is ready you display it.</P>
<DT><B>Notes</B><DD>
<P>
<UL>
<LI>The function is only available as fastcall function, so it may only
be used in presence of a prototype.</LI>
</UL>
</P>
<DT><B>Availability</B><DD>
<P>cc65</P>
<DT><B>See also</B><DD>
<P>Other tgi functions.</P>
<DT><B>Example</B><DD>
<P>
<PRE>
tgi_setdrawpage(1);
tgi_outtextxy(10, 10, "Hello World");
tgi_setviewpage(1); // Show page 1
tgi_setdrawpage(0);
tgi_outtextxy(10, 10, "Creating next frame");
...
tgi_setviewpage(0); // Show page 0
</PRE>
</P>
</DL>
</BLOCKQUOTE>
</P>


<H2><A NAME="tgi_setpalette"></A> <A NAME="ss1.39">1.39</A> <A HREF="#toc1.39">tgi_setpalette</A>
</H2>


<P>
<BLOCKQUOTE>
<DL>
<DT><B>Function</B><DD>
<P>Set the palette (not available with all drivers/hardware).
Palette is a pointer to as many entries as there are colors.</P>
<DT><B>Header</B><DD>
<P><CODE>
<A HREF="#tgi.h">tgi.h</A></CODE></P>
<DT><B>Declaration</B><DD>
<P><CODE>void __fastcall__ tgi_setpalette (const unsigned char* palette);</CODE></P>
<DT><B>Description</B><DD>
<P>Set the palette (not available with all drivers/hardware).
Palette is a pointer to as many entries as there are colors.</P>
<DT><B>Notes</B><DD>
<P>
<UL>
<LI>The function is only available as fastcall function, so it may only
be used in presence of a prototype.</LI>
</UL>
</P>
<DT><B>Availability</B><DD>
<P>cc65</P>
<DT><B>See also</B><DD>
<P>Other tgi functions.</P>
<DT><B>Example</B><DD>
<P>None.</P>
</DL>
</BLOCKQUOTE>
</P>


<H2><A NAME="tgi_setpixel"></A> <A NAME="ss1.40">1.40</A> <A HREF="#toc1.40">tgi_setpixel</A>
</H2>


<P>
<BLOCKQUOTE>
<DL>
<DT><B>Function</B><DD>
<P>Plot a pixel on the drawpage with the current color.</P>
<DT><B>Header</B><DD>
<P><CODE>
<A HREF="#tgi.h">tgi.h</A></CODE></P>
<DT><B>Declaration</B><DD>
<P><CODE>void __fastcall__ tgi_setpixel (int x, int y);</CODE></P>
<DT><B>Description</B><DD>
<P>Plot a pixel on the drawpage with the current color.</P>
<DT><B>Notes</B><DD>
<P>
<UL>
<LI>The function is only available as fastcall function, so it may only
be used in presence of a prototype.</LI>
</UL>
</P>
<DT><B>Availability</B><DD>
<P>cc65</P>
<DT><B>See also</B><DD>
<P>Other tgi functions.</P>
<DT><B>Example</B><DD>
<P>None.</P>
</DL>
</BLOCKQUOTE>
</P>


<H2><A NAME="tgi_settextscale"></A> <A NAME="ss1.41">1.41</A> <A HREF="#toc1.41">tgi_settextscale</A>
</H2>


<P>
<BLOCKQUOTE>
<DL>
<DT><B>Function</B><DD>
<P>Set the scaling for text output.</P>
<DT><B>Header</B><DD>
<P><CODE>
<A HREF="#tgi.h">tgi.h</A></CODE></P>
<DT><B>Declaration</B><DD>
<P><CODE>void __fastcall__ tgi_settextscale (unsigned width, unsigned height);</CODE></P>
<DT><B>Description</B><DD>
<P>Set the scaling for text output. The scaling factors for width and height
are 8.8 fixed point values. This means that $100 = 1 $200 = 2 etc.</P>
<DT><B>Notes</B><DD>
<P>
<UL>
<LI>The function is only available as fastcall function, so it may only
be used in presence of a prototype.</LI>
</UL>
</P>
<DT><B>Availability</B><DD>
<P>cc65</P>
<DT><B>See also</B><DD>
<P>
<A HREF="#tgi_settextstyle">tgi_settextstyle</A></P>
<DT><B>Example</B><DD>
<P>None.</P>
</DL>
</BLOCKQUOTE>
</P>


<H2><A NAME="tgi_settextstyle"></A> <A NAME="ss1.42">1.42</A> <A HREF="#toc1.42">tgi_settextstyle</A>
</H2>


<P>
<BLOCKQUOTE>
<DL>
<DT><B>Function</B><DD>
<P>Set the style for text output.</P>
<DT><B>Header</B><DD>
<P><CODE>
<A HREF="#tgi.h">tgi.h</A></CODE></P>
<DT><B>Declaration</B><DD>
<P><CODE>void __fastcall__ tgi_settextstyle (unsigned char magx, unsigned char magy, unsigned char dir, unsigned char font);</CODE></P>
<DT><B>Description</B><DD>
<P>Set the style for text output.</P>
<DT><B>Notes</B><DD>
<P>
<UL>
<LI>The function is only available as fastcall function, so it may only
be used in presence of a prototype.</LI>
</UL>
</P>
<DT><B>Availability</B><DD>
<P>cc65</P>
<DT><B>See also</B><DD>
<P>
<A HREF="#tgi_settextscale">tgi_settextscale</A></P>
<DT><B>Example</B><DD>
<P>None.</P>
</DL>
</BLOCKQUOTE>
</P>


<H2><A NAME="tgi_setviewpage"></A> <A NAME="ss1.43">1.43</A> <A HREF="#toc1.43">tgi_setviewpage</A>
</H2>


<P>
<BLOCKQUOTE>
<DL>
<DT><B>Function</B><DD>
<P>Set page to be visible on screen.</P>
<DT><B>Header</B><DD>
<P><CODE>
<A HREF="#tgi.h">tgi.h</A></CODE></P>
<DT><B>Declaration</B><DD>
<P><CODE>void __fastcall__ tgi_setviewpage (unsigned char page);</CODE></P>
<DT><B>Description</B><DD>
<P>If the drawpage and the viewpage are the same then all drawing
is seen immediately as it is drawn. For double buffered games you can set the
drawpage to a different page than the viewpage. This lets you draw the next
screen in the background and when the screen is ready you display it.</P>
<DT><B>Notes</B><DD>
<P>
<UL>
<LI>The function is only available as fastcall function, so it may only
be used in presence of a prototype.</LI>
</UL>
</P>
<DT><B>Availability</B><DD>
<P>cc65</P>
<DT><B>See also</B><DD>
<P>Other tgi functions.</P>
<DT><B>Example</B><DD>
<P>
<PRE>
tgi_setdrawpage(1);
tgi_outtextxy(10, 10, "Hello World");
tgi_setviewpage(1); // Show page 1
tgi_setdrawpage(0);
tgi_outtextxy(10, 10, "Creating next frame");
...
tgi_setviewpage(0); // Show page 0
</PRE>
</P>
</DL>
</BLOCKQUOTE>
</P>


<H2><A NAME="tgi_uninstall"></A> <A NAME="ss1.44">1.44</A> <A HREF="#toc1.44">tgi_uninstall</A>
</H2>


<P>
<BLOCKQUOTE>
<DL>
<DT><B>Function</B><DD>
<P>Uninstall the currently loaded driver but do not unload it.
Will call tgi_done if necessary.</P>
<DT><B>Header</B><DD>
<P><CODE>
<A HREF="#tgi.h">tgi.h</A></CODE></P>
<DT><B>Declaration</B><DD>
<P><CODE>void tgi_uninstall (void);</CODE></P>
<DT><B>Description</B><DD>
<P>Uninstall the currently loaded driver but do not unload it.
Will call tgi_done if necessary.</P>
<DT><B>Availability</B><DD>
<P>cc65</P>
<DT><B>See also</B><DD>
<P>Other tgi functions.</P>
<DT><B>Example</B><DD>
<P>None.</P>
</DL>
</BLOCKQUOTE>
</P>


<H2><A NAME="tgi_unload"></A> <A NAME="ss1.45">1.45</A> <A HREF="#toc1.45">tgi_unload</A>
</H2>


<P>
<BLOCKQUOTE>
<DL>
<DT><B>Function</B><DD>
<P>Uninstall, then unload the currently loaded driver.
Will call tgi_done if necessary.</P>
<DT><B>Header</B><DD>
<P><CODE>
<A HREF="#tgi.h">tgi.h</A></CODE></P>
<DT><B>Declaration</B><DD>
<P><CODE>void tgi_unload (void);</CODE></P>
<DT><B>Description</B><DD>
<P>Uninstall, then unload the currently loaded driver.
Will call tgi_done if necessary.</P>
<DT><B>Availability</B><DD>
<P>cc65</P>
<DT><B>See also</B><DD>
<P>Other tgi functions.</P>
<DT><B>Example</B><DD>
<P>None.</P>
</DL>
</BLOCKQUOTE>
</P>


</BODY>
</HTML>