<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html><head><title> Allegro Manual: Available Allegro examples </title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta http-equiv="Content-Style-Type" content="text/css"> <link rel="stylesheet" title="Default" type="text/css" href="allegro.css"></head><body bgcolor=white text=black link="#0000ee" alink="#ff0000" vlink="#551a8b"> <h1><a name="Available Allegro examples">Available Allegro examples</a></h1> <ul> <li><a href="#ex12bit">ex12bit</a> — How to fake a 12-bit truecolor mode on an 8-bit card. <li><a href="#ex3buf">ex3buf</a> — Mode-X triple buffering and retrace interrupt simulation. <li><a href="#ex3d">ex3d</a> — 3d 'bouncy cubes' demo. <li><a href="#exaccel">exaccel</a> — Using offscreen video memory to store source graphics for VBE/AF. <li><a href="#exalpha">exalpha</a> — Creating and using 32 bit RGBA sprites. <li><a href="#exbitmap">exbitmap</a> — Loading and displaying PCX and BMP files. <li><a href="#exblend">exblend</a> — Using translucency in truecolor modes. <li><a href="#excamera">excamera</a> — Viewing a 3d world from an arbitrary camera position. <li><a href="#excolmap">excolmap</a> — Creating graphical effects with color mapping tables. <li><a href="#exconfig">exconfig</a> — Using the configuration routines. <li><a href="#excustom">excustom</a> — Creating custom GUI objects. <li><a href="#exdata">exdata</a> — Accessing the contents of datafiles. <li><a href="#exdbuf">exdbuf</a> — How to use double buffering to avoid flicker. <li><a href="#exexedat">exexedat</a> — Appending datafiles onto your executable. <li><a href="#exfixed">exfixed</a> — Using fixed point maths. <li><a href="#exflame">exflame</a> — How to write directly to video memory improving performance. <li><a href="#exflip">exflip</a> — Comparison of double buffering and page flipping. <li><a href="#exfont">exfont</a> — Loading and manipulating fonts. <li><a href="#exgui">exgui</a> — Using the GUI routines. <li><a href="#exhello">exhello</a> — Simple graphical "hello world" program. <li><a href="#exjoy">exjoy</a> — Detecting, calibrating and using joystick input. <li><a href="#exkeys">exkeys</a> — How to get input from the keyboard in different ways. <li><a href="#exlights">exlights</a> — One way to do colored lighting effects in a hicolor video mode. <li><a href="#exmem">exmem</a> — Drawing onto memory bitmaps and then blitting them to the screen. <li><a href="#exmidi">exmidi</a> — Playing MIDI music. <li><a href="#exmouse">exmouse</a> — Getting input from the mouse. <li><a href="#expackf">expackf</a> — Using custom PACKFILE vtables. <li><a href="#expal">expal</a> — Palette effects and color cycling. <li><a href="#expat">expat</a> — Using patterned drawing modes and sub-bitmaps. <li><a href="#exquat">exquat</a> — A comparison between Euler angles and quaternions. <li><a href="#exrgbhsv">exrgbhsv</a> — RGB <-> HSV color space conversions. <li><a href="#exrotscl">exrotscl</a> — Demonstrates rotate_scaled_sprite functions. <li><a href="#exsample">exsample</a> — Playing digital samples. <li><a href="#exscale">exscale</a> — Loading PCX files and bitmap stretching. <li><a href="#exscn3d">exscn3d</a> — Using the 3d scene functions. <li><a href="#exscroll">exscroll</a> — Mode-X hardware scrolling and split screens. <li><a href="#exshade">exshade</a> — Gouraud shaded sprites. <li><a href="#exspline">exspline</a> — Constructing smooth movement paths from spline curves. <li><a href="#exsprite">exsprite</a> — Datafiles access and sprite animation. <li><a href="#exstars">exstars</a> — 3d starfield and lightsourced spaceship. <li><a href="#exstream">exstream</a> — Playing audio streams. <li><a href="#exswitch">exswitch</a> — Controlling the console switch mode for background running. <li><a href="#exsyscur">exsyscur</a> — Hardware accelerated mouse cursors. <li><a href="#extimer">extimer</a> — Using the timer (delays and interrupts). <li><a href="#extrans">extrans</a> — Lighting and translucency effects. <li><a href="#extrans2">extrans2</a> — Drawing flipped, translucent and tinted sprites. <li><a href="#extruec">extruec</a> — Truecolor pixel format conversions. <li><a href="#exunicod">exunicod</a> — Using Unicode string functions. <li><a href="#exupdate">exupdate</a> — Supporting different screen update methods in a single program. <li><a href="#exxfade">exxfade</a> — Truecolor image loading and fades. <li><a href="#exzbuf">exzbuf</a> — Z-buffered polygons demo. </ul> <p> With Allegro comes quite a bunch of examples, which go from the simple introductory `Hello world' to more complicated programs featuring truecolor blending effects. This chapter describes these examples which you can find in the allegro/examples folder. You don't have to go through them in the same order as this documentation, but doing so you will learn the basic functions and avoid missing any important bit of information. <p><br> <div class="al-api"><b>Example <a name="exhello">exhello</a></b></div><br> This is a very simple program showing how to get into graphics mode and draw text onto the screen. <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg009.html#SCREEN_H" title="Global define to obtain the size of the screen.">SCREEN_H</a>, <a class="xref" href="alleg009.html#SCREEN_W" title="Global define to obtain the size of the screen.">SCREEN_W</a>, <a class="xref" href="alleg009.html#acquire_screen" title="Shortcut of acquire_bitmap(screen);">acquire_screen</a>, <a class="xref" href="alleg000.html#allegro_error" title="Stores the last Allegro error message.">allegro_error</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg013.html#clear_to_color" title="Clears the bitmap to the specified color.">clear_to_color</a>, <a class="xref" href="alleg011.html#desktop_palette" title="The palette used by the Atari ST low resolution desktop.">desktop_palette</a>, <a class="xref" href="alleg018.html#font" title="A simple 8x8 fixed size font.">font</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg006.html#key" title="Array of flags indicating key state.">key</a>, <a class="xref" href="alleg012.html#makecol" title="Converts an RGB value into the current pixel format.">makecol</a>, <a class="xref" href="alleg006.html#readkey" title="Returns the next character from the keyboard buffer.">readkey</a>, <a class="xref" href="alleg009.html#release_screen" title="Shortcut of release_bitmap(screen);">release_screen</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>, <a class="xref" href="alleg011.html#set_palette" title="Sets the entire palette of 256 colors.">set_palette</a>, <a class="xref" href="alleg018.html#textout_centre_ex" title="Writes a centered string on a bitmap.">textout_centre_ex</a>.</blockquote> <div class="al-api"><b>Example <a name="exmem">exmem</a></b></div><br> This program demonstrates the use of memory bitmaps. It creates a small temporary bitmap in memory, draws some circles onto it, and then blits lots of copies of it onto the screen. <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg001.html#BITMAP" title="Stores the contents of a bitmap.">BITMAP</a>, <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg009.html#SCREEN_H" title="Global define to obtain the size of the screen.">SCREEN_H</a>, <a class="xref" href="alleg009.html#SCREEN_W" title="Global define to obtain the size of the screen.">SCREEN_W</a>, <a class="xref" href="alleg009.html#acquire_screen" title="Shortcut of acquire_bitmap(screen);">acquire_screen</a>, <a class="xref" href="alleg000.html#allegro_error" title="Stores the last Allegro error message.">allegro_error</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg014.html#blit" title="Copies a rectangular area from one bitmap to another.">blit</a>, <a class="xref" href="alleg013.html#circle" title="Draws a circle.">circle</a>, <a class="xref" href="alleg013.html#clear_bitmap" title="Clears the bitmap to color 0.">clear_bitmap</a>, <a class="xref" href="alleg009.html#create_bitmap" title="Creates a memory bitmap.">create_bitmap</a>, <a class="xref" href="alleg011.html#desktop_palette" title="The palette used by the Atari ST low resolution desktop.">desktop_palette</a>, <a class="xref" href="alleg009.html#destroy_bitmap" title="Destroys any type of created bitmap.">destroy_bitmap</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg012.html#palette_color" title="Maps palette indexes into the current pixel format colors.">palette_color</a>, <a class="xref" href="alleg006.html#readkey" title="Returns the next character from the keyboard buffer.">readkey</a>, <a class="xref" href="alleg009.html#release_screen" title="Shortcut of release_bitmap(screen);">release_screen</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>, <a class="xref" href="alleg011.html#set_palette" title="Sets the entire palette of 256 colors.">set_palette</a>.</blockquote> <div class="al-api"><b>Example <a name="expal">expal</a></b></div><br> This program demonstrates how to manipulate the palette. It draws a set of concentric circles onto the screen and animates them by cycling the palette. <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg001.html#PALETTE" title="Stores palette information.">PALETTE</a>, <a class="xref" href="alleg001.html#RGB" title="Single palette entry.">RGB</a>, <a class="xref" href="alleg009.html#SCREEN_H" title="Global define to obtain the size of the screen.">SCREEN_H</a>, <a class="xref" href="alleg009.html#SCREEN_W" title="Global define to obtain the size of the screen.">SCREEN_W</a>, <a class="xref" href="alleg009.html#acquire_screen" title="Shortcut of acquire_bitmap(screen);">acquire_screen</a>, <a class="xref" href="alleg000.html#allegro_error" title="Stores the last Allegro error message.">allegro_error</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg011.html#black_palette" title="A palette containing solid black colors.">black_palette</a>, <a class="xref" href="alleg013.html#circlefill" title="Draws a filled circle.">circlefill</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg004.html#install_mouse" title="Installs the Allegro mouse handler.">install_mouse</a>, <a class="xref" href="alleg006.html#keypressed" title="Tells if there are keypresses waiting in the input buffer.">keypressed</a>, <a class="xref" href="alleg009.html#release_screen" title="Shortcut of release_bitmap(screen);">release_screen</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>, <a class="xref" href="alleg011.html#set_palette" title="Sets the entire palette of 256 colors.">set_palette</a>, <a class="xref" href="alleg004.html#show_mouse" title="Tells Allegro to display a mouse pointer on the screen.">show_mouse</a>.</blockquote> <div class="al-api"><b>Example <a name="expat">expat</a></b></div><br> This program demonstrates the use of patterned drawing and sub-bitmaps. <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg001.html#BITMAP" title="Stores the contents of a bitmap.">BITMAP</a>, <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg009.html#acquire_bitmap" title="Locks the bitmap before drawing onto it.">acquire_bitmap</a>, <a class="xref" href="alleg000.html#allegro_error" title="Stores the last Allegro error message.">allegro_error</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg009.html#bitmap_mask_color" title="Returns the mask color of the specified bitmap.">bitmap_mask_color</a>, <a class="xref" href="alleg014.html#blit" title="Copies a rectangular area from one bitmap to another.">blit</a>, <a class="xref" href="alleg013.html#clear_to_color" title="Clears the bitmap to the specified color.">clear_to_color</a>, <a class="xref" href="alleg009.html#create_bitmap" title="Creates a memory bitmap.">create_bitmap</a>, <a class="xref" href="alleg009.html#create_sub_bitmap" title="Creates a memory sub bitmap.">create_sub_bitmap</a>, <a class="xref" href="alleg011.html#desktop_palette" title="The palette used by the Atari ST low resolution desktop.">desktop_palette</a>, <a class="xref" href="alleg009.html#destroy_bitmap" title="Destroys any type of created bitmap.">destroy_bitmap</a>, <a class="xref" href="alleg020.html#drawing_mode" title="Sets the graphics drawing mode.">drawing_mode</a>, <a class="xref" href="alleg018.html#font" title="A simple 8x8 fixed size font.">font</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg012.html#makecol" title="Converts an RGB value into the current pixel format.">makecol</a>, <a class="xref" href="alleg014.html#masked_blit" title="Copies a rectangle skipping pixels with the mask color.">masked_blit</a>, <a class="xref" href="alleg012.html#palette_color" title="Maps palette indexes into the current pixel format colors.">palette_color</a>, <a class="xref" href="alleg006.html#readkey" title="Returns the next character from the keyboard buffer.">readkey</a>, <a class="xref" href="alleg013.html#rectfill" title="Draws a solid filled rectangle.">rectfill</a>, <a class="xref" href="alleg009.html#release_bitmap" title="Releases a previously locked bitmap.">release_bitmap</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>, <a class="xref" href="alleg011.html#set_palette" title="Sets the entire palette of 256 colors.">set_palette</a>, <a class="xref" href="alleg020.html#solid_mode" title="Shortcut for selecting solid drawing mode.">solid_mode</a>, <a class="xref" href="alleg018.html#text_height" title="Returns the height of a font in pixels.">text_height</a>, <a class="xref" href="alleg018.html#text_length" title="Returns the length of a string in pixels.">text_length</a>, <a class="xref" href="alleg018.html#textout_ex" title="Writes a string on a bitmap.">textout_ex</a>.</blockquote> <div class="al-api"><b>Example <a name="exflame">exflame</a></b></div><br> This program demonstrates how to write directly to video memory. It implements a simple fire effect, first by calling getpixel() and putpixel(), then by accessing video memory directly a byte at a time, and finally using block memory copy operations. <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg001.html#PALETTE" title="Stores palette information.">PALETTE</a>, <a class="xref" href="alleg009.html#SCREEN_H" title="Global define to obtain the size of the screen.">SCREEN_H</a>, <a class="xref" href="alleg009.html#SCREEN_W" title="Global define to obtain the size of the screen.">SCREEN_W</a>, <a class="xref" href="alleg009.html#acquire_screen" title="Shortcut of acquire_bitmap(screen);">acquire_screen</a>, <a class="xref" href="alleg000.html#allegro_error" title="Stores the last Allegro error message.">allegro_error</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg022.html#bmp_read_line" title="Direct access bank switching line selection for reading.">bmp_read_line</a>, <a class="xref" href="alleg022.html#bmp_unwrite_line" title="Direct access bank switching line release.">bmp_unwrite_line</a>, <a class="xref" href="alleg022.html#bmp_write_line" title="Direct access bank switching line selection for writing.">bmp_write_line</a>, <a class="xref" href="alleg006.html#clear_keybuf" title="Clears the keyboard buffer.">clear_keybuf</a>, <a class="xref" href="alleg018.html#font" title="A simple 8x8 fixed size font.">font</a>, <a class="xref" href="alleg013.html#getpixel" title="Reads a pixel from a bitmap.">getpixel</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg006.html#keypressed" title="Tells if there are keypresses waiting in the input buffer.">keypressed</a>, <a class="xref" href="alleg013.html#line" title="Draws a line onto the bitmap.">line</a>, <a class="xref" href="alleg012.html#makecol" title="Converts an RGB value into the current pixel format.">makecol</a>, <a class="xref" href="alleg013.html#putpixel" title="Writes a pixel into a bitmap.">putpixel</a>, <a class="xref" href="alleg009.html#release_screen" title="Shortcut of release_bitmap(screen);">release_screen</a>, <a class="xref" href="alleg005.html#rest" title="Waits a specified number of milliseconds or yields CPU.">rest</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>, <a class="xref" href="alleg011.html#set_palette" title="Sets the entire palette of 256 colors.">set_palette</a>, <a class="xref" href="alleg018.html#textout_ex" title="Writes a string on a bitmap.">textout_ex</a>.</blockquote> <div class="al-api"><b>Example <a name="exdbuf">exdbuf</a></b></div><br> This program demonstrates the use of double buffering. It moves a circle across the screen, first just erasing and redrawing directly to the screen, then with a double buffer. <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg001.html#BITMAP" title="Stores the contents of a bitmap.">BITMAP</a>, <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg009.html#SCREEN_H" title="Global define to obtain the size of the screen.">SCREEN_H</a>, <a class="xref" href="alleg009.html#SCREEN_W" title="Global define to obtain the size of the screen.">SCREEN_W</a>, <a class="xref" href="alleg009.html#acquire_screen" title="Shortcut of acquire_bitmap(screen);">acquire_screen</a>, <a class="xref" href="alleg000.html#allegro_error" title="Stores the last Allegro error message.">allegro_error</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg014.html#blit" title="Copies a rectangular area from one bitmap to another.">blit</a>, <a class="xref" href="alleg013.html#circlefill" title="Draws a filled circle.">circlefill</a>, <a class="xref" href="alleg006.html#clear_keybuf" title="Clears the keyboard buffer.">clear_keybuf</a>, <a class="xref" href="alleg013.html#clear_to_color" title="Clears the bitmap to the specified color.">clear_to_color</a>, <a class="xref" href="alleg009.html#create_bitmap" title="Creates a memory bitmap.">create_bitmap</a>, <a class="xref" href="alleg011.html#desktop_palette" title="The palette used by the Atari ST low resolution desktop.">desktop_palette</a>, <a class="xref" href="alleg009.html#destroy_bitmap" title="Destroys any type of created bitmap.">destroy_bitmap</a>, <a class="xref" href="alleg018.html#font" title="A simple 8x8 fixed size font.">font</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg005.html#install_timer" title="Installs the Allegro timer interrupt handler.">install_timer</a>, <a class="xref" href="alleg006.html#keypressed" title="Tells if there are keypresses waiting in the input buffer.">keypressed</a>, <a class="xref" href="alleg012.html#makecol" title="Converts an RGB value into the current pixel format.">makecol</a>, <a class="xref" href="alleg009.html#release_screen" title="Shortcut of release_bitmap(screen);">release_screen</a>, <a class="xref" href="alleg005.html#retrace_count" title="Retrace count simulator.">retrace_count</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>, <a class="xref" href="alleg011.html#set_palette" title="Sets the entire palette of 256 colors.">set_palette</a>, <a class="xref" href="alleg018.html#textprintf_ex" title="Formatted output of a string.">textprintf_ex</a>.</blockquote> <div class="al-api"><b>Example <a name="exflip">exflip</a></b></div><br> This program moves a circle across the screen, first with a double buffer and then using page flips. <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg001.html#BITMAP" title="Stores the contents of a bitmap.">BITMAP</a>, <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg009.html#SCREEN_H" title="Global define to obtain the size of the screen.">SCREEN_H</a>, <a class="xref" href="alleg009.html#SCREEN_W" title="Global define to obtain the size of the screen.">SCREEN_W</a>, <a class="xref" href="alleg000.html#allegro_error" title="Stores the last Allegro error message.">allegro_error</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg014.html#blit" title="Copies a rectangular area from one bitmap to another.">blit</a>, <a class="xref" href="alleg013.html#circlefill" title="Draws a filled circle.">circlefill</a>, <a class="xref" href="alleg006.html#clear_keybuf" title="Clears the keyboard buffer.">clear_keybuf</a>, <a class="xref" href="alleg013.html#clear_to_color" title="Clears the bitmap to the specified color.">clear_to_color</a>, <a class="xref" href="alleg009.html#create_bitmap" title="Creates a memory bitmap.">create_bitmap</a>, <a class="xref" href="alleg009.html#create_video_bitmap" title="Creates a video memory bitmap.">create_video_bitmap</a>, <a class="xref" href="alleg011.html#desktop_palette" title="The palette used by the Atari ST low resolution desktop.">desktop_palette</a>, <a class="xref" href="alleg009.html#destroy_bitmap" title="Destroys any type of created bitmap.">destroy_bitmap</a>, <a class="xref" href="alleg018.html#font" title="A simple 8x8 fixed size font.">font</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg005.html#install_timer" title="Installs the Allegro timer interrupt handler.">install_timer</a>, <a class="xref" href="alleg006.html#keypressed" title="Tells if there are keypresses waiting in the input buffer.">keypressed</a>, <a class="xref" href="alleg012.html#makecol" title="Converts an RGB value into the current pixel format.">makecol</a>, <a class="xref" href="alleg005.html#retrace_count" title="Retrace count simulator.">retrace_count</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>, <a class="xref" href="alleg011.html#set_palette" title="Sets the entire palette of 256 colors.">set_palette</a>, <a class="xref" href="alleg008.html#show_video_bitmap" title="Flips the hardware screen to use the specified page.">show_video_bitmap</a>, <a class="xref" href="alleg018.html#textprintf_ex" title="Formatted output of a string.">textprintf_ex</a>.</blockquote> <div class="al-api"><b>Example <a name="exfixed">exfixed</a></b></div><br> This program demonstrates how to use fixed point numbers, which are signed 32-bit integers storing the integer part in the upper 16 bits and the decimal part in the 16 lower bits. This example also uses the unusual approach of communicating with the user exclusively via the allegro_message() function. <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg032.html#fixdiv" title="Fixed point division.">fixdiv</a>, <a class="xref" href="alleg001.html#fixed" title="Fixed point integer to replace floats.">fixed</a>, <a class="xref" href="alleg032.html#fixmul" title="Multiplies two fixed point values together.">fixmul</a>, <a class="xref" href="alleg032.html#fixsqrt" title="Fixed point square root.">fixsqrt</a>, <a class="xref" href="alleg032.html#fixtof" title="Converts a fixed point to floating point.">fixtof</a>, <a class="xref" href="alleg032.html#ftofix" title="Converts a floating point value to fixed point.">ftofix</a>, <a class="xref" href="alleg032.html#itofix" title="Converts an integer to fixed point.">itofix</a>.</blockquote> <div class="al-api"><b>Example <a name="exfont">exfont</a></b></div><br> This is a very simple program showing how to load and manipulate fonts. <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg001.html#FONT" title="Stores an Allegro font.">FONT</a>, <a class="xref" href="alleg009.html#SCREEN_H" title="Global define to obtain the size of the screen.">SCREEN_H</a>, <a class="xref" href="alleg009.html#SCREEN_W" title="Global define to obtain the size of the screen.">SCREEN_W</a>, <a class="xref" href="alleg009.html#acquire_screen" title="Shortcut of acquire_bitmap(screen);">acquire_screen</a>, <a class="xref" href="alleg000.html#allegro_error" title="Stores the last Allegro error message.">allegro_error</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg013.html#clear_to_color" title="Clears the bitmap to the specified color.">clear_to_color</a>, <a class="xref" href="alleg011.html#desktop_palette" title="The palette used by the Atari ST low resolution desktop.">desktop_palette</a>, <a class="xref" href="alleg017.html#destroy_font" title="Frees the memory being used by a font structure.">destroy_font</a>, <a class="xref" href="alleg017.html#extract_font_range" title="Extracts a range of characters from a font.">extract_font_range</a>, <a class="xref" href="alleg018.html#font" title="A simple 8x8 fixed size font.">font</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg006.html#key" title="Array of flags indicating key state.">key</a>, <a class="xref" href="alleg017.html#load_font" title="Loads a font from a file.">load_font</a>, <a class="xref" href="alleg012.html#makecol" title="Converts an RGB value into the current pixel format.">makecol</a>, <a class="xref" href="alleg017.html#merge_fonts" title="Merges two fonts into one font.">merge_fonts</a>, <a class="xref" href="alleg006.html#readkey" title="Returns the next character from the keyboard buffer.">readkey</a>, <a class="xref" href="alleg009.html#release_screen" title="Shortcut of release_bitmap(screen);">release_screen</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>, <a class="xref" href="alleg011.html#set_palette" title="Sets the entire palette of 256 colors.">set_palette</a>, <a class="xref" href="alleg018.html#textout_centre_ex" title="Writes a centered string on a bitmap.">textout_centre_ex</a>.</blockquote> <div class="al-api"><b>Example <a name="exmouse">exmouse</a></b></div><br> This program demonstrates how to get mouse input. The first part of the test retrieves the raw mouse input data and displays it on the screen without using any mouse cursor. When you press a key the standard arrow-like mouse cursor appears. You are not restricted to this shape, and a second key press modifies the cursor to be several concentric colored circles. They are not joined together, so you can still see bits of what's behind when you move the cursor over the printed text message. <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg001.html#BITMAP" title="Stores the contents of a bitmap.">BITMAP</a>, <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg009.html#SCREEN_H" title="Global define to obtain the size of the screen.">SCREEN_H</a>, <a class="xref" href="alleg009.html#SCREEN_W" title="Global define to obtain the size of the screen.">SCREEN_W</a>, <a class="xref" href="alleg009.html#acquire_screen" title="Shortcut of acquire_bitmap(screen);">acquire_screen</a>, <a class="xref" href="alleg000.html#allegro_error" title="Stores the last Allegro error message.">allegro_error</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg009.html#bitmap_mask_color" title="Returns the mask color of the specified bitmap.">bitmap_mask_color</a>, <a class="xref" href="alleg013.html#circle" title="Draws a circle.">circle</a>, <a class="xref" href="alleg006.html#clear_keybuf" title="Clears the keyboard buffer.">clear_keybuf</a>, <a class="xref" href="alleg013.html#clear_to_color" title="Clears the bitmap to the specified color.">clear_to_color</a>, <a class="xref" href="alleg009.html#create_bitmap" title="Creates a memory bitmap.">create_bitmap</a>, <a class="xref" href="alleg011.html#desktop_palette" title="The palette used by the Atari ST low resolution desktop.">desktop_palette</a>, <a class="xref" href="alleg009.html#destroy_bitmap" title="Destroys any type of created bitmap.">destroy_bitmap</a>, <a class="xref" href="alleg018.html#font" title="A simple 8x8 fixed size font.">font</a>, <a class="xref" href="alleg004.html#get_mouse_mickeys" title="How far the mouse has moved since the last call to this function.">get_mouse_mickeys</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg004.html#install_mouse" title="Installs the Allegro mouse handler.">install_mouse</a>, <a class="xref" href="alleg005.html#install_timer" title="Installs the Allegro timer interrupt handler.">install_timer</a>, <a class="xref" href="alleg006.html#key" title="Array of flags indicating key state.">key</a>, <a class="xref" href="alleg006.html#keypressed" title="Tells if there are keypresses waiting in the input buffer.">keypressed</a>, <a class="xref" href="alleg012.html#makecol" title="Converts an RGB value into the current pixel format.">makecol</a>, <a class="xref" href="alleg004.html#mouse_b" title="Global variable with the mouse position/button state.">mouse_b</a>, <a class="xref" href="alleg004.html#mouse_w" title="Global variable with the mouse position/button state.">mouse_w</a>, <a class="xref" href="alleg004.html#mouse_x" title="Global variable with the mouse position/button state.">mouse_x</a>, <a class="xref" href="alleg004.html#mouse_y" title="Global variable with the mouse position/button state.">mouse_y</a>, <a class="xref" href="alleg004.html#mouse_z" title="Global variable with the mouse position/button state.">mouse_z</a>, <a class="xref" href="alleg012.html#palette_color" title="Maps palette indexes into the current pixel format colors.">palette_color</a>, <a class="xref" href="alleg004.html#poll_mouse" title="Polls the mouse.">poll_mouse</a>, <a class="xref" href="alleg006.html#readkey" title="Returns the next character from the keyboard buffer.">readkey</a>, <a class="xref" href="alleg009.html#release_screen" title="Shortcut of release_bitmap(screen);">release_screen</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>, <a class="xref" href="alleg004.html#set_mouse_sprite" title="Sets the mouse sprite.">set_mouse_sprite</a>, <a class="xref" href="alleg004.html#set_mouse_sprite_focus" title="Sets the mouse sprite focus.">set_mouse_sprite_focus</a>, <a class="xref" href="alleg011.html#set_palette" title="Sets the entire palette of 256 colors.">set_palette</a>, <a class="xref" href="alleg004.html#show_mouse" title="Tells Allegro to display a mouse pointer on the screen.">show_mouse</a>, <a class="xref" href="alleg018.html#textout_centre_ex" title="Writes a centered string on a bitmap.">textout_centre_ex</a>, <a class="xref" href="alleg018.html#textout_ex" title="Writes a string on a bitmap.">textout_ex</a>, <a class="xref" href="alleg018.html#textprintf_centre_ex" title="Formatted centered output of a string.">textprintf_centre_ex</a>, <a class="xref" href="alleg018.html#textprintf_ex" title="Formatted output of a string.">textprintf_ex</a>, <a class="xref" href="alleg018.html#textprintf_right_ex" title="Formatted right aligned output of a string.">textprintf_right_ex</a>, <a class="xref" href="alleg008.html#vsync" title="Waits for a vertical retrace to begin.">vsync</a>.</blockquote> <div class="al-api"><b>Example <a name="extimer">extimer</a></b></div><br> This program demonstrates how to use the timer routines. These can be a bit of a pain, because you have to be sure you lock all the memory that is used inside your interrupt handlers. The first part of the example shows a basic use of timing using the blocking function rest(). The second part shows how to use three timers with different frequencies in a non blocking way. <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg005.html#END_OF_FUNCTION" title="Locks the code used by a timer.">END_OF_FUNCTION</a>, <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg005.html#LOCK_FUNCTION" title="Locks the memory of a function used by a timer.">LOCK_FUNCTION</a>, <a class="xref" href="alleg005.html#LOCK_VARIABLE" title="Locks the memory of a variable used by a timer.">LOCK_VARIABLE</a>, <a class="xref" href="alleg009.html#SCREEN_W" title="Global define to obtain the size of the screen.">SCREEN_W</a>, <a class="xref" href="alleg000.html#allegro_error" title="Stores the last Allegro error message.">allegro_error</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg013.html#clear_to_color" title="Clears the bitmap to the specified color.">clear_to_color</a>, <a class="xref" href="alleg011.html#desktop_palette" title="The palette used by the Atari ST low resolution desktop.">desktop_palette</a>, <a class="xref" href="alleg018.html#font" title="A simple 8x8 fixed size font.">font</a>, <a class="xref" href="alleg005.html#install_int" title="Installs a user timer handler.">install_int</a>, <a class="xref" href="alleg005.html#install_int_ex" title="Adds or modifies a timer.">install_int_ex</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg005.html#install_timer" title="Installs the Allegro timer interrupt handler.">install_timer</a>, <a class="xref" href="alleg006.html#key" title="Array of flags indicating key state.">key</a>, <a class="xref" href="alleg006.html#keypressed" title="Tells if there are keypresses waiting in the input buffer.">keypressed</a>, <a class="xref" href="alleg012.html#makecol" title="Converts an RGB value into the current pixel format.">makecol</a>, <a class="xref" href="alleg006.html#readkey" title="Returns the next character from the keyboard buffer.">readkey</a>, <a class="xref" href="alleg005.html#rest" title="Waits a specified number of milliseconds or yields CPU.">rest</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>, <a class="xref" href="alleg011.html#set_palette" title="Sets the entire palette of 256 colors.">set_palette</a>, <a class="xref" href="alleg018.html#textprintf_centre_ex" title="Formatted centered output of a string.">textprintf_centre_ex</a>.</blockquote> <div class="al-api"><b>Example <a name="exkeys">exkeys</a></b></div><br> This program demonstrates how to access the keyboard. The first part shows the basic use of readkey(). The second part shows how to extract the ASCII value. Next come the scan codes. The fourth test detects modifier keys like alt or shift. The fifth test requires some focus to be passed. The final step shows how to use the global key array to read simultaneous key presses. The last method to detect key presses are keyboard callbacks. This is demonstrated by installing a keyboard callback, which marks all pressed keys by drawing to a grid. <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg005.html#END_OF_FUNCTION" title="Locks the code used by a timer.">END_OF_FUNCTION</a>, <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg005.html#LOCK_FUNCTION" title="Locks the memory of a function used by a timer.">LOCK_FUNCTION</a>, <a class="xref" href="alleg009.html#SCREEN_H" title="Global define to obtain the size of the screen.">SCREEN_H</a>, <a class="xref" href="alleg009.html#SCREEN_W" title="Global define to obtain the size of the screen.">SCREEN_W</a>, <a class="xref" href="alleg009.html#acquire_screen" title="Shortcut of acquire_bitmap(screen);">acquire_screen</a>, <a class="xref" href="alleg000.html#allegro_error" title="Stores the last Allegro error message.">allegro_error</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg014.html#blit" title="Copies a rectangular area from one bitmap to another.">blit</a>, <a class="xref" href="alleg006.html#clear_keybuf" title="Clears the keyboard buffer.">clear_keybuf</a>, <a class="xref" href="alleg013.html#clear_to_color" title="Clears the bitmap to the specified color.">clear_to_color</a>, <a class="xref" href="alleg011.html#desktop_palette" title="The palette used by the Atari ST low resolution desktop.">desktop_palette</a>, <a class="xref" href="alleg018.html#font" title="A simple 8x8 fixed size font.">font</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg005.html#install_timer" title="Installs the Allegro timer interrupt handler.">install_timer</a>, <a class="xref" href="alleg006.html#key" title="Array of flags indicating key state.">key</a>, <a class="xref" href="alleg006.html#key_shifts" title="Bitmask containing the current state of modifier keys.">key_shifts</a>, <a class="xref" href="alleg006.html#keyboard_lowlevel_callback" title="User specified low level keyboard event handler.">keyboard_lowlevel_callback</a>, <a class="xref" href="alleg006.html#keypressed" title="Tells if there are keypresses waiting in the input buffer.">keypressed</a>, <a class="xref" href="alleg012.html#makecol" title="Converts an RGB value into the current pixel format.">makecol</a>, <a class="xref" href="alleg006.html#readkey" title="Returns the next character from the keyboard buffer.">readkey</a>, <a class="xref" href="alleg013.html#rectfill" title="Draws a solid filled rectangle.">rectfill</a>, <a class="xref" href="alleg009.html#release_screen" title="Shortcut of release_bitmap(screen);">release_screen</a>, <a class="xref" href="alleg005.html#rest" title="Waits a specified number of milliseconds or yields CPU.">rest</a>, <a class="xref" href="alleg006.html#scancode_to_name" title="Converts a scancode to a key name.">scancode_to_name</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>, <a class="xref" href="alleg011.html#set_palette" title="Sets the entire palette of 256 colors.">set_palette</a>, <a class="xref" href="alleg018.html#textprintf_centre_ex" title="Formatted centered output of a string.">textprintf_centre_ex</a>, <a class="xref" href="alleg018.html#textprintf_ex" title="Formatted output of a string.">textprintf_ex</a>, <a class="xref" href="alleg006.html#ureadkey" title="Returns the next unicode character from the keyboard buffer.">ureadkey</a>, <a class="xref" href="alleg002.html#usprintf" title="Writes formatted data into a buffer.">usprintf</a>, <a class="xref" href="alleg002.html#ustrzncpy" title="Copies a string into another one, specifying size.">ustrzncpy</a>.</blockquote> <div class="al-api"><b>Example <a name="exjoy">exjoy</a></b></div><br> This program uses the Allegro library to detect and read the value of a joystick. The output of the program is a small target sight on the screen which you can move. At the same time the program will tell you what you are doing with the joystick (moving or firing). <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg001.html#BITMAP" title="Stores the contents of a bitmap.">BITMAP</a>, <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg009.html#SCREEN_H" title="Global define to obtain the size of the screen.">SCREEN_H</a>, <a class="xref" href="alleg009.html#SCREEN_W" title="Global define to obtain the size of the screen.">SCREEN_W</a>, <a class="xref" href="alleg000.html#allegro_error" title="Stores the last Allegro error message.">allegro_error</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg014.html#blit" title="Copies a rectangular area from one bitmap to another.">blit</a>, <a class="xref" href="alleg007.html#calibrate_joystick" title="Calibrates the specified joystick.">calibrate_joystick</a>, <a class="xref" href="alleg007.html#calibrate_joystick_name" title="Returns the next calibration text string.">calibrate_joystick_name</a>, <a class="xref" href="alleg013.html#circle" title="Draws a circle.">circle</a>, <a class="xref" href="alleg013.html#clear_bitmap" title="Clears the bitmap to color 0.">clear_bitmap</a>, <a class="xref" href="alleg006.html#clear_keybuf" title="Clears the keyboard buffer.">clear_keybuf</a>, <a class="xref" href="alleg009.html#create_bitmap" title="Creates a memory bitmap.">create_bitmap</a>, <a class="xref" href="alleg011.html#default_palette" title="The default IBM BIOS palette.">default_palette</a>, <a class="xref" href="alleg009.html#destroy_bitmap" title="Destroys any type of created bitmap.">destroy_bitmap</a>, <a class="xref" href="alleg020.html#drawing_mode" title="Sets the graphics drawing mode.">drawing_mode</a>, <a class="xref" href="alleg018.html#font" title="A simple 8x8 fixed size font.">font</a>, <a class="xref" href="alleg007.html#install_joystick" title="Initialises the joystick.">install_joystick</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg007.html#joy" title="Global array of joystick state information.">joy</a>, <a class="xref" href="alleg006.html#key" title="Array of flags indicating key state.">key</a>, <a class="xref" href="alleg006.html#keypressed" title="Tells if there are keypresses waiting in the input buffer.">keypressed</a>, <a class="xref" href="alleg007.html#num_joysticks" title="Global variable saying how many joysticks there are.">num_joysticks</a>, <a class="xref" href="alleg012.html#palette_color" title="Maps palette indexes into the current pixel format colors.">palette_color</a>, <a class="xref" href="alleg007.html#poll_joystick" title="Polls the joystick.">poll_joystick</a>, <a class="xref" href="alleg013.html#putpixel" title="Writes a pixel into a bitmap.">putpixel</a>, <a class="xref" href="alleg006.html#readkey" title="Returns the next character from the keyboard buffer.">readkey</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>, <a class="xref" href="alleg011.html#set_palette" title="Sets the entire palette of 256 colors.">set_palette</a>, <a class="xref" href="alleg018.html#textout_centre_ex" title="Writes a centered string on a bitmap.">textout_centre_ex</a>, <a class="xref" href="alleg018.html#textprintf_centre_ex" title="Formatted centered output of a string.">textprintf_centre_ex</a>, <a class="xref" href="alleg018.html#textprintf_ex" title="Formatted output of a string.">textprintf_ex</a>.</blockquote> <div class="al-api"><b>Example <a name="exsample">exsample</a></b></div><br> This program demonstrates how to play samples. You have to use this example from the command line to specify as first parameter a WAV or VOC sound file to play. If the file is loaded successfully, the sound will be played in an infinite loop. While it is being played, you can use the left and right arrow keys to modify the panning of the sound. You can also use the up and down arrow keys to modify the pitch. <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg001.html#SAMPLE" title="Stores sound data.">SAMPLE</a>, <a class="xref" href="alleg009.html#SCREEN_H" title="Global define to obtain the size of the screen.">SCREEN_H</a>, <a class="xref" href="alleg009.html#SCREEN_W" title="Global define to obtain the size of the screen.">SCREEN_W</a>, <a class="xref" href="alleg026.html#adjust_sample" title="Alters the parameters of a sample while it is playing.">adjust_sample</a>, <a class="xref" href="alleg000.html#allegro_error" title="Stores the last Allegro error message.">allegro_error</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg013.html#clear_to_color" title="Clears the bitmap to the specified color.">clear_to_color</a>, <a class="xref" href="alleg011.html#desktop_palette" title="The palette used by the Atari ST low resolution desktop.">desktop_palette</a>, <a class="xref" href="alleg026.html#destroy_sample" title="Destroys a sample structure when you are done with it.">destroy_sample</a>, <a class="xref" href="alleg018.html#font" title="A simple 8x8 fixed size font.">font</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg024.html#install_sound" title="Initialises the sound module.">install_sound</a>, <a class="xref" href="alleg005.html#install_timer" title="Installs the Allegro timer interrupt handler.">install_timer</a>, <a class="xref" href="alleg006.html#key" title="Array of flags indicating key state.">key</a>, <a class="xref" href="alleg026.html#load_sample" title="Loads a sample from a file.">load_sample</a>, <a class="xref" href="alleg012.html#makecol" title="Converts an RGB value into the current pixel format.">makecol</a>, <a class="xref" href="alleg026.html#play_sample" title="Plays a sample.">play_sample</a>, <a class="xref" href="alleg006.html#poll_keyboard" title="Polls the keyboard.">poll_keyboard</a>, <a class="xref" href="alleg005.html#rest" title="Waits a specified number of milliseconds or yields CPU.">rest</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>, <a class="xref" href="alleg011.html#set_palette" title="Sets the entire palette of 256 colors.">set_palette</a>, <a class="xref" href="alleg018.html#textprintf_centre_ex" title="Formatted centered output of a string.">textprintf_centre_ex</a>.</blockquote> <div class="al-api"><b>Example <a name="exmidi">exmidi</a></b></div><br> This program demonstrates how to play MIDI files. <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg001.html#MIDI" title="Stores MIDI data.">MIDI</a>, <a class="xref" href="alleg009.html#SCREEN_H" title="Global define to obtain the size of the screen.">SCREEN_H</a>, <a class="xref" href="alleg009.html#SCREEN_W" title="Global define to obtain the size of the screen.">SCREEN_W</a>, <a class="xref" href="alleg000.html#allegro_error" title="Stores the last Allegro error message.">allegro_error</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg013.html#clear_to_color" title="Clears the bitmap to the specified color.">clear_to_color</a>, <a class="xref" href="alleg011.html#desktop_palette" title="The palette used by the Atari ST low resolution desktop.">desktop_palette</a>, <a class="xref" href="alleg027.html#destroy_midi" title="Destroys a MIDI structure when you are done with it.">destroy_midi</a>, <a class="xref" href="alleg018.html#font" title="A simple 8x8 fixed size font.">font</a>, <a class="xref" href="alleg030.html#get_filename" title="Returns a pointer to the filename portion of a path.">get_filename</a>, <a class="xref" href="alleg027.html#get_midi_length" title="Determines the total playing time of a midi, in seconds.">get_midi_length</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg024.html#install_sound" title="Initialises the sound module.">install_sound</a>, <a class="xref" href="alleg005.html#install_timer" title="Installs the Allegro timer interrupt handler.">install_timer</a>, <a class="xref" href="alleg006.html#key" title="Array of flags indicating key state.">key</a>, <a class="xref" href="alleg006.html#keypressed" title="Tells if there are keypresses waiting in the input buffer.">keypressed</a>, <a class="xref" href="alleg027.html#load_midi" title="Loads a MIDI file.">load_midi</a>, <a class="xref" href="alleg012.html#makecol" title="Converts an RGB value into the current pixel format.">makecol</a>, <a class="xref" href="alleg027.html#midi_pause" title="Pauses the MIDI player.">midi_pause</a>, <a class="xref" href="alleg027.html#midi_pos" title="Stores the current position in the MIDI file.">midi_pos</a>, <a class="xref" href="alleg027.html#midi_resume" title="Resumes playback of a paused MIDI file.">midi_resume</a>, <a class="xref" href="alleg027.html#midi_time" title="The current position in the MIDI file, in seconds.">midi_time</a>, <a class="xref" href="alleg027.html#play_midi" title="Starts playing the specified MIDI file.">play_midi</a>, <a class="xref" href="alleg006.html#readkey" title="Returns the next character from the keyboard buffer.">readkey</a>, <a class="xref" href="alleg013.html#rectfill" title="Draws a solid filled rectangle.">rectfill</a>, <a class="xref" href="alleg005.html#rest" title="Waits a specified number of milliseconds or yields CPU.">rest</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg008.html#set_display_switch_mode" title="Tells Allegro how the program handles background switching.">set_display_switch_mode</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>, <a class="xref" href="alleg011.html#set_palette" title="Sets the entire palette of 256 colors.">set_palette</a>, <a class="xref" href="alleg018.html#text_height" title="Returns the height of a font in pixels.">text_height</a>, <a class="xref" href="alleg018.html#text_length" title="Returns the length of a string in pixels.">text_length</a>, <a class="xref" href="alleg018.html#textprintf_centre_ex" title="Formatted centered output of a string.">textprintf_centre_ex</a>.</blockquote> <div class="al-api"><b>Example <a name="exgui">exgui</a></b></div><br> This program demonstrates how to use the GUI routines. From the simple dialog controls that display a text or a bitmap to more complex multiple choice selection lists, Allegro provides a framework which can be customised to suit your needs. <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg001.html#DATAFILE" title="Stores an Allegro datafile in memory.">DATAFILE</a>, <a class="xref" href="alleg001.html#DIALOG" title="Stores a GUI description.">DIALOG</a>, <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg001.html#MENU" title="Stores the entries of a menu.">MENU</a>, <a class="xref" href="alleg035.html#active_menu" title="Global pointer to the most recent activated menu.">active_menu</a>, <a class="xref" href="alleg035.html#alert" title="Displays a popup alert box.">alert</a>, <a class="xref" href="alleg000.html#allegro_error" title="Stores the last Allegro error message.">allegro_error</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg035.html#d_bitmap_proc" title="Dialog procedure drawing a bitmap.">d_bitmap_proc</a>, <a class="xref" href="alleg035.html#d_box_proc" title="Dialog procedure drawing boxes onto the screen.">d_box_proc</a>, <a class="xref" href="alleg035.html#d_button_proc" title="Dialog procedure implementing a button object.">d_button_proc</a>, <a class="xref" href="alleg035.html#d_check_proc" title="Dialog procedure implementing a check box object.">d_check_proc</a>, <a class="xref" href="alleg035.html#d_clear_proc" title="Dialog procedure to clear the screen.">d_clear_proc</a>, <a class="xref" href="alleg035.html#d_ctext_proc" title="Dialogs procedure drawing text onto the screen.">d_ctext_proc</a>, <a class="xref" href="alleg035.html#d_edit_proc" title="Dialog procedure implementing an editable text object.">d_edit_proc</a>, <a class="xref" href="alleg035.html#d_icon_proc" title="Dialog procedure implementing a bitmap button.">d_icon_proc</a>, <a class="xref" href="alleg035.html#d_keyboard_proc" title="Invisible dialog procedure for implementing keyboard shortcuts.">d_keyboard_proc</a>, <a class="xref" href="alleg035.html#d_list_proc" title="Dialog procedure implementing a list box object.">d_list_proc</a>, <a class="xref" href="alleg035.html#d_menu_proc" title="Dialog procedure implementing a menu bar object.">d_menu_proc</a>, <a class="xref" href="alleg035.html#d_radio_proc" title="Dialog procedure implementing a radio button object.">d_radio_proc</a>, <a class="xref" href="alleg035.html#d_rtext_proc" title="Dialogs procedure drawing text onto the screen.">d_rtext_proc</a>, <a class="xref" href="alleg035.html#d_shadow_box_proc" title="Dialog procedure drawing boxes onto the screen.">d_shadow_box_proc</a>, <a class="xref" href="alleg035.html#d_slider_proc" title="Dialog procedure implementing a slider control object.">d_slider_proc</a>, <a class="xref" href="alleg035.html#d_text_list_proc" title="Dialog procedure implementing a list box object with type ahead.">d_text_list_proc</a>, <a class="xref" href="alleg035.html#d_text_proc" title="Dialogs procedure drawing text onto the screen.">d_text_proc</a>, <a class="xref" href="alleg035.html#d_textbox_proc" title="Dialog procedure implementing a text box object.">d_textbox_proc</a>, <a class="xref" href="alleg035.html#d_yield_proc" title="Invisible dialog procedure that yields CPU time slices.">d_yield_proc</a>, <a class="xref" href="alleg035.html#do_dialog" title="Basic dialog manager function.">do_dialog</a>, <a class="xref" href="alleg035.html#gui_bg_color" title="The foreground and background colors for the standard dialogs.">gui_bg_color</a>, <a class="xref" href="alleg035.html#gui_fg_color" title="The foreground and background colors for the standard dialogs.">gui_fg_color</a>, <a class="xref" href="alleg035.html#gui_mg_color" title="The color used for displaying greyed-out dialog objects.">gui_mg_color</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg004.html#install_mouse" title="Installs the Allegro mouse handler.">install_mouse</a>, <a class="xref" href="alleg005.html#install_timer" title="Installs the Allegro timer interrupt handler.">install_timer</a>, <a class="xref" href="alleg006.html#key" title="Array of flags indicating key state.">key</a>, <a class="xref" href="alleg031.html#load_datafile" title="Loads a datafile into memory.">load_datafile</a>, <a class="xref" href="alleg012.html#makecol" title="Converts an RGB value into the current pixel format.">makecol</a>, <a class="xref" href="alleg035.html#position_dialog" title="Moves an array of dialog objects to the specified position.">position_dialog</a>, <a class="xref" href="alleg030.html#replace_filename" title="Replaces path+filename with a new filename tail.">replace_filename</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg035.html#set_dialog_color" title="Sets the colors of an array of dialog objects.">set_dialog_color</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>, <a class="xref" href="alleg011.html#set_palette" title="Sets the entire palette of 256 colors.">set_palette</a>, <a class="xref" href="alleg031.html#unload_datafile" title="Frees all the objects in a datafile.">unload_datafile</a>, <a class="xref" href="alleg002.html#ustrtok" title="Retrieves tokens from a string.">ustrtok</a>, <a class="xref" href="alleg002.html#ustrzcat" title="Concatenates a string to another one, specifying size.">ustrzcat</a>, <a class="xref" href="alleg002.html#ustrzcpy" title="Copies a string into another one, specifying size.">ustrzcpy</a>, <a class="xref" href="alleg002.html#uszprintf" title="Writes formatted data into a buffer, specifying size.">uszprintf</a>.</blockquote> <div class="al-api"><b>Example <a name="excustom">excustom</a></b></div><br> A follow up of the exgui.c example showing how to customise the default Allegro framework. In this case a dialog procedure animates a graphical clock without disrupting other GUI dialogs. A more simple option shows how to dynamically change the font used by all GUI elements. <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg001.html#BITMAP" title="Stores the contents of a bitmap.">BITMAP</a>, <a class="xref" href="alleg001.html#DATAFILE" title="Stores an Allegro datafile in memory.">DATAFILE</a>, <a class="xref" href="alleg001.html#DIALOG" title="Stores a GUI description.">DIALOG</a>, <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg001.html#FONT" title="Stores an Allegro font.">FONT</a>, <a class="xref" href="alleg000.html#allegro_error" title="Stores the last Allegro error message.">allegro_error</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg014.html#blit" title="Copies a rectangular area from one bitmap to another.">blit</a>, <a class="xref" href="alleg013.html#circle" title="Draws a circle.">circle</a>, <a class="xref" href="alleg013.html#circlefill" title="Draws a filled circle.">circlefill</a>, <a class="xref" href="alleg013.html#clear_to_color" title="Clears the bitmap to the specified color.">clear_to_color</a>, <a class="xref" href="alleg009.html#create_bitmap" title="Creates a memory bitmap.">create_bitmap</a>, <a class="xref" href="alleg035.html#d_button_proc" title="Dialog procedure implementing a button object.">d_button_proc</a>, <a class="xref" href="alleg035.html#d_check_proc" title="Dialog procedure implementing a check box object.">d_check_proc</a>, <a class="xref" href="alleg035.html#d_clear_proc" title="Dialog procedure to clear the screen.">d_clear_proc</a>, <a class="xref" href="alleg035.html#d_edit_proc" title="Dialog procedure implementing an editable text object.">d_edit_proc</a>, <a class="xref" href="alleg011.html#desktop_palette" title="The palette used by the Atari ST low resolution desktop.">desktop_palette</a>, <a class="xref" href="alleg009.html#destroy_bitmap" title="Destroys any type of created bitmap.">destroy_bitmap</a>, <a class="xref" href="alleg035.html#do_dialog" title="Basic dialog manager function.">do_dialog</a>, <a class="xref" href="alleg032.html#fixcos" title="Fixed point cosine of binary angles.">fixcos</a>, <a class="xref" href="alleg001.html#fixed" title="Fixed point integer to replace floats.">fixed</a>, <a class="xref" href="alleg032.html#fixmul" title="Multiplies two fixed point values together.">fixmul</a>, <a class="xref" href="alleg032.html#fixsin" title="Fixed point sine of binary angles.">fixsin</a>, <a class="xref" href="alleg032.html#fixtoi" title="Converts a fixed point to integer with rounding.">fixtoi</a>, <a class="xref" href="alleg018.html#font" title="A simple 8x8 fixed size font.">font</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg004.html#install_mouse" title="Installs the Allegro mouse handler.">install_mouse</a>, <a class="xref" href="alleg005.html#install_timer" title="Installs the Allegro timer interrupt handler.">install_timer</a>, <a class="xref" href="alleg032.html#itofix" title="Converts an integer to fixed point.">itofix</a>, <a class="xref" href="alleg006.html#key" title="Array of flags indicating key state.">key</a>, <a class="xref" href="alleg013.html#line" title="Draws a line onto the bitmap.">line</a>, <a class="xref" href="alleg031.html#load_datafile" title="Loads a datafile into memory.">load_datafile</a>, <a class="xref" href="alleg012.html#makecol" title="Converts an RGB value into the current pixel format.">makecol</a>, <a class="xref" href="alleg035.html#object_message" title="Sends a message to an object and returns the answer.">object_message</a>, <a class="xref" href="alleg030.html#replace_filename" title="Replaces path+filename with a new filename tail.">replace_filename</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>, <a class="xref" href="alleg011.html#set_palette" title="Sets the entire palette of 256 colors.">set_palette</a>, <a class="xref" href="alleg031.html#unload_datafile" title="Frees all the objects in a datafile.">unload_datafile</a>.</blockquote> <div class="al-api"><b>Example <a name="exunicod">exunicod</a></b></div><br> This program demonstrates the use of the 16-bit Unicode text encoding format with Allegro. The example displays a message translated to different languages scrolling on the screen using an external font containing the required characters to display those messages. <p> Note how the Allegro unicode string functions resemble the functions you can find in the standard C library, only these handle Unicode on all platforms. <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg001.html#BITMAP" title="Stores the contents of a bitmap.">BITMAP</a>, <a class="xref" href="alleg001.html#DATAFILE" title="Stores an Allegro datafile in memory.">DATAFILE</a>, <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg001.html#FONT" title="Stores an Allegro font.">FONT</a>, <a class="xref" href="alleg009.html#SCREEN_H" title="Global define to obtain the size of the screen.">SCREEN_H</a>, <a class="xref" href="alleg009.html#SCREEN_W" title="Global define to obtain the size of the screen.">SCREEN_W</a>, <a class="xref" href="alleg000.html#allegro_error" title="Stores the last Allegro error message.">allegro_error</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg014.html#blit" title="Copies a rectangular area from one bitmap to another.">blit</a>, <a class="xref" href="alleg013.html#clear_to_color" title="Clears the bitmap to the specified color.">clear_to_color</a>, <a class="xref" href="alleg009.html#create_bitmap" title="Creates a memory bitmap.">create_bitmap</a>, <a class="xref" href="alleg009.html#destroy_bitmap" title="Destroys any type of created bitmap.">destroy_bitmap</a>, <a class="xref" href="alleg018.html#font" title="A simple 8x8 fixed size font.">font</a>, <a class="xref" href="alleg005.html#install_int_ex" title="Adds or modifies a timer.">install_int_ex</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg005.html#install_timer" title="Installs the Allegro timer interrupt handler.">install_timer</a>, <a class="xref" href="alleg006.html#keypressed" title="Tells if there are keypresses waiting in the input buffer.">keypressed</a>, <a class="xref" href="alleg031.html#load_datafile" title="Loads a datafile into memory.">load_datafile</a>, <a class="xref" href="alleg030.html#replace_filename" title="Replaces path+filename with a new filename tail.">replace_filename</a>, <a class="xref" href="alleg005.html#rest" title="Waits a specified number of milliseconds or yields CPU.">rest</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>, <a class="xref" href="alleg002.html#set_uformat" title="Set the global current text encoding format.">set_uformat</a>, <a class="xref" href="alleg000.html#set_window_title" title="Sets the window title of the Allegro program.">set_window_title</a>, <a class="xref" href="alleg018.html#text_height" title="Returns the height of a font in pixels.">text_height</a>, <a class="xref" href="alleg018.html#text_length" title="Returns the length of a string in pixels.">text_length</a>, <a class="xref" href="alleg018.html#textout_ex" title="Writes a string on a bitmap.">textout_ex</a>, <a class="xref" href="alleg002.html#uconvert_ascii" title="Converts string from ASCII into the current format.">uconvert_ascii</a>, <a class="xref" href="alleg031.html#unload_datafile" title="Frees all the objects in a datafile.">unload_datafile</a>, <a class="xref" href="alleg002.html#ustrcat" title="Concatenates a string to another one.">ustrcat</a>, <a class="xref" href="alleg002.html#ustrcpy" title="Copies a string into another one.">ustrcpy</a>, <a class="xref" href="alleg002.html#ustrsize" title="Size of the string in bytes without null terminator.">ustrsize</a>, <a class="xref" href="alleg002.html#ustrsizez" title="Size of the string in bytes including null terminator.">ustrsizez</a>.</blockquote> <div class="al-api"><b>Example <a name="exbitmap">exbitmap</a></b></div><br> This program demonstrates how to load and display a bitmap file. You have to use this example from the command line to specify as first parameter a graphic file in one of Allegro's supported formats. If the file is loaded successfully, it will be displayed until you press a key. <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg001.html#BITMAP" title="Stores the contents of a bitmap.">BITMAP</a>, <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg001.html#PALETTE" title="Stores palette information.">PALETTE</a>, <a class="xref" href="alleg009.html#SCREEN_H" title="Global define to obtain the size of the screen.">SCREEN_H</a>, <a class="xref" href="alleg009.html#SCREEN_W" title="Global define to obtain the size of the screen.">SCREEN_W</a>, <a class="xref" href="alleg000.html#allegro_error" title="Stores the last Allegro error message.">allegro_error</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg014.html#blit" title="Copies a rectangular area from one bitmap to another.">blit</a>, <a class="xref" href="alleg009.html#destroy_bitmap" title="Destroys any type of created bitmap.">destroy_bitmap</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg010.html#load_bitmap" title="Loads any supported bitmap from a file.">load_bitmap</a>, <a class="xref" href="alleg006.html#readkey" title="Returns the next character from the keyboard buffer.">readkey</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>, <a class="xref" href="alleg011.html#set_palette" title="Sets the entire palette of 256 colors.">set_palette</a>.</blockquote> <div class="al-api"><b>Example <a name="exscale">exscale</a></b></div><br> This example demonstrates how to use PCX files, palettes and stretch blits. It loads a PCX file, sets its palette and does some random stretch_blits. Don't worry - it's VERY slowed down using vsync(). <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg001.html#BITMAP" title="Stores the contents of a bitmap.">BITMAP</a>, <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg001.html#PALETTE" title="Stores palette information.">PALETTE</a>, <a class="xref" href="alleg009.html#SCREEN_H" title="Global define to obtain the size of the screen.">SCREEN_H</a>, <a class="xref" href="alleg009.html#SCREEN_W" title="Global define to obtain the size of the screen.">SCREEN_W</a>, <a class="xref" href="alleg000.html#allegro_error" title="Stores the last Allegro error message.">allegro_error</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg014.html#blit" title="Copies a rectangular area from one bitmap to another.">blit</a>, <a class="xref" href="alleg009.html#destroy_bitmap" title="Destroys any type of created bitmap.">destroy_bitmap</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg006.html#keypressed" title="Tells if there are keypresses waiting in the input buffer.">keypressed</a>, <a class="xref" href="alleg010.html#load_pcx" title="Loads a PCX bitmap from a file.">load_pcx</a>, <a class="xref" href="alleg030.html#replace_filename" title="Replaces path+filename with a new filename tail.">replace_filename</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>, <a class="xref" href="alleg011.html#set_palette" title="Sets the entire palette of 256 colors.">set_palette</a>, <a class="xref" href="alleg014.html#stretch_blit" title="Scales a rectangular area from one bitmap to another.">stretch_blit</a>, <a class="xref" href="alleg008.html#vsync" title="Waits for a vertical retrace to begin.">vsync</a>.</blockquote> <div class="al-api"><b>Example <a name="exconfig">exconfig</a></b></div><br> This is a very simple program showing how to use the Allegro configuration (ini file) routines. A first look at the example shows nothing more than a static graphic and the wait for a key press. However, the way this graphic is displayed is configured through a custom exconfig.ini file which is loaded manually. From this file the example obtains parameters like fullscreen/windowed mode, a specific graphic resolution to set up, which graphic to show, how to blit it on the screen, etc. <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg001.html#BITMAP" title="Stores the contents of a bitmap.">BITMAP</a>, <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg001.html#RGB" title="Single palette entry.">RGB</a>, <a class="xref" href="alleg009.html#SCREEN_H" title="Global define to obtain the size of the screen.">SCREEN_H</a>, <a class="xref" href="alleg009.html#SCREEN_W" title="Global define to obtain the size of the screen.">SCREEN_W</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg014.html#blit" title="Copies a rectangular area from one bitmap to another.">blit</a>, <a class="xref" href="alleg013.html#clear_bitmap" title="Clears the bitmap to color 0.">clear_bitmap</a>, <a class="xref" href="alleg009.html#destroy_bitmap" title="Destroys any type of created bitmap.">destroy_bitmap</a>, <a class="xref" href="alleg018.html#font" title="A simple 8x8 fixed size font.">font</a>, <a class="xref" href="alleg003.html#get_config_argv" title="Reads a token list from the configuration file.">get_config_argv</a>, <a class="xref" href="alleg003.html#get_config_int" title="Retrieves an integer from the configuration file.">get_config_int</a>, <a class="xref" href="alleg003.html#get_config_string" title="Retrieves a string from the configuration file.">get_config_string</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg013.html#line" title="Draws a line onto the bitmap.">line</a>, <a class="xref" href="alleg010.html#load_bitmap" title="Loads any supported bitmap from a file.">load_bitmap</a>, <a class="xref" href="alleg012.html#makecol" title="Converts an RGB value into the current pixel format.">makecol</a>, <a class="xref" href="alleg003.html#pop_config_state" title="Pops a previously pushed configuration state.">pop_config_state</a>, <a class="xref" href="alleg003.html#push_config_state" title="Pushes the current configuration state.">push_config_state</a>, <a class="xref" href="alleg006.html#readkey" title="Returns the next character from the keyboard buffer.">readkey</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg008.html#set_color_depth" title="Sets the global pixel color depth.">set_color_depth</a>, <a class="xref" href="alleg003.html#set_config_file" title="Sets the configuration file.">set_config_file</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>, <a class="xref" href="alleg011.html#set_palette" title="Sets the entire palette of 256 colors.">set_palette</a>, <a class="xref" href="alleg014.html#stretch_blit" title="Scales a rectangular area from one bitmap to another.">stretch_blit</a>, <a class="xref" href="alleg018.html#textout_centre_ex" title="Writes a centered string on a bitmap.">textout_centre_ex</a>, <a class="xref" href="alleg018.html#textprintf_centre_ex" title="Formatted centered output of a string.">textprintf_centre_ex</a>, <a class="xref" href="alleg002.html#ustrdup" title="Duplicates a string.">ustrdup</a>, <a class="xref" href="alleg002.html#ustricmp" title="Compares two strings ignoring case.">ustricmp</a>.</blockquote> <div class="al-api"><b>Example <a name="exdata">exdata</a></b></div><br> This program demonstrates how to access the contents of an Allegro datafile (created by the grabber utility). The example loads the file <tt>`example.dat'</tt>, then blits a bitmap and shows a font, both from this datafile. <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg001.html#DATAFILE" title="Stores an Allegro datafile in memory.">DATAFILE</a>, <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg000.html#allegro_error" title="Stores the last Allegro error message.">allegro_error</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg014.html#blit" title="Copies a rectangular area from one bitmap to another.">blit</a>, <a class="xref" href="alleg018.html#font" title="A simple 8x8 fixed size font.">font</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg031.html#load_datafile" title="Loads a datafile into memory.">load_datafile</a>, <a class="xref" href="alleg012.html#makecol" title="Converts an RGB value into the current pixel format.">makecol</a>, <a class="xref" href="alleg006.html#readkey" title="Returns the next character from the keyboard buffer.">readkey</a>, <a class="xref" href="alleg030.html#replace_filename" title="Replaces path+filename with a new filename tail.">replace_filename</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg010.html#set_color_conversion" title="Tells Allegro how to convert images during loading time.">set_color_conversion</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>, <a class="xref" href="alleg011.html#set_palette" title="Sets the entire palette of 256 colors.">set_palette</a>, <a class="xref" href="alleg018.html#textout_ex" title="Writes a string on a bitmap.">textout_ex</a>, <a class="xref" href="alleg031.html#unload_datafile" title="Frees all the objects in a datafile.">unload_datafile</a>.</blockquote> <div class="al-api"><b>Example <a name="exsprite">exsprite</a></b></div><br> This example demonstrates how to use datafiles, various sprite drawing routines and flicker-free animation. <p> Why is the animate() routine coded in that way? As you probably know, VIDEO RAM is much slower than "normal" RAM, so it's advisable to reduce VRAM blits to a minimum. Drawing sprite on the screen (meaning in VRAM) and then clearing a background for it is not very fast. This example uses a different method which is much faster, but require a bit more memory. <p> First the buffer is cleared (it's a normal BITMAP), then the sprite is drawn on it, and when the drawing is finished this buffer is copied directly to the screen. So the end result is that there is a single VRAM blit instead of blitting/clearing the background and drawing a sprite on it. It's a good method even when you have to restore the background. And of course, it completely removes any flickering effect. <p> When one uses a big (ie. 800x600 background) and draws something on it, it's wise to use a copy of background somewhere in memory and restore background using this "virtual background". When blitting from VRAM in SVGA modes, it's probably, that drawing routines have to switch banks on video card. I think, I don't have to remind how slow is it. <p> Note that on modern systems, the above isn't true anymore, and you usually get the best performance by caching all your animations in video ram and doing only VRAM->VRAM blits, so there is no more RAM->VRAM transfer at all anymore. And usually, such transfers can run in parallel on the graphics card's processor as well, costing virtually no main cpu time at all. See the exaccel example for an example of this. <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg001.html#BITMAP" title="Stores the contents of a bitmap.">BITMAP</a>, <a class="xref" href="alleg001.html#DATAFILE" title="Stores an Allegro datafile in memory.">DATAFILE</a>, <a class="xref" href="alleg005.html#END_OF_FUNCTION" title="Locks the code used by a timer.">END_OF_FUNCTION</a>, <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg005.html#LOCK_FUNCTION" title="Locks the memory of a function used by a timer.">LOCK_FUNCTION</a>, <a class="xref" href="alleg005.html#LOCK_VARIABLE" title="Locks the memory of a variable used by a timer.">LOCK_VARIABLE</a>, <a class="xref" href="alleg009.html#SCREEN_H" title="Global define to obtain the size of the screen.">SCREEN_H</a>, <a class="xref" href="alleg009.html#SCREEN_W" title="Global define to obtain the size of the screen.">SCREEN_W</a>, <a class="xref" href="alleg000.html#allegro_error" title="Stores the last Allegro error message.">allegro_error</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg014.html#blit" title="Copies a rectangular area from one bitmap to another.">blit</a>, <a class="xref" href="alleg013.html#circle" title="Draws a circle.">circle</a>, <a class="xref" href="alleg013.html#clear_bitmap" title="Clears the bitmap to color 0.">clear_bitmap</a>, <a class="xref" href="alleg006.html#clear_keybuf" title="Clears the keyboard buffer.">clear_keybuf</a>, <a class="xref" href="alleg009.html#create_bitmap" title="Creates a memory bitmap.">create_bitmap</a>, <a class="xref" href="alleg009.html#destroy_bitmap" title="Destroys any type of created bitmap.">destroy_bitmap</a>, <a class="xref" href="alleg014.html#draw_sprite" title="Draws a copy of the sprite onto the destination bitmap.">draw_sprite</a>, <a class="xref" href="alleg014.html#draw_sprite_h_flip" title="Draws the sprite transformed to the destination bitmap.">draw_sprite_h_flip</a>, <a class="xref" href="alleg014.html#draw_sprite_v_flip" title="Draws the sprite transformed to the destination bitmap.">draw_sprite_v_flip</a>, <a class="xref" href="alleg014.html#draw_sprite_vh_flip" title="Draws the sprite transformed to the destination bitmap.">draw_sprite_vh_flip</a>, <a class="xref" href="alleg001.html#fixed" title="Fixed point integer to replace floats.">fixed</a>, <a class="xref" href="alleg018.html#font" title="A simple 8x8 fixed size font.">font</a>, <a class="xref" href="alleg013.html#hline" title="Draws a horizontal line onto the bitmap.">hline</a>, <a class="xref" href="alleg005.html#install_int_ex" title="Adds or modifies a timer.">install_int_ex</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg024.html#install_sound" title="Initialises the sound module.">install_sound</a>, <a class="xref" href="alleg005.html#install_timer" title="Installs the Allegro timer interrupt handler.">install_timer</a>, <a class="xref" href="alleg032.html#itofix" title="Converts an integer to fixed point.">itofix</a>, <a class="xref" href="alleg006.html#key" title="Array of flags indicating key state.">key</a>, <a class="xref" href="alleg006.html#keypressed" title="Tells if there are keypresses waiting in the input buffer.">keypressed</a>, <a class="xref" href="alleg031.html#load_datafile" title="Loads a datafile into memory.">load_datafile</a>, <a class="xref" href="alleg012.html#makecol" title="Converts an RGB value into the current pixel format.">makecol</a>, <a class="xref" href="alleg012.html#palette_color" title="Maps palette indexes into the current pixel format colors.">palette_color</a>, <a class="xref" href="alleg014.html#pivot_sprite" title="Rotates a sprite around a specified point.">pivot_sprite</a>, <a class="xref" href="alleg014.html#pivot_sprite_v_flip" title="Rotates and flips a sprite around a specified point.">pivot_sprite_v_flip</a>, <a class="xref" href="alleg026.html#play_sample" title="Plays a sample.">play_sample</a>, <a class="xref" href="alleg013.html#rectfill" title="Draws a solid filled rectangle.">rectfill</a>, <a class="xref" href="alleg030.html#replace_filename" title="Replaces path+filename with a new filename tail.">replace_filename</a>, <a class="xref" href="alleg005.html#rest" title="Waits a specified number of milliseconds or yields CPU.">rest</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>, <a class="xref" href="alleg011.html#set_palette" title="Sets the entire palette of 256 colors.">set_palette</a>, <a class="xref" href="alleg018.html#text_height" title="Returns the height of a font in pixels.">text_height</a>, <a class="xref" href="alleg018.html#textout_centre_ex" title="Writes a centered string on a bitmap.">textout_centre_ex</a>, <a class="xref" href="alleg031.html#unload_datafile" title="Frees all the objects in a datafile.">unload_datafile</a>, <a class="xref" href="alleg008.html#vsync" title="Waits for a vertical retrace to begin.">vsync</a>.</blockquote> <div class="al-api"><b>Example <a name="exrotscl">exrotscl</a></b></div><br> This example demonstrates rotate_scaled_sprite functions. <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg001.html#BITMAP" title="Stores the contents of a bitmap.">BITMAP</a>, <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg009.html#SCREEN_H" title="Global define to obtain the size of the screen.">SCREEN_H</a>, <a class="xref" href="alleg009.html#SCREEN_W" title="Global define to obtain the size of the screen.">SCREEN_W</a>, <a class="xref" href="alleg009.html#acquire_screen" title="Shortcut of acquire_bitmap(screen);">acquire_screen</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg013.html#clear_to_color" title="Clears the bitmap to the specified color.">clear_to_color</a>, <a class="xref" href="alleg009.html#create_bitmap" title="Creates a memory bitmap.">create_bitmap</a>, <a class="xref" href="alleg009.html#destroy_bitmap" title="Destroys any type of created bitmap.">destroy_bitmap</a>, <a class="xref" href="alleg014.html#draw_trans_sprite" title="Draws a sprite blending it with the destination.">draw_trans_sprite</a>, <a class="xref" href="alleg001.html#fixed" title="Fixed point integer to replace floats.">fixed</a>, <a class="xref" href="alleg018.html#font" title="A simple 8x8 fixed size font.">font</a>, <a class="xref" href="alleg032.html#ftofix" title="Converts a floating point value to fixed point.">ftofix</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg006.html#key" title="Array of flags indicating key state.">key</a>, <a class="xref" href="alleg006.html#keypressed" title="Tells if there are keypresses waiting in the input buffer.">keypressed</a>, <a class="xref" href="alleg010.html#load_bitmap" title="Loads any supported bitmap from a file.">load_bitmap</a>, <a class="xref" href="alleg012.html#makeacol" title="Converts RGBA colors into display dependent pixel formats.">makeacol</a>, <a class="xref" href="alleg012.html#makecol" title="Converts an RGB value into the current pixel format.">makecol</a>, <a class="xref" href="alleg006.html#readkey" title="Returns the next character from the keyboard buffer.">readkey</a>, <a class="xref" href="alleg009.html#release_screen" title="Shortcut of release_bitmap(screen);">release_screen</a>, <a class="xref" href="alleg005.html#rest" title="Waits a specified number of milliseconds or yields CPU.">rest</a>, <a class="xref" href="alleg014.html#rotate_scaled_sprite" title="Rotates and stretches a sprite.">rotate_scaled_sprite</a>, <a class="xref" href="alleg014.html#rotate_scaled_sprite_lit" title="Rotates and stretches a sprite.">rotate_scaled_sprite_lit</a>, <a class="xref" href="alleg014.html#rotate_scaled_sprite_trans" title="Rotates and stretches a sprite.">rotate_scaled_sprite_trans</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg020.html#set_alpha_blender" title="Enables a special alpha-channel blending mode.">set_alpha_blender</a>, <a class="xref" href="alleg010.html#set_color_conversion" title="Tells Allegro how to convert images during loading time.">set_color_conversion</a>, <a class="xref" href="alleg008.html#set_color_depth" title="Sets the global pixel color depth.">set_color_depth</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>, <a class="xref" href="alleg020.html#set_trans_blender" title="Enables a truecolor blender.">set_trans_blender</a>, <a class="xref" href="alleg018.html#textout_centre_ex" title="Writes a centered string on a bitmap.">textout_centre_ex</a>.</blockquote> <div class="al-api"><b>Example <a name="exexedat">exexedat</a></b></div><br> This program demonstrates how to access the contents of an Allegro datafile (created by the grabber utility) linked to the executable by the exedat tool. It is basically the exdata example with minor modifications. <p> You may ask: how do you compile, append and exec your program? <p> Answer: like this... <p> 1) Compile your program like normal. Use the magic filenames with '#' to load your data where needed. <p> 2) Once you compressed your program, run "exedat foo.exe data.dat" <p> 3) Finally run your program. <p> Note that appending data to the end of binaries may not be portable across all platforms supported by Allegro. <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg001.html#DATAFILE" title="Stores an Allegro datafile in memory.">DATAFILE</a>, <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg000.html#allegro_error" title="Stores the last Allegro error message.">allegro_error</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg014.html#blit" title="Copies a rectangular area from one bitmap to another.">blit</a>, <a class="xref" href="alleg018.html#font" title="A simple 8x8 fixed size font.">font</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg013.html#line" title="Draws a line onto the bitmap.">line</a>, <a class="xref" href="alleg031.html#load_datafile" title="Loads a datafile into memory.">load_datafile</a>, <a class="xref" href="alleg012.html#makecol" title="Converts an RGB value into the current pixel format.">makecol</a>, <a class="xref" href="alleg006.html#readkey" title="Returns the next character from the keyboard buffer.">readkey</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg010.html#set_color_conversion" title="Tells Allegro how to convert images during loading time.">set_color_conversion</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>, <a class="xref" href="alleg011.html#set_palette" title="Sets the entire palette of 256 colors.">set_palette</a>, <a class="xref" href="alleg018.html#textout_ex" title="Writes a string on a bitmap.">textout_ex</a>, <a class="xref" href="alleg031.html#unload_datafile" title="Frees all the objects in a datafile.">unload_datafile</a>.</blockquote> <div class="al-api"><b>Example <a name="extrans">extrans</a></b></div><br> This program demonstrates how to use the lighting and translucency functions. The first part of the example will show a dark screen illuminated by a spotlight you can move with your mouse. After a key press the example shows the full bitmap and the spotlight changes to be a reduced version of the background with 50% of translucency. <p> The translucency effect is easy to do in all color depths. However, the lighting effect has to be performed in a different way depending on whether the screen is in 8bit mode or another color depth. This is because additive drawing mode uses a different set of routines for truecolor modes. <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg001.html#BITMAP" title="Stores the contents of a bitmap.">BITMAP</a>, <a class="xref" href="alleg001.html#COLOR_MAP" title="Stores a color map to accelerate drawing.">COLOR_MAP</a>, <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg001.html#PALETTE" title="Stores palette information.">PALETTE</a>, <a class="xref" href="alleg001.html#RGB" title="Single palette entry.">RGB</a>, <a class="xref" href="alleg001.html#RGB_MAP" title="Stores an rgb map to accelerate conversions.">RGB_MAP</a>, <a class="xref" href="alleg009.html#SCREEN_H" title="Global define to obtain the size of the screen.">SCREEN_H</a>, <a class="xref" href="alleg009.html#SCREEN_W" title="Global define to obtain the size of the screen.">SCREEN_W</a>, <a class="xref" href="alleg000.html#allegro_error" title="Stores the last Allegro error message.">allegro_error</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg009.html#bitmap_color_depth" title="Returns the color depth of the specified bitmap.">bitmap_color_depth</a>, <a class="xref" href="alleg014.html#blit" title="Copies a rectangular area from one bitmap to another.">blit</a>, <a class="xref" href="alleg013.html#circlefill" title="Draws a filled circle.">circlefill</a>, <a class="xref" href="alleg013.html#clear_bitmap" title="Clears the bitmap to color 0.">clear_bitmap</a>, <a class="xref" href="alleg006.html#clear_keybuf" title="Clears the keyboard buffer.">clear_keybuf</a>, <a class="xref" href="alleg020.html#color_map" title="Global pointer to the color mapping table.">color_map</a>, <a class="xref" href="alleg009.html#create_bitmap" title="Creates a memory bitmap.">create_bitmap</a>, <a class="xref" href="alleg009.html#create_bitmap_ex" title="Creates a memory bitmap specifying color depth.">create_bitmap_ex</a>, <a class="xref" href="alleg020.html#create_light_table" title="Fills a color mapping table for lighting effects.">create_light_table</a>, <a class="xref" href="alleg021.html#create_rgb_table" title="Generates an RGB mapping table with lookup data for a palette.">create_rgb_table</a>, <a class="xref" href="alleg020.html#create_trans_table" title="Fills a color mapping table for translucency effects.">create_trans_table</a>, <a class="xref" href="alleg009.html#destroy_bitmap" title="Destroys any type of created bitmap.">destroy_bitmap</a>, <a class="xref" href="alleg014.html#draw_trans_sprite" title="Draws a sprite blending it with the destination.">draw_trans_sprite</a>, <a class="xref" href="alleg020.html#drawing_mode" title="Sets the graphics drawing mode.">drawing_mode</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg004.html#install_mouse" title="Installs the Allegro mouse handler.">install_mouse</a>, <a class="xref" href="alleg005.html#install_timer" title="Installs the Allegro timer interrupt handler.">install_timer</a>, <a class="xref" href="alleg006.html#keypressed" title="Tells if there are keypresses waiting in the input buffer.">keypressed</a>, <a class="xref" href="alleg010.html#load_bitmap" title="Loads any supported bitmap from a file.">load_bitmap</a>, <a class="xref" href="alleg004.html#mouse_x" title="Global variable with the mouse position/button state.">mouse_x</a>, <a class="xref" href="alleg004.html#mouse_y" title="Global variable with the mouse position/button state.">mouse_y</a>, <a class="xref" href="alleg004.html#poll_mouse" title="Polls the mouse.">poll_mouse</a>, <a class="xref" href="alleg013.html#rectfill" title="Draws a solid filled rectangle.">rectfill</a>, <a class="xref" href="alleg030.html#replace_filename" title="Replaces path+filename with a new filename tail.">replace_filename</a>, <a class="xref" href="alleg005.html#rest" title="Waits a specified number of milliseconds or yields CPU.">rest</a>, <a class="xref" href="alleg021.html#rgb_map" title="Look up table to speed up reducing RGB values to palette colors.">rgb_map</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg020.html#set_alpha_blender" title="Enables a special alpha-channel blending mode.">set_alpha_blender</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>, <a class="xref" href="alleg011.html#set_palette" title="Sets the entire palette of 256 colors.">set_palette</a>, <a class="xref" href="alleg020.html#set_trans_blender" title="Enables a truecolor blender.">set_trans_blender</a>, <a class="xref" href="alleg020.html#set_write_alpha_blender" title="Enables the special alpha-channel editing mode.">set_write_alpha_blender</a>, <a class="xref" href="alleg014.html#stretch_blit" title="Scales a rectangular area from one bitmap to another.">stretch_blit</a>.</blockquote> <div class="al-api"><b>Example <a name="extrans2">extrans2</a></b></div><br> This program demonstrates how to draw trans and lit sprites and flip them at the same time, using draw_sprite_ex() function. It displays several images moving around using different drawing modes while you can press space key to change the flipping orientation. <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg001.html#BITMAP" title="Stores the contents of a bitmap.">BITMAP</a>, <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg000.html#allegro_error" title="Stores the last Allegro error message.">allegro_error</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg014.html#blit" title="Copies a rectangular area from one bitmap to another.">blit</a>, <a class="xref" href="alleg013.html#clear_bitmap" title="Clears the bitmap to color 0.">clear_bitmap</a>, <a class="xref" href="alleg009.html#create_bitmap" title="Creates a memory bitmap.">create_bitmap</a>, <a class="xref" href="alleg009.html#destroy_bitmap" title="Destroys any type of created bitmap.">destroy_bitmap</a>, <a class="xref" href="alleg014.html#draw_sprite_ex" title="Draws a optionally flipped/blended/tinted sprite on the bitmap.">draw_sprite_ex</a>, <a class="xref" href="alleg018.html#font" title="A simple 8x8 fixed size font.">font</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg005.html#install_timer" title="Installs the Allegro timer interrupt handler.">install_timer</a>, <a class="xref" href="alleg006.html#key" title="Array of flags indicating key state.">key</a>, <a class="xref" href="alleg010.html#load_bitmap" title="Loads any supported bitmap from a file.">load_bitmap</a>, <a class="xref" href="alleg012.html#makecol" title="Converts an RGB value into the current pixel format.">makecol</a>, <a class="xref" href="alleg030.html#replace_filename" title="Replaces path+filename with a new filename tail.">replace_filename</a>, <a class="xref" href="alleg005.html#rest" title="Waits a specified number of milliseconds or yields CPU.">rest</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg008.html#set_color_depth" title="Sets the global pixel color depth.">set_color_depth</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>, <a class="xref" href="alleg020.html#set_trans_blender" title="Enables a truecolor blender.">set_trans_blender</a>, <a class="xref" href="alleg014.html#stretch_blit" title="Scales a rectangular area from one bitmap to another.">stretch_blit</a>, <a class="xref" href="alleg018.html#textprintf_ex" title="Formatted output of a string.">textprintf_ex</a>.</blockquote> <div class="al-api"><b>Example <a name="extruec">extruec</a></b></div><br> This program shows how to specify colors in the various different truecolor pixel formats. The example shows the same screen (a few text lines and three coloured gradients) in all the color depth modes supported by your video card. The more color depth you have, the less banding you will see in the gradients. <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg001.html#PALETTE" title="Stores palette information.">PALETTE</a>, <a class="xref" href="alleg001.html#RGB" title="Single palette entry.">RGB</a>, <a class="xref" href="alleg009.html#SCREEN_H" title="Global define to obtain the size of the screen.">SCREEN_H</a>, <a class="xref" href="alleg009.html#SCREEN_W" title="Global define to obtain the size of the screen.">SCREEN_W</a>, <a class="xref" href="alleg009.html#acquire_screen" title="Shortcut of acquire_bitmap(screen);">acquire_screen</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg013.html#clear_to_color" title="Clears the bitmap to the specified color.">clear_to_color</a>, <a class="xref" href="alleg018.html#font" title="A simple 8x8 fixed size font.">font</a>, <a class="xref" href="alleg011.html#generate_332_palette" title="Constructs a fake truecolor palette.">generate_332_palette</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg006.html#key" title="Array of flags indicating key state.">key</a>, <a class="xref" href="alleg012.html#makecol" title="Converts an RGB value into the current pixel format.">makecol</a>, <a class="xref" href="alleg006.html#readkey" title="Returns the next character from the keyboard buffer.">readkey</a>, <a class="xref" href="alleg009.html#release_screen" title="Shortcut of release_bitmap(screen);">release_screen</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg008.html#set_color_depth" title="Sets the global pixel color depth.">set_color_depth</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>, <a class="xref" href="alleg011.html#set_palette" title="Sets the entire palette of 256 colors.">set_palette</a>, <a class="xref" href="alleg018.html#textout_centre_ex" title="Writes a centered string on a bitmap.">textout_centre_ex</a>, <a class="xref" href="alleg018.html#textout_ex" title="Writes a string on a bitmap.">textout_ex</a>, <a class="xref" href="alleg018.html#textprintf_ex" title="Formatted output of a string.">textprintf_ex</a>, <a class="xref" href="alleg013.html#vline" title="Draws a vertical line onto the bitmap.">vline</a>.</blockquote> <div class="al-api"><b>Example <a name="excolmap">excolmap</a></b></div><br> This program demonstrates how to create custom graphic effects with the create_color_table function. Allegro drawing routines are affected by any color table you might have set up. In the first part of this example, a greyscale color table is set. The result is that a simple rectfill call, instead of drawing a rectangle with color zero, uses the already drawn pixels to determine the pixel to be drawn (read the comment of return_grey_color() for a precise description of the algorithm). In the second part of the test, the color table is changed to be an inverse table, meaning that any pixel drawn will be shown as its color values had been inverted. <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg001.html#BITMAP" title="Stores the contents of a bitmap.">BITMAP</a>, <a class="xref" href="alleg001.html#COLOR_MAP" title="Stores a color map to accelerate drawing.">COLOR_MAP</a>, <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg001.html#PALETTE" title="Stores palette information.">PALETTE</a>, <a class="xref" href="alleg001.html#RGB" title="Single palette entry.">RGB</a>, <a class="xref" href="alleg001.html#RGB_MAP" title="Stores an rgb map to accelerate conversions.">RGB_MAP</a>, <a class="xref" href="alleg009.html#SCREEN_H" title="Global define to obtain the size of the screen.">SCREEN_H</a>, <a class="xref" href="alleg009.html#SCREEN_W" title="Global define to obtain the size of the screen.">SCREEN_W</a>, <a class="xref" href="alleg000.html#allegro_error" title="Stores the last Allegro error message.">allegro_error</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg014.html#blit" title="Copies a rectangular area from one bitmap to another.">blit</a>, <a class="xref" href="alleg013.html#circlefill" title="Draws a filled circle.">circlefill</a>, <a class="xref" href="alleg006.html#clear_keybuf" title="Clears the keyboard buffer.">clear_keybuf</a>, <a class="xref" href="alleg020.html#color_map" title="Global pointer to the color mapping table.">color_map</a>, <a class="xref" href="alleg009.html#create_bitmap" title="Creates a memory bitmap.">create_bitmap</a>, <a class="xref" href="alleg020.html#create_color_table" title="Fills a color mapping table for customised effects.">create_color_table</a>, <a class="xref" href="alleg021.html#create_rgb_table" title="Generates an RGB mapping table with lookup data for a palette.">create_rgb_table</a>, <a class="xref" href="alleg009.html#destroy_bitmap" title="Destroys any type of created bitmap.">destroy_bitmap</a>, <a class="xref" href="alleg020.html#drawing_mode" title="Sets the graphics drawing mode.">drawing_mode</a>, <a class="xref" href="alleg018.html#font" title="A simple 8x8 fixed size font.">font</a>, <a class="xref" href="alleg011.html#generate_332_palette" title="Constructs a fake truecolor palette.">generate_332_palette</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg006.html#keypressed" title="Tells if there are keypresses waiting in the input buffer.">keypressed</a>, <a class="xref" href="alleg012.html#makecol" title="Converts an RGB value into the current pixel format.">makecol</a>, <a class="xref" href="alleg013.html#rectfill" title="Draws a solid filled rectangle.">rectfill</a>, <a class="xref" href="alleg021.html#rgb_map" title="Look up table to speed up reducing RGB values to palette colors.">rgb_map</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>, <a class="xref" href="alleg011.html#set_palette" title="Sets the entire palette of 256 colors.">set_palette</a>, <a class="xref" href="alleg018.html#textout_centre_ex" title="Writes a centered string on a bitmap.">textout_centre_ex</a>, <a class="xref" href="alleg008.html#vsync" title="Waits for a vertical retrace to begin.">vsync</a>.</blockquote> <div class="al-api"><b>Example <a name="exrgbhsv">exrgbhsv</a></b></div><br> This program shows how to convert colors between the different color-space representations. The central area of the screen will display the current color. On the top left corner of the screen, three sliders allow you to modify the red, green and blue value of the color. On the bottom right corner of the screen, three sliders allow you to modify the hue, saturation and value of the color. The color bars beneath the sliders show what the resulting color will look like when the slider is dragged to that position. <p> Additionally this example also shows how to "inherit" the behaviour of a GUI object and extend it, here used to create the sliders. <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg001.html#BITMAP" title="Stores the contents of a bitmap.">BITMAP</a>, <a class="xref" href="alleg001.html#DIALOG" title="Stores a GUI description.">DIALOG</a>, <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg001.html#PALETTE" title="Stores palette information.">PALETTE</a>, <a class="xref" href="alleg001.html#RGB" title="Single palette entry.">RGB</a>, <a class="xref" href="alleg001.html#RGB_MAP" title="Stores an rgb map to accelerate conversions.">RGB_MAP</a>, <a class="xref" href="alleg000.html#allegro_error" title="Stores the last Allegro error message.">allegro_error</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg013.html#clear_to_color" title="Clears the bitmap to the specified color.">clear_to_color</a>, <a class="xref" href="alleg009.html#create_bitmap_ex" title="Creates a memory bitmap specifying color depth.">create_bitmap_ex</a>, <a class="xref" href="alleg021.html#create_rgb_table" title="Generates an RGB mapping table with lookup data for a palette.">create_rgb_table</a>, <a class="xref" href="alleg035.html#d_bitmap_proc" title="Dialog procedure drawing a bitmap.">d_bitmap_proc</a>, <a class="xref" href="alleg035.html#d_box_proc" title="Dialog procedure drawing boxes onto the screen.">d_box_proc</a>, <a class="xref" href="alleg035.html#d_slider_proc" title="Dialog procedure implementing a slider control object.">d_slider_proc</a>, <a class="xref" href="alleg035.html#d_text_proc" title="Dialogs procedure drawing text onto the screen.">d_text_proc</a>, <a class="xref" href="alleg009.html#destroy_bitmap" title="Destroys any type of created bitmap.">destroy_bitmap</a>, <a class="xref" href="alleg035.html#do_dialog" title="Basic dialog manager function.">do_dialog</a>, <a class="xref" href="alleg018.html#font" title="A simple 8x8 fixed size font.">font</a>, <a class="xref" href="alleg011.html#generate_332_palette" title="Constructs a fake truecolor palette.">generate_332_palette</a>, <a class="xref" href="alleg008.html#get_color_depth" title="Returns the current pixel color depth.">get_color_depth</a>, <a class="xref" href="alleg021.html#hsv_to_rgb" title="Converts color values between the HSV and RGB color spaces.">hsv_to_rgb</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg004.html#install_mouse" title="Installs the Allegro mouse handler.">install_mouse</a>, <a class="xref" href="alleg005.html#install_timer" title="Installs the Allegro timer interrupt handler.">install_timer</a>, <a class="xref" href="alleg006.html#key" title="Array of flags indicating key state.">key</a>, <a class="xref" href="alleg012.html#makecol" title="Converts an RGB value into the current pixel format.">makecol</a>, <a class="xref" href="alleg012.html#makecol32" title="Converts an RGB value into a display dependent pixel format.">makecol32</a>, <a class="xref" href="alleg012.html#makecol8" title="Converts an RGB value into a display dependent pixel format.">makecol8</a>, <a class="xref" href="alleg035.html#object_message" title="Sends a message to an object and returns the answer.">object_message</a>, <a class="xref" href="alleg021.html#rgb_map" title="Look up table to speed up reducing RGB values to palette colors.">rgb_map</a>, <a class="xref" href="alleg021.html#rgb_to_hsv" title="Converts color values between the HSV and RGB color spaces.">rgb_to_hsv</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg011.html#set_color" title="Sets the specified palette entry to the specified RGB triplet.">set_color</a>, <a class="xref" href="alleg008.html#set_color_depth" title="Sets the global pixel color depth.">set_color_depth</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>, <a class="xref" href="alleg011.html#set_palette" title="Sets the entire palette of 256 colors.">set_palette</a>, <a class="xref" href="alleg018.html#textout_ex" title="Writes a string on a bitmap.">textout_ex</a>, <a class="xref" href="alleg013.html#vline" title="Draws a vertical line onto the bitmap.">vline</a>, <a class="xref" href="alleg008.html#vsync" title="Waits for a vertical retrace to begin.">vsync</a>.</blockquote> <div class="al-api"><b>Example <a name="exshade">exshade</a></b></div><br> This program demonstrates how to draw Gouraud shaded (lit) sprites. In an apparently black screen, a planet like sprite is drawn close to the middle of the screen. In a similar way to how the first test of extrans works, you move the cursor on the screen with the mouse. Attached to this mouse you can imagine a virtual spotlight illuminating the scene around. Depending on where the mouse is, the Gouraud shaded sprite will show the direction of the light. <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg001.html#BITMAP" title="Stores the contents of a bitmap.">BITMAP</a>, <a class="xref" href="alleg001.html#COLOR_MAP" title="Stores a color map to accelerate drawing.">COLOR_MAP</a>, <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg001.html#PALETTE" title="Stores palette information.">PALETTE</a>, <a class="xref" href="alleg001.html#RGB" title="Single palette entry.">RGB</a>, <a class="xref" href="alleg001.html#RGB_MAP" title="Stores an rgb map to accelerate conversions.">RGB_MAP</a>, <a class="xref" href="alleg009.html#SCREEN_H" title="Global define to obtain the size of the screen.">SCREEN_H</a>, <a class="xref" href="alleg009.html#SCREEN_W" title="Global define to obtain the size of the screen.">SCREEN_W</a>, <a class="xref" href="alleg000.html#allegro_error" title="Stores the last Allegro error message.">allegro_error</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg014.html#blit" title="Copies a rectangular area from one bitmap to another.">blit</a>, <a class="xref" href="alleg013.html#clear_bitmap" title="Clears the bitmap to color 0.">clear_bitmap</a>, <a class="xref" href="alleg020.html#color_map" title="Global pointer to the color mapping table.">color_map</a>, <a class="xref" href="alleg009.html#create_bitmap" title="Creates a memory bitmap.">create_bitmap</a>, <a class="xref" href="alleg020.html#create_light_table" title="Fills a color mapping table for lighting effects.">create_light_table</a>, <a class="xref" href="alleg021.html#create_rgb_table" title="Generates an RGB mapping table with lookup data for a palette.">create_rgb_table</a>, <a class="xref" href="alleg009.html#destroy_bitmap" title="Destroys any type of created bitmap.">destroy_bitmap</a>, <a class="xref" href="alleg014.html#draw_gouraud_sprite" title="Draws a sprite with gouraud shading.">draw_gouraud_sprite</a>, <a class="xref" href="alleg018.html#font" title="A simple 8x8 fixed size font.">font</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg004.html#install_mouse" title="Installs the Allegro mouse handler.">install_mouse</a>, <a class="xref" href="alleg006.html#keypressed" title="Tells if there are keypresses waiting in the input buffer.">keypressed</a>, <a class="xref" href="alleg013.html#line" title="Draws a line onto the bitmap.">line</a>, <a class="xref" href="alleg010.html#load_bitmap" title="Loads any supported bitmap from a file.">load_bitmap</a>, <a class="xref" href="alleg004.html#mouse_x" title="Global variable with the mouse position/button state.">mouse_x</a>, <a class="xref" href="alleg004.html#mouse_y" title="Global variable with the mouse position/button state.">mouse_y</a>, <a class="xref" href="alleg012.html#palette_color" title="Maps palette indexes into the current pixel format colors.">palette_color</a>, <a class="xref" href="alleg004.html#poll_mouse" title="Polls the mouse.">poll_mouse</a>, <a class="xref" href="alleg030.html#replace_filename" title="Replaces path+filename with a new filename tail.">replace_filename</a>, <a class="xref" href="alleg021.html#rgb_map" title="Look up table to speed up reducing RGB values to palette colors.">rgb_map</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>, <a class="xref" href="alleg011.html#set_palette" title="Sets the entire palette of 256 colors.">set_palette</a>, <a class="xref" href="alleg020.html#set_trans_blender" title="Enables a truecolor blender.">set_trans_blender</a>, <a class="xref" href="alleg004.html#show_mouse" title="Tells Allegro to display a mouse pointer on the screen.">show_mouse</a>, <a class="xref" href="alleg018.html#textout_ex" title="Writes a string on a bitmap.">textout_ex</a>.</blockquote> <div class="al-api"><b>Example <a name="exblend">exblend</a></b></div><br> This program demonstrates how to use the translucency functions in truecolor video modes. Two image files are loaded from disk and displayed moving slowly around the screen. One of the images will be tinted to different colors. The other image will be faded out with a varying alpha strength, and drawn on top of the other image. <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg001.html#BITMAP" title="Stores the contents of a bitmap.">BITMAP</a>, <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg001.html#PALETTE" title="Stores palette information.">PALETTE</a>, <a class="xref" href="alleg009.html#SCREEN_H" title="Global define to obtain the size of the screen.">SCREEN_H</a>, <a class="xref" href="alleg009.html#SCREEN_W" title="Global define to obtain the size of the screen.">SCREEN_W</a>, <a class="xref" href="alleg000.html#allegro_error" title="Stores the last Allegro error message.">allegro_error</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg014.html#blit" title="Copies a rectangular area from one bitmap to another.">blit</a>, <a class="xref" href="alleg013.html#circle" title="Draws a circle.">circle</a>, <a class="xref" href="alleg013.html#clear_bitmap" title="Clears the bitmap to color 0.">clear_bitmap</a>, <a class="xref" href="alleg006.html#clear_keybuf" title="Clears the keyboard buffer.">clear_keybuf</a>, <a class="xref" href="alleg009.html#create_bitmap" title="Creates a memory bitmap.">create_bitmap</a>, <a class="xref" href="alleg009.html#destroy_bitmap" title="Destroys any type of created bitmap.">destroy_bitmap</a>, <a class="xref" href="alleg014.html#draw_lit_sprite" title="Draws a sprite tinted with a specific color.">draw_lit_sprite</a>, <a class="xref" href="alleg014.html#draw_trans_sprite" title="Draws a sprite blending it with the destination.">draw_trans_sprite</a>, <a class="xref" href="alleg032.html#fixcos" title="Fixed point cosine of binary angles.">fixcos</a>, <a class="xref" href="alleg032.html#fixsin" title="Fixed point sine of binary angles.">fixsin</a>, <a class="xref" href="alleg032.html#fixtoi" title="Converts a fixed point to integer with rounding.">fixtoi</a>, <a class="xref" href="alleg018.html#font" title="A simple 8x8 fixed size font.">font</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg005.html#install_timer" title="Installs the Allegro timer interrupt handler.">install_timer</a>, <a class="xref" href="alleg032.html#itofix" title="Converts an integer to fixed point.">itofix</a>, <a class="xref" href="alleg006.html#keypressed" title="Tells if there are keypresses waiting in the input buffer.">keypressed</a>, <a class="xref" href="alleg010.html#load_bitmap" title="Loads any supported bitmap from a file.">load_bitmap</a>, <a class="xref" href="alleg012.html#makecol" title="Converts an RGB value into the current pixel format.">makecol</a>, <a class="xref" href="alleg030.html#replace_filename" title="Replaces path+filename with a new filename tail.">replace_filename</a>, <a class="xref" href="alleg005.html#retrace_count" title="Retrace count simulator.">retrace_count</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg010.html#set_color_conversion" title="Tells Allegro how to convert images during loading time.">set_color_conversion</a>, <a class="xref" href="alleg008.html#set_color_depth" title="Sets the global pixel color depth.">set_color_depth</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>, <a class="xref" href="alleg020.html#set_trans_blender" title="Enables a truecolor blender.">set_trans_blender</a>, <a class="xref" href="alleg018.html#textprintf_ex" title="Formatted output of a string.">textprintf_ex</a>, <a class="xref" href="alleg008.html#vsync" title="Waits for a vertical retrace to begin.">vsync</a>.</blockquote> <div class="al-api"><b>Example <a name="exxfade">exxfade</a></b></div><br> This program demonstrates how to load and display bitmap files in truecolor video modes, and how to crossfade between them. You have to use this example from the command line to specify as parameters a number of graphic files. Use at least two files to see the graphical effect. The example will crossfade from one image to another with each key press until you press the ESC key. <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg001.html#BITMAP" title="Stores the contents of a bitmap.">BITMAP</a>, <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg001.html#PALETTE" title="Stores palette information.">PALETTE</a>, <a class="xref" href="alleg009.html#SCREEN_H" title="Global define to obtain the size of the screen.">SCREEN_H</a>, <a class="xref" href="alleg009.html#SCREEN_W" title="Global define to obtain the size of the screen.">SCREEN_W</a>, <a class="xref" href="alleg000.html#allegro_error" title="Stores the last Allegro error message.">allegro_error</a>, <a class="xref" href="alleg000.html#allegro_exit" title="Closes down the Allegro system.">allegro_exit</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg014.html#blit" title="Copies a rectangular area from one bitmap to another.">blit</a>, <a class="xref" href="alleg009.html#create_bitmap" title="Creates a memory bitmap.">create_bitmap</a>, <a class="xref" href="alleg009.html#destroy_bitmap" title="Destroys any type of created bitmap.">destroy_bitmap</a>, <a class="xref" href="alleg014.html#draw_trans_sprite" title="Draws a sprite blending it with the destination.">draw_trans_sprite</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg006.html#keypressed" title="Tells if there are keypresses waiting in the input buffer.">keypressed</a>, <a class="xref" href="alleg013.html#line" title="Draws a line onto the bitmap.">line</a>, <a class="xref" href="alleg010.html#load_bitmap" title="Loads any supported bitmap from a file.">load_bitmap</a>, <a class="xref" href="alleg006.html#readkey" title="Returns the next character from the keyboard buffer.">readkey</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg010.html#set_color_conversion" title="Tells Allegro how to convert images during loading time.">set_color_conversion</a>, <a class="xref" href="alleg008.html#set_color_depth" title="Sets the global pixel color depth.">set_color_depth</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>, <a class="xref" href="alleg011.html#set_palette" title="Sets the entire palette of 256 colors.">set_palette</a>, <a class="xref" href="alleg020.html#set_trans_blender" title="Enables a truecolor blender.">set_trans_blender</a>, <a class="xref" href="alleg008.html#vsync" title="Waits for a vertical retrace to begin.">vsync</a>.</blockquote> <div class="al-api"><b>Example <a name="exalpha">exalpha</a></b></div><br> This program demonstrates how to use the 32 bit RGBA translucency functions to store an alpha channel along with a bitmap graphic. Two images are loaded from disk. One will be used for the background and the other as a sprite. The example generates an alpha channel for the sprite image, composing the 32 bit RGBA bitmap during runtime, and draws it at the position of the mouse cursor. <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg001.html#BITMAP" title="Stores the contents of a bitmap.">BITMAP</a>, <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg009.html#SCREEN_H" title="Global define to obtain the size of the screen.">SCREEN_H</a>, <a class="xref" href="alleg009.html#SCREEN_W" title="Global define to obtain the size of the screen.">SCREEN_W</a>, <a class="xref" href="alleg000.html#allegro_error" title="Stores the last Allegro error message.">allegro_error</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg014.html#blit" title="Copies a rectangular area from one bitmap to another.">blit</a>, <a class="xref" href="alleg006.html#clear_keybuf" title="Clears the keyboard buffer.">clear_keybuf</a>, <a class="xref" href="alleg009.html#create_bitmap" title="Creates a memory bitmap.">create_bitmap</a>, <a class="xref" href="alleg009.html#destroy_bitmap" title="Destroys any type of created bitmap.">destroy_bitmap</a>, <a class="xref" href="alleg014.html#draw_trans_sprite" title="Draws a sprite blending it with the destination.">draw_trans_sprite</a>, <a class="xref" href="alleg020.html#drawing_mode" title="Sets the graphics drawing mode.">drawing_mode</a>, <a class="xref" href="alleg018.html#font" title="A simple 8x8 fixed size font.">font</a>, <a class="xref" href="alleg012.html#getb" title="Extract a color component from the current pixel format.">getb</a>, <a class="xref" href="alleg012.html#getg" title="Extract a color component from the current pixel format.">getg</a>, <a class="xref" href="alleg013.html#getpixel" title="Reads a pixel from a bitmap.">getpixel</a>, <a class="xref" href="alleg012.html#getr" title="Extract a color component from the current pixel format.">getr</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg004.html#install_mouse" title="Installs the Allegro mouse handler.">install_mouse</a>, <a class="xref" href="alleg005.html#install_timer" title="Installs the Allegro timer interrupt handler.">install_timer</a>, <a class="xref" href="alleg006.html#keypressed" title="Tells if there are keypresses waiting in the input buffer.">keypressed</a>, <a class="xref" href="alleg010.html#load_bitmap" title="Loads any supported bitmap from a file.">load_bitmap</a>, <a class="xref" href="alleg012.html#makecol" title="Converts an RGB value into the current pixel format.">makecol</a>, <a class="xref" href="alleg004.html#mouse_x" title="Global variable with the mouse position/button state.">mouse_x</a>, <a class="xref" href="alleg004.html#mouse_y" title="Global variable with the mouse position/button state.">mouse_y</a>, <a class="xref" href="alleg013.html#putpixel" title="Writes a pixel into a bitmap.">putpixel</a>, <a class="xref" href="alleg013.html#rectfill" title="Draws a solid filled rectangle.">rectfill</a>, <a class="xref" href="alleg030.html#replace_filename" title="Replaces path+filename with a new filename tail.">replace_filename</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg020.html#set_alpha_blender" title="Enables a special alpha-channel blending mode.">set_alpha_blender</a>, <a class="xref" href="alleg010.html#set_color_conversion" title="Tells Allegro how to convert images during loading time.">set_color_conversion</a>, <a class="xref" href="alleg008.html#set_color_depth" title="Sets the global pixel color depth.">set_color_depth</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>, <a class="xref" href="alleg020.html#set_multiply_blender" title="Enables a multiply blender mode.">set_multiply_blender</a>, <a class="xref" href="alleg020.html#set_write_alpha_blender" title="Enables the special alpha-channel editing mode.">set_write_alpha_blender</a>, <a class="xref" href="alleg020.html#solid_mode" title="Shortcut for selecting solid drawing mode.">solid_mode</a>, <a class="xref" href="alleg014.html#stretch_blit" title="Scales a rectangular area from one bitmap to another.">stretch_blit</a>, <a class="xref" href="alleg018.html#textprintf_ex" title="Formatted output of a string.">textprintf_ex</a>.</blockquote> <div class="al-api"><b>Example <a name="exlights">exlights</a></b></div><br> This program shows one way to implement colored lighting effects in a hicolor video mode. Warning: it is not for the faint of heart! This is by no means the simplest or easiest to understand method, I just thought it was a cool concept that would be worth demonstrating. <p> The basic approach is to select a 15 or 16 bit screen mode, but then draw onto 24 bit memory bitmaps. Since we only need the bottom 5 bits of each 8 bit color in order to store 15 bit data within a 24 bit location, we can fit a light level into the top 3 bits. The tricky bit is that these aren't actually 24 bit images at all: they are implemented as 8 bit memory bitmaps, and we just store the red level in one pixel, green in the next, and blue in the next, making the total image be three times wider than we really wanted. This allows us to use all the normal 256 color graphics routines for drawing onto our memory surfaces, most importantly the lookup table translucency, which can be used to combine the low 5 bits of color and the top 3 bits of light in a single drawing operation. Some trickery is needed to load 24 bit data into this fake 8 bit format, and of course it needs a custom routine to convert the resulting image while copying it across to the hardware screen. <p> This program chugs slightly on my p133, but not significantly worse than any double buffering in what amounts to a 1920x640, 256 color resolution. The light blending doesn't seem to slow it down too badly, so I think this technique would be quite usable on faster machines and in lower resolution hicolor modes. The biggest problem is that although you keep the full 15 bit color resolution, you only get 3 bits of light, ie. 8 light levels. You can do some nice colored light patches, but smooth gradients aren't going to work too well :-) <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg001.html#BITMAP" title="Stores the contents of a bitmap.">BITMAP</a>, <a class="xref" href="alleg001.html#COLOR_MAP" title="Stores a color map to accelerate drawing.">COLOR_MAP</a>, <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg001.html#PALETTE" title="Stores palette information.">PALETTE</a>, <a class="xref" href="alleg009.html#SCREEN_H" title="Global define to obtain the size of the screen.">SCREEN_H</a>, <a class="xref" href="alleg009.html#SCREEN_W" title="Global define to obtain the size of the screen.">SCREEN_W</a>, <a class="xref" href="alleg000.html#allegro_error" title="Stores the last Allegro error message.">allegro_error</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg009.html#bitmap_color_depth" title="Returns the color depth of the specified bitmap.">bitmap_color_depth</a>, <a class="xref" href="alleg014.html#blit" title="Copies a rectangular area from one bitmap to another.">blit</a>, <a class="xref" href="alleg022.html#bmp_unwrite_line" title="Direct access bank switching line release.">bmp_unwrite_line</a>, <a class="xref" href="alleg022.html#bmp_write_line" title="Direct access bank switching line selection for writing.">bmp_write_line</a>, <a class="xref" href="alleg013.html#circlefill" title="Draws a filled circle.">circlefill</a>, <a class="xref" href="alleg013.html#clear_bitmap" title="Clears the bitmap to color 0.">clear_bitmap</a>, <a class="xref" href="alleg006.html#clear_keybuf" title="Clears the keyboard buffer.">clear_keybuf</a>, <a class="xref" href="alleg020.html#color_map" title="Global pointer to the color mapping table.">color_map</a>, <a class="xref" href="alleg009.html#create_bitmap_ex" title="Creates a memory bitmap specifying color depth.">create_bitmap_ex</a>, <a class="xref" href="alleg009.html#destroy_bitmap" title="Destroys any type of created bitmap.">destroy_bitmap</a>, <a class="xref" href="alleg014.html#draw_trans_sprite" title="Draws a sprite blending it with the destination.">draw_trans_sprite</a>, <a class="xref" href="alleg032.html#fixatan2" title="Fixed point version of the libc atan2() routine.">fixatan2</a>, <a class="xref" href="alleg032.html#fixsqrt" title="Fixed point square root.">fixsqrt</a>, <a class="xref" href="alleg032.html#fixtoi" title="Converts a fixed point to integer with rounding.">fixtoi</a>, <a class="xref" href="alleg012.html#getb_depth" title="Extract a color component from a color in a specified pixel format.">getb_depth</a>, <a class="xref" href="alleg012.html#getg_depth" title="Extract a color component from a color in a specified pixel format.">getg_depth</a>, <a class="xref" href="alleg013.html#getpixel" title="Reads a pixel from a bitmap.">getpixel</a>, <a class="xref" href="alleg012.html#getr_depth" title="Extract a color component from a color in a specified pixel format.">getr_depth</a>, <a class="xref" href="alleg021.html#hsv_to_rgb" title="Converts color values between the HSV and RGB color spaces.">hsv_to_rgb</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg004.html#install_mouse" title="Installs the Allegro mouse handler.">install_mouse</a>, <a class="xref" href="alleg005.html#install_timer" title="Installs the Allegro timer interrupt handler.">install_timer</a>, <a class="xref" href="alleg032.html#itofix" title="Converts an integer to fixed point.">itofix</a>, <a class="xref" href="alleg006.html#key" title="Array of flags indicating key state.">key</a>, <a class="xref" href="alleg006.html#keypressed" title="Tells if there are keypresses waiting in the input buffer.">keypressed</a>, <a class="xref" href="alleg013.html#line" title="Draws a line onto the bitmap.">line</a>, <a class="xref" href="alleg010.html#load_bitmap" title="Loads any supported bitmap from a file.">load_bitmap</a>, <a class="xref" href="alleg012.html#makecol" title="Converts an RGB value into the current pixel format.">makecol</a>, <a class="xref" href="alleg004.html#mouse_x" title="Global variable with the mouse position/button state.">mouse_x</a>, <a class="xref" href="alleg004.html#mouse_y" title="Global variable with the mouse position/button state.">mouse_y</a>, <a class="xref" href="alleg004.html#poll_mouse" title="Polls the mouse.">poll_mouse</a>, <a class="xref" href="alleg030.html#replace_filename" title="Replaces path+filename with a new filename tail.">replace_filename</a>, <a class="xref" href="alleg005.html#retrace_count" title="Retrace count simulator.">retrace_count</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg011.html#select_palette" title="Sets the internal palette for color conversion.">select_palette</a>, <a class="xref" href="alleg010.html#set_color_conversion" title="Tells Allegro how to convert images during loading time.">set_color_conversion</a>, <a class="xref" href="alleg008.html#set_color_depth" title="Sets the global pixel color depth.">set_color_depth</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>.</blockquote> <div class="al-api"><b>Example <a name="ex3d">ex3d</a></b></div><br> This program demonstrates how to use the 3d matrix functions. It isn't a very elegant or efficient piece of code, but it does show the stuff in action. It is left to the reader as an exercise to design a proper model structure and rendering pipeline: after all, the best way to do that sort of stuff varies hugely from one game to another. <p> The example first shows a screen resolution selection dialog. Then, a number of bouncing 3d cubes are animated. Pressing a key modifies the rendering of the cubes, which can be wireframe, the more complex transparent perspective correct texture mapped version, and many other. <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg001.html#BITMAP" title="Stores the contents of a bitmap.">BITMAP</a>, <a class="xref" href="alleg001.html#COLOR_MAP" title="Stores a color map to accelerate drawing.">COLOR_MAP</a>, <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg001.html#MATRIX" title="Fixed point matrix structure.">MATRIX</a>, <a class="xref" href="alleg001.html#PALETTE" title="Stores palette information.">PALETTE</a>, <a class="xref" href="alleg019.html#POLYTYPE_ATEX" title="Polygon rendering mode type">POLYTYPE_ATEX</a>, <a class="xref" href="alleg019.html#POLYTYPE_ATEX_LIT" title="Polygon rendering mode type">POLYTYPE_ATEX_LIT</a>, <a class="xref" href="alleg019.html#POLYTYPE_ATEX_MASK" title="Polygon rendering mode type">POLYTYPE_ATEX_MASK</a>, <a class="xref" href="alleg019.html#POLYTYPE_ATEX_MASK_LIT" title="Polygon rendering mode type">POLYTYPE_ATEX_MASK_LIT</a>, <a class="xref" href="alleg019.html#POLYTYPE_ATEX_MASK_TRANS" title="Polygon rendering mode type">POLYTYPE_ATEX_MASK_TRANS</a>, <a class="xref" href="alleg019.html#POLYTYPE_ATEX_TRANS" title="Polygon rendering mode type">POLYTYPE_ATEX_TRANS</a>, <a class="xref" href="alleg019.html#POLYTYPE_FLAT" title="Polygon rendering mode type">POLYTYPE_FLAT</a>, <a class="xref" href="alleg019.html#POLYTYPE_GCOL" title="Polygon rendering mode type">POLYTYPE_GCOL</a>, <a class="xref" href="alleg019.html#POLYTYPE_GRGB" title="Polygon rendering mode type">POLYTYPE_GRGB</a>, <a class="xref" href="alleg019.html#POLYTYPE_PTEX" title="Polygon rendering mode type">POLYTYPE_PTEX</a>, <a class="xref" href="alleg019.html#POLYTYPE_PTEX_LIT" title="Polygon rendering mode type">POLYTYPE_PTEX_LIT</a>, <a class="xref" href="alleg019.html#POLYTYPE_PTEX_MASK" title="Polygon rendering mode type">POLYTYPE_PTEX_MASK</a>, <a class="xref" href="alleg019.html#POLYTYPE_PTEX_MASK_LIT" title="Polygon rendering mode type">POLYTYPE_PTEX_MASK_LIT</a>, <a class="xref" href="alleg019.html#POLYTYPE_PTEX_MASK_TRANS" title="Polygon rendering mode type">POLYTYPE_PTEX_MASK_TRANS</a>, <a class="xref" href="alleg019.html#POLYTYPE_PTEX_TRANS" title="Polygon rendering mode type">POLYTYPE_PTEX_TRANS</a>, <a class="xref" href="alleg001.html#RGB" title="Single palette entry.">RGB</a>, <a class="xref" href="alleg001.html#RGB_MAP" title="Stores an rgb map to accelerate conversions.">RGB_MAP</a>, <a class="xref" href="alleg009.html#SCREEN_H" title="Global define to obtain the size of the screen.">SCREEN_H</a>, <a class="xref" href="alleg009.html#SCREEN_W" title="Global define to obtain the size of the screen.">SCREEN_W</a>, <a class="xref" href="alleg001.html#V3D" title="Fixed point vertex structure used by 3d functions.">V3D</a>, <a class="xref" href="alleg000.html#allegro_error" title="Stores the last Allegro error message.">allegro_error</a>, <a class="xref" href="alleg000.html#allegro_exit" title="Closes down the Allegro system.">allegro_exit</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg033.html#apply_matrix" title="Multiplies a point by a transformation matrix.">apply_matrix</a>, <a class="xref" href="alleg009.html#bitmap_color_depth" title="Returns the color depth of the specified bitmap.">bitmap_color_depth</a>, <a class="xref" href="alleg009.html#bitmap_mask_color" title="Returns the mask color of the specified bitmap.">bitmap_mask_color</a>, <a class="xref" href="alleg014.html#blit" title="Copies a rectangular area from one bitmap to another.">blit</a>, <a class="xref" href="alleg013.html#clear_bitmap" title="Clears the bitmap to color 0.">clear_bitmap</a>, <a class="xref" href="alleg013.html#clear_to_color" title="Clears the bitmap to the specified color.">clear_to_color</a>, <a class="xref" href="alleg020.html#color_map" title="Global pointer to the color mapping table.">color_map</a>, <a class="xref" href="alleg009.html#create_bitmap" title="Creates a memory bitmap.">create_bitmap</a>, <a class="xref" href="alleg020.html#create_light_table" title="Fills a color mapping table for lighting effects.">create_light_table</a>, <a class="xref" href="alleg021.html#create_rgb_table" title="Generates an RGB mapping table with lookup data for a palette.">create_rgb_table</a>, <a class="xref" href="alleg020.html#create_trans_table" title="Fills a color mapping table for translucency effects.">create_trans_table</a>, <a class="xref" href="alleg011.html#desktop_palette" title="The palette used by the Atari ST low resolution desktop.">desktop_palette</a>, <a class="xref" href="alleg009.html#destroy_bitmap" title="Destroys any type of created bitmap.">destroy_bitmap</a>, <a class="xref" href="alleg001.html#fixed" title="Fixed point integer to replace floats.">fixed</a>, <a class="xref" href="alleg032.html#fixtoi" title="Converts a fixed point to integer with rounding.">fixtoi</a>, <a class="xref" href="alleg018.html#font" title="A simple 8x8 fixed size font.">font</a>, <a class="xref" href="alleg033.html#get_transformation_matrix" title="Constructs X, Y, Z rotation matrices with an angle and scaling.">get_transformation_matrix</a>, <a class="xref" href="alleg035.html#gfx_mode_select_ex" title="Extended version of the graphics mode selection dialog.">gfx_mode_select_ex</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg004.html#install_mouse" title="Installs the Allegro mouse handler.">install_mouse</a>, <a class="xref" href="alleg005.html#install_timer" title="Installs the Allegro timer interrupt handler.">install_timer</a>, <a class="xref" href="alleg032.html#itofix" title="Converts an integer to fixed point.">itofix</a>, <a class="xref" href="alleg006.html#key" title="Array of flags indicating key state.">key</a>, <a class="xref" href="alleg006.html#keypressed" title="Tells if there are keypresses waiting in the input buffer.">keypressed</a>, <a class="xref" href="alleg013.html#line" title="Draws a line onto the bitmap.">line</a>, <a class="xref" href="alleg012.html#palette_color" title="Maps palette indexes into the current pixel format colors.">palette_color</a>, <a class="xref" href="alleg033.html#persp_project" title="Projects a 3d point into 2d screen space.">persp_project</a>, <a class="xref" href="alleg033.html#polygon_z_normal" title="Finds the Z component of the normal vector to three vertices.">polygon_z_normal</a>, <a class="xref" href="alleg019.html#quad3d" title="Draws a 3d quad onto the specified bitmap.">quad3d</a>, <a class="xref" href="alleg006.html#readkey" title="Returns the next character from the keyboard buffer.">readkey</a>, <a class="xref" href="alleg013.html#rect" title="Draws an outline rectangle.">rect</a>, <a class="xref" href="alleg005.html#retrace_count" title="Retrace count simulator.">retrace_count</a>, <a class="xref" href="alleg021.html#rgb_map" title="Look up table to speed up reducing RGB values to palette colors.">rgb_map</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg008.html#set_color_depth" title="Sets the global pixel color depth.">set_color_depth</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>, <a class="xref" href="alleg011.html#set_palette" title="Sets the entire palette of 256 colors.">set_palette</a>, <a class="xref" href="alleg033.html#set_projection_viewport" title="Sets the viewport used to scale the output of persp_project().">set_projection_viewport</a>, <a class="xref" href="alleg020.html#set_trans_blender" title="Enables a truecolor blender.">set_trans_blender</a>, <a class="xref" href="alleg018.html#textout_ex" title="Writes a string on a bitmap.">textout_ex</a>, <a class="xref" href="alleg018.html#textprintf_ex" title="Formatted output of a string.">textprintf_ex</a>, <a class="xref" href="alleg008.html#vsync" title="Waits for a vertical retrace to begin.">vsync</a>.</blockquote> <div class="al-api"><b>Example <a name="excamera">excamera</a></b></div><br> This program demonstrates how to use the get_camera_matrix() function to view a 3d world from any position and angle. The example draws a checkered floor through a viewport region on the screen. You can use the keyboard to move around the camera or modify the size of the viewport. The keys that can be used with this example are displayed between brackets at the top of the screen. <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg001.html#BITMAP" title="Stores the contents of a bitmap.">BITMAP</a>, <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg001.html#MATRIX_f" title="Floating point matrix structure.">MATRIX_f</a>, <a class="xref" href="alleg019.html#POLYTYPE_FLAT" title="Polygon rendering mode type">POLYTYPE_FLAT</a>, <a class="xref" href="alleg009.html#SCREEN_H" title="Global define to obtain the size of the screen.">SCREEN_H</a>, <a class="xref" href="alleg009.html#SCREEN_W" title="Global define to obtain the size of the screen.">SCREEN_W</a>, <a class="xref" href="alleg001.html#V3D_f" title="Floating point vertex structure used by 3d functions.">V3D_f</a>, <a class="xref" href="alleg000.html#allegro_error" title="Stores the last Allegro error message.">allegro_error</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg033.html#apply_matrix_f" title="Multiplies a point by a transformation matrix.">apply_matrix_f</a>, <a class="xref" href="alleg014.html#blit" title="Copies a rectangular area from one bitmap to another.">blit</a>, <a class="xref" href="alleg013.html#clear_to_color" title="Clears the bitmap to the specified color.">clear_to_color</a>, <a class="xref" href="alleg019.html#clip3d_f" title="Clips the polygon given in vtx using floating point math,">clip3d_f</a>, <a class="xref" href="alleg009.html#create_bitmap" title="Creates a memory bitmap.">create_bitmap</a>, <a class="xref" href="alleg011.html#desktop_palette" title="The palette used by the Atari ST low resolution desktop.">desktop_palette</a>, <a class="xref" href="alleg009.html#destroy_bitmap" title="Destroys any type of created bitmap.">destroy_bitmap</a>, <a class="xref" href="alleg018.html#font" title="A simple 8x8 fixed size font.">font</a>, <a class="xref" href="alleg033.html#get_camera_matrix_f" title="Floating point version of get_camera_matrix().">get_camera_matrix_f</a>, <a class="xref" href="alleg033.html#get_vector_rotation_matrix_f" title="Constructs X, Y, Z rotation matrices with an angle.">get_vector_rotation_matrix_f</a>, <a class="xref" href="alleg005.html#install_int_ex" title="Adds or modifies a timer.">install_int_ex</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg005.html#install_timer" title="Installs the Allegro timer interrupt handler.">install_timer</a>, <a class="xref" href="alleg006.html#key" title="Array of flags indicating key state.">key</a>, <a class="xref" href="alleg006.html#key_shifts" title="Bitmask containing the current state of modifier keys.">key_shifts</a>, <a class="xref" href="alleg012.html#makecol" title="Converts an RGB value into the current pixel format.">makecol</a>, <a class="xref" href="alleg033.html#persp_project_f" title="Projects a 3d point into 2d screen space.">persp_project_f</a>, <a class="xref" href="alleg006.html#poll_keyboard" title="Polls the keyboard.">poll_keyboard</a>, <a class="xref" href="alleg013.html#polygon" title="Draws a filled polygon.">polygon</a>, <a class="xref" href="alleg019.html#polygon3d_f" title="Draws a 3d polygon onto the specified bitmap.">polygon3d_f</a>, <a class="xref" href="alleg013.html#rect" title="Draws an outline rectangle.">rect</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg009.html#set_clip_rect" title="Sets the clipping rectangle of a bitmap.">set_clip_rect</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>, <a class="xref" href="alleg011.html#set_palette" title="Sets the entire palette of 256 colors.">set_palette</a>, <a class="xref" href="alleg033.html#set_projection_viewport" title="Sets the viewport used to scale the output of persp_project().">set_projection_viewport</a>, <a class="xref" href="alleg018.html#textprintf_ex" title="Formatted output of a string.">textprintf_ex</a>, <a class="xref" href="alleg008.html#vsync" title="Waits for a vertical retrace to begin.">vsync</a>.</blockquote> <div class="al-api"><b>Example <a name="exquat">exquat</a></b></div><br> Euler angles are convenient for storing and creating 3D orientations. However, this program demonstrates that they are not good when interpolating between two different orientations. The problem is solved by using Allegro's quaternion operations. <p> In this program, two cubes are rotated between random orientations. Notice that although they have the same beginning and ending orientations, they do not follow the same path between orientations. <p> One cube is being rotated by directly incrementing or decrementing the Euler angles from the starting point to the ending point. This is an intuitive notion, but it is incorrect because it does not cause the object to turn around a single unchanging axis of rotation. The axis of rotation wobbles resulting in the object spinning in strange ways. The object will eventually end up in the orientation that the user intended, but it gets there in a way that is unattractive. Imagine if this method was used to update the position of a camera in a game! Sometimes it would swing wildly and disorient the player. <p> The other cube is animated using quaternions. This results in a much more pleasing animation because the cube turns around a single axis of rotation. <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg001.html#BITMAP" title="Stores the contents of a bitmap.">BITMAP</a>, <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg001.html#MATRIX_f" title="Floating point matrix structure.">MATRIX_f</a>, <a class="xref" href="alleg001.html#QUAT" title="Stores quaternion information.">QUAT</a>, <a class="xref" href="alleg009.html#acquire_bitmap" title="Locks the bitmap before drawing onto it.">acquire_bitmap</a>, <a class="xref" href="alleg000.html#allegro_error" title="Stores the last Allegro error message.">allegro_error</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg033.html#apply_matrix_f" title="Multiplies a point by a transformation matrix.">apply_matrix_f</a>, <a class="xref" href="alleg014.html#blit" title="Copies a rectangular area from one bitmap to another.">blit</a>, <a class="xref" href="alleg013.html#circle" title="Draws a circle.">circle</a>, <a class="xref" href="alleg006.html#clear_keybuf" title="Clears the keyboard buffer.">clear_keybuf</a>, <a class="xref" href="alleg013.html#clear_to_color" title="Clears the bitmap to the specified color.">clear_to_color</a>, <a class="xref" href="alleg009.html#create_bitmap" title="Creates a memory bitmap.">create_bitmap</a>, <a class="xref" href="alleg011.html#desktop_palette" title="The palette used by the Atari ST low resolution desktop.">desktop_palette</a>, <a class="xref" href="alleg009.html#destroy_bitmap" title="Destroys any type of created bitmap.">destroy_bitmap</a>, <a class="xref" href="alleg018.html#font" title="A simple 8x8 fixed size font.">font</a>, <a class="xref" href="alleg033.html#get_camera_matrix_f" title="Floating point version of get_camera_matrix().">get_camera_matrix_f</a>, <a class="xref" href="alleg033.html#get_rotation_matrix" title="Constructs X, Y, Z rotation matrices.">get_rotation_matrix</a>, <a class="xref" href="alleg033.html#get_rotation_matrix_f" title="Constructs X, Y, Z rotation matrices.">get_rotation_matrix_f</a>, <a class="xref" href="alleg034.html#get_rotation_quat" title="Constructs a quaternion to rotate points around all three axes.">get_rotation_quat</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg006.html#keypressed" title="Tells if there are keypresses waiting in the input buffer.">keypressed</a>, <a class="xref" href="alleg013.html#line" title="Draws a line onto the bitmap.">line</a>, <a class="xref" href="alleg033.html#matrix_mul_f" title="Multiplies two matrices.">matrix_mul_f</a>, <a class="xref" href="alleg012.html#palette_color" title="Maps palette indexes into the current pixel format colors.">palette_color</a>, <a class="xref" href="alleg033.html#persp_project_f" title="Projects a 3d point into 2d screen space.">persp_project_f</a>, <a class="xref" href="alleg034.html#quat_interpolate" title="Constructs a quaternion representing a rotation between from and to.">quat_interpolate</a>, <a class="xref" href="alleg034.html#quat_to_matrix" title="Constructs a rotation matrix from a quaternion.">quat_to_matrix</a>, <a class="xref" href="alleg006.html#readkey" title="Returns the next character from the keyboard buffer.">readkey</a>, <a class="xref" href="alleg009.html#release_bitmap" title="Releases a previously locked bitmap.">release_bitmap</a>, <a class="xref" href="alleg005.html#rest" title="Waits a specified number of milliseconds or yields CPU.">rest</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>, <a class="xref" href="alleg011.html#set_palette" title="Sets the entire palette of 256 colors.">set_palette</a>, <a class="xref" href="alleg033.html#set_projection_viewport" title="Sets the viewport used to scale the output of persp_project().">set_projection_viewport</a>, <a class="xref" href="alleg018.html#textout_ex" title="Writes a string on a bitmap.">textout_ex</a>.</blockquote> <div class="al-api"><b>Example <a name="exstars">exstars</a></b></div><br> This program draws a 3D star field (depth-cued) and a polygon starship (controllable with the keyboard cursor keys), using the Allegro math functions. <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg001.html#BITMAP" title="Stores the contents of a bitmap.">BITMAP</a>, <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg001.html#MATRIX" title="Fixed point matrix structure.">MATRIX</a>, <a class="xref" href="alleg001.html#PALETTE" title="Stores palette information.">PALETTE</a>, <a class="xref" href="alleg009.html#SCREEN_H" title="Global define to obtain the size of the screen.">SCREEN_H</a>, <a class="xref" href="alleg009.html#SCREEN_W" title="Global define to obtain the size of the screen.">SCREEN_W</a>, <a class="xref" href="alleg000.html#allegro_error" title="Stores the last Allegro error message.">allegro_error</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg033.html#apply_matrix" title="Multiplies a point by a transformation matrix.">apply_matrix</a>, <a class="xref" href="alleg014.html#blit" title="Copies a rectangular area from one bitmap to another.">blit</a>, <a class="xref" href="alleg013.html#clear_bitmap" title="Clears the bitmap to color 0.">clear_bitmap</a>, <a class="xref" href="alleg009.html#create_bitmap" title="Creates a memory bitmap.">create_bitmap</a>, <a class="xref" href="alleg033.html#cross_product" title="Calculates the cross product.">cross_product</a>, <a class="xref" href="alleg009.html#destroy_bitmap" title="Destroys any type of created bitmap.">destroy_bitmap</a>, <a class="xref" href="alleg033.html#dot_product" title="Calculates the dot product.">dot_product</a>, <a class="xref" href="alleg001.html#fixed" title="Fixed point integer to replace floats.">fixed</a>, <a class="xref" href="alleg032.html#fixmul" title="Multiplies two fixed point values together.">fixmul</a>, <a class="xref" href="alleg032.html#fixtof" title="Converts a fixed point to floating point.">fixtof</a>, <a class="xref" href="alleg032.html#fixtoi" title="Converts a fixed point to integer with rounding.">fixtoi</a>, <a class="xref" href="alleg018.html#font" title="A simple 8x8 fixed size font.">font</a>, <a class="xref" href="alleg033.html#get_rotation_matrix" title="Constructs X, Y, Z rotation matrices.">get_rotation_matrix</a>, <a class="xref" href="alleg033.html#get_transformation_matrix" title="Constructs X, Y, Z rotation matrices with an angle and scaling.">get_transformation_matrix</a>, <a class="xref" href="alleg033.html#get_translation_matrix" title="Constructs a translation matrix.">get_translation_matrix</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg005.html#install_timer" title="Installs the Allegro timer interrupt handler.">install_timer</a>, <a class="xref" href="alleg032.html#itofix" title="Converts an integer to fixed point.">itofix</a>, <a class="xref" href="alleg006.html#key" title="Array of flags indicating key state.">key</a>, <a class="xref" href="alleg033.html#normalize_vector" title="Converts the vector to a unit vector.">normalize_vector</a>, <a class="xref" href="alleg012.html#palette_color" title="Maps palette indexes into the current pixel format colors.">palette_color</a>, <a class="xref" href="alleg033.html#persp_project" title="Projects a 3d point into 2d screen space.">persp_project</a>, <a class="xref" href="alleg006.html#poll_keyboard" title="Polls the keyboard.">poll_keyboard</a>, <a class="xref" href="alleg013.html#putpixel" title="Writes a pixel into a bitmap.">putpixel</a>, <a class="xref" href="alleg013.html#rectfill" title="Draws a solid filled rectangle.">rectfill</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>, <a class="xref" href="alleg011.html#set_palette" title="Sets the entire palette of 256 colors.">set_palette</a>, <a class="xref" href="alleg033.html#set_projection_viewport" title="Sets the viewport used to scale the output of persp_project().">set_projection_viewport</a>, <a class="xref" href="alleg018.html#textout_centre_ex" title="Writes a centered string on a bitmap.">textout_centre_ex</a>, <a class="xref" href="alleg018.html#textprintf_centre_ex" title="Formatted centered output of a string.">textprintf_centre_ex</a>, <a class="xref" href="alleg013.html#triangle" title="Draws a filled triangle.">triangle</a>, <a class="xref" href="alleg008.html#vsync" title="Waits for a vertical retrace to begin.">vsync</a>.</blockquote> <div class="al-api"><b>Example <a name="exscn3d">exscn3d</a></b></div><br> This program demonstrates how to use scanline sorting algorithm in Allegro (create_scene, clear_scene, ... functions). It also provides an example of how to use the 3D clipping function. The example consists of a flyby through a lot of rotating 3d cubes. <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg001.html#BITMAP" title="Stores the contents of a bitmap.">BITMAP</a>, <a class="xref" href="alleg005.html#END_OF_FUNCTION" title="Locks the code used by a timer.">END_OF_FUNCTION</a>, <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg005.html#LOCK_FUNCTION" title="Locks the memory of a function used by a timer.">LOCK_FUNCTION</a>, <a class="xref" href="alleg005.html#LOCK_VARIABLE" title="Locks the memory of a variable used by a timer.">LOCK_VARIABLE</a>, <a class="xref" href="alleg001.html#MATRIX_f" title="Floating point matrix structure.">MATRIX_f</a>, <a class="xref" href="alleg001.html#PALETTE" title="Stores palette information.">PALETTE</a>, <a class="xref" href="alleg019.html#POLYTYPE_GCOL" title="Polygon rendering mode type">POLYTYPE_GCOL</a>, <a class="xref" href="alleg009.html#SCREEN_H" title="Global define to obtain the size of the screen.">SCREEN_H</a>, <a class="xref" href="alleg009.html#SCREEN_W" title="Global define to obtain the size of the screen.">SCREEN_W</a>, <a class="xref" href="alleg001.html#V3D_f" title="Floating point vertex structure used by 3d functions.">V3D_f</a>, <a class="xref" href="alleg000.html#allegro_error" title="Stores the last Allegro error message.">allegro_error</a>, <a class="xref" href="alleg000.html#allegro_exit" title="Closes down the Allegro system.">allegro_exit</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg033.html#apply_matrix_f" title="Multiplies a point by a transformation matrix.">apply_matrix_f</a>, <a class="xref" href="alleg009.html#bitmap_color_depth" title="Returns the color depth of the specified bitmap.">bitmap_color_depth</a>, <a class="xref" href="alleg014.html#blit" title="Copies a rectangular area from one bitmap to another.">blit</a>, <a class="xref" href="alleg013.html#clear_bitmap" title="Clears the bitmap to color 0.">clear_bitmap</a>, <a class="xref" href="alleg019.html#clear_scene" title="Initializes a scene.">clear_scene</a>, <a class="xref" href="alleg019.html#clip3d_f" title="Clips the polygon given in vtx using floating point math,">clip3d_f</a>, <a class="xref" href="alleg009.html#create_bitmap" title="Creates a memory bitmap.">create_bitmap</a>, <a class="xref" href="alleg019.html#create_scene" title="Allocates memory for a 3d scene.">create_scene</a>, <a class="xref" href="alleg011.html#desktop_palette" title="The palette used by the Atari ST low resolution desktop.">desktop_palette</a>, <a class="xref" href="alleg009.html#destroy_bitmap" title="Destroys any type of created bitmap.">destroy_bitmap</a>, <a class="xref" href="alleg019.html#destroy_scene" title="Deallocates the memory used by a scene.">destroy_scene</a>, <a class="xref" href="alleg018.html#font" title="A simple 8x8 fixed size font.">font</a>, <a class="xref" href="alleg033.html#get_rotation_matrix_f" title="Constructs X, Y, Z rotation matrices.">get_rotation_matrix_f</a>, <a class="xref" href="alleg033.html#get_translation_matrix_f" title="Constructs a translation matrix.">get_translation_matrix_f</a>, <a class="xref" href="alleg035.html#gfx_mode_select_ex" title="Extended version of the graphics mode selection dialog.">gfx_mode_select_ex</a>, <a class="xref" href="alleg005.html#install_int" title="Installs a user timer handler.">install_int</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg004.html#install_mouse" title="Installs the Allegro mouse handler.">install_mouse</a>, <a class="xref" href="alleg005.html#install_timer" title="Installs the Allegro timer interrupt handler.">install_timer</a>, <a class="xref" href="alleg006.html#key" title="Array of flags indicating key state.">key</a>, <a class="xref" href="alleg033.html#matrix_mul_f" title="Multiplies two matrices.">matrix_mul_f</a>, <a class="xref" href="alleg012.html#palette_color" title="Maps palette indexes into the current pixel format colors.">palette_color</a>, <a class="xref" href="alleg033.html#persp_project_f" title="Projects a 3d point into 2d screen space.">persp_project_f</a>, <a class="xref" href="alleg033.html#polygon_z_normal_f" title="Finds the Z component of the normal vector to three vertices.">polygon_z_normal_f</a>, <a class="xref" href="alleg019.html#render_scene" title="Renders all the queued scene polygons.">render_scene</a>, <a class="xref" href="alleg019.html#scene_polygon3d_f" title="Puts a polygon in the scene rendering list.">scene_polygon3d_f</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg008.html#set_color_depth" title="Sets the global pixel color depth.">set_color_depth</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>, <a class="xref" href="alleg011.html#set_palette" title="Sets the entire palette of 256 colors.">set_palette</a>, <a class="xref" href="alleg033.html#set_projection_viewport" title="Sets the viewport used to scale the output of persp_project().">set_projection_viewport</a>, <a class="xref" href="alleg018.html#textprintf_ex" title="Formatted output of a string.">textprintf_ex</a>.</blockquote> <div class="al-api"><b>Example <a name="exzbuf">exzbuf</a></b></div><br> This program demonstrates how to use Z-buffered polygons and floating point 3D math routines. It also provides a simple way to compute fps (frames per second) using a timer. After selecting a screen resolution through the standard GUI dialog, the example shows two 3D cubes rotating and intersecting each other. Rather than having full polygons incorrectly overlap other polygons due to per-polygon sorting, each pixel is drawn at the correct depth. <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg001.html#BITMAP" title="Stores the contents of a bitmap.">BITMAP</a>, <a class="xref" href="alleg005.html#END_OF_FUNCTION" title="Locks the code used by a timer.">END_OF_FUNCTION</a>, <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg005.html#LOCK_FUNCTION" title="Locks the memory of a function used by a timer.">LOCK_FUNCTION</a>, <a class="xref" href="alleg005.html#LOCK_VARIABLE" title="Locks the memory of a variable used by a timer.">LOCK_VARIABLE</a>, <a class="xref" href="alleg001.html#MATRIX_f" title="Floating point matrix structure.">MATRIX_f</a>, <a class="xref" href="alleg001.html#PALETTE" title="Stores palette information.">PALETTE</a>, <a class="xref" href="alleg019.html#POLYTYPE_GCOL" title="Polygon rendering mode type">POLYTYPE_GCOL</a>, <a class="xref" href="alleg009.html#SCREEN_H" title="Global define to obtain the size of the screen.">SCREEN_H</a>, <a class="xref" href="alleg009.html#SCREEN_W" title="Global define to obtain the size of the screen.">SCREEN_W</a>, <a class="xref" href="alleg001.html#V3D_f" title="Floating point vertex structure used by 3d functions.">V3D_f</a>, <a class="xref" href="alleg001.html#ZBUFFER" title="Stores 3d zbuffer information.">ZBUFFER</a>, <a class="xref" href="alleg000.html#allegro_error" title="Stores the last Allegro error message.">allegro_error</a>, <a class="xref" href="alleg000.html#allegro_exit" title="Closes down the Allegro system.">allegro_exit</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg033.html#apply_matrix_f" title="Multiplies a point by a transformation matrix.">apply_matrix_f</a>, <a class="xref" href="alleg009.html#bitmap_color_depth" title="Returns the color depth of the specified bitmap.">bitmap_color_depth</a>, <a class="xref" href="alleg014.html#blit" title="Copies a rectangular area from one bitmap to another.">blit</a>, <a class="xref" href="alleg013.html#clear_bitmap" title="Clears the bitmap to color 0.">clear_bitmap</a>, <a class="xref" href="alleg019.html#clear_zbuffer" title="Writes a depth value into the given Z-buffer.">clear_zbuffer</a>, <a class="xref" href="alleg009.html#create_bitmap" title="Creates a memory bitmap.">create_bitmap</a>, <a class="xref" href="alleg019.html#create_zbuffer" title="Creates a Z-buffer for a bitmap.">create_zbuffer</a>, <a class="xref" href="alleg011.html#desktop_palette" title="The palette used by the Atari ST low resolution desktop.">desktop_palette</a>, <a class="xref" href="alleg009.html#destroy_bitmap" title="Destroys any type of created bitmap.">destroy_bitmap</a>, <a class="xref" href="alleg019.html#destroy_zbuffer" title="Destroys a Z-buffer.">destroy_zbuffer</a>, <a class="xref" href="alleg018.html#font" title="A simple 8x8 fixed size font.">font</a>, <a class="xref" href="alleg033.html#get_transformation_matrix_f" title="Floating point version of get_transformation_matrix().">get_transformation_matrix_f</a>, <a class="xref" href="alleg035.html#gfx_mode_select_ex" title="Extended version of the graphics mode selection dialog.">gfx_mode_select_ex</a>, <a class="xref" href="alleg005.html#install_int" title="Installs a user timer handler.">install_int</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg004.html#install_mouse" title="Installs the Allegro mouse handler.">install_mouse</a>, <a class="xref" href="alleg005.html#install_timer" title="Installs the Allegro timer interrupt handler.">install_timer</a>, <a class="xref" href="alleg006.html#keypressed" title="Tells if there are keypresses waiting in the input buffer.">keypressed</a>, <a class="xref" href="alleg012.html#palette_color" title="Maps palette indexes into the current pixel format colors.">palette_color</a>, <a class="xref" href="alleg033.html#persp_project_f" title="Projects a 3d point into 2d screen space.">persp_project_f</a>, <a class="xref" href="alleg033.html#polygon_z_normal_f" title="Finds the Z component of the normal vector to three vertices.">polygon_z_normal_f</a>, <a class="xref" href="alleg019.html#quad3d_f" title="Draws a 3d quad onto the specified bitmap.">quad3d_f</a>, <a class="xref" href="alleg006.html#readkey" title="Returns the next character from the keyboard buffer.">readkey</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg008.html#set_color_depth" title="Sets the global pixel color depth.">set_color_depth</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>, <a class="xref" href="alleg011.html#set_palette" title="Sets the entire palette of 256 colors.">set_palette</a>, <a class="xref" href="alleg011.html#set_palette_range" title="Sets a specific range of the palette.">set_palette_range</a>, <a class="xref" href="alleg033.html#set_projection_viewport" title="Sets the viewport used to scale the output of persp_project().">set_projection_viewport</a>, <a class="xref" href="alleg019.html#set_zbuffer" title="Makes the given Z-buffer the active one.">set_zbuffer</a>, <a class="xref" href="alleg018.html#textprintf_ex" title="Formatted output of a string.">textprintf_ex</a>, <a class="xref" href="alleg008.html#vsync" title="Waits for a vertical retrace to begin.">vsync</a>.</blockquote> <div class="al-api"><b>Example <a name="exscroll">exscroll</a></b></div><br> This program demonstrates how to use hardware scrolling. The scrolling should work on anything that supports virtual screens larger than the physical screen. <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg001.html#BITMAP" title="Stores the contents of a bitmap.">BITMAP</a>, <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg001.html#RGB" title="Single palette entry.">RGB</a>, <a class="xref" href="alleg009.html#SCREEN_H" title="Global define to obtain the size of the screen.">SCREEN_H</a>, <a class="xref" href="alleg009.html#SCREEN_W" title="Global define to obtain the size of the screen.">SCREEN_W</a>, <a class="xref" href="alleg009.html#acquire_bitmap" title="Locks the bitmap before drawing onto it.">acquire_bitmap</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg006.html#clear_keybuf" title="Clears the keyboard buffer.">clear_keybuf</a>, <a class="xref" href="alleg009.html#create_sub_bitmap" title="Creates a memory sub bitmap.">create_sub_bitmap</a>, <a class="xref" href="alleg011.html#desktop_palette" title="The palette used by the Atari ST low resolution desktop.">desktop_palette</a>, <a class="xref" href="alleg009.html#destroy_bitmap" title="Destroys any type of created bitmap.">destroy_bitmap</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg006.html#keypressed" title="Tells if there are keypresses waiting in the input buffer.">keypressed</a>, <a class="xref" href="alleg013.html#rectfill" title="Draws a solid filled rectangle.">rectfill</a>, <a class="xref" href="alleg009.html#release_bitmap" title="Releases a previously locked bitmap.">release_bitmap</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg008.html#scroll_screen" title="Requests a hardware scroll request.">scroll_screen</a>, <a class="xref" href="alleg011.html#set_color" title="Sets the specified palette entry to the specified RGB triplet.">set_color</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>, <a class="xref" href="alleg011.html#set_palette" title="Sets the entire palette of 256 colors.">set_palette</a>, <a class="xref" href="alleg013.html#vline" title="Draws a vertical line onto the bitmap.">vline</a>.</blockquote> <div class="al-api"><b>Example <a name="ex3buf">ex3buf</a></b></div><br> This program demonstrates the use of triple buffering. Several triangles are displayed rotating and bouncing on the screen until you press a key. Note that on some platforms you can't get real hardware triple buffering. The Allegro code remains the same, but most likely the graphic driver will emulate it. Unfortunately, in these cases you can't expect the animation to be completely smooth and flicker free. <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg001.html#BITMAP" title="Stores the contents of a bitmap.">BITMAP</a>, <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg009.html#SCREEN_H" title="Global define to obtain the size of the screen.">SCREEN_H</a>, <a class="xref" href="alleg009.html#SCREEN_W" title="Global define to obtain the size of the screen.">SCREEN_W</a>, <a class="xref" href="alleg009.html#acquire_bitmap" title="Locks the bitmap before drawing onto it.">acquire_bitmap</a>, <a class="xref" href="alleg000.html#allegro_error" title="Stores the last Allegro error message.">allegro_error</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg013.html#clear_bitmap" title="Clears the bitmap to color 0.">clear_bitmap</a>, <a class="xref" href="alleg006.html#clear_keybuf" title="Clears the keyboard buffer.">clear_keybuf</a>, <a class="xref" href="alleg009.html#create_video_bitmap" title="Creates a video memory bitmap.">create_video_bitmap</a>, <a class="xref" href="alleg011.html#desktop_palette" title="The palette used by the Atari ST low resolution desktop.">desktop_palette</a>, <a class="xref" href="alleg009.html#destroy_bitmap" title="Destroys any type of created bitmap.">destroy_bitmap</a>, <a class="xref" href="alleg008.html#enable_triple_buffer" title="Enables triple buffering.">enable_triple_buffer</a>, <a class="xref" href="alleg032.html#fixcos" title="Fixed point cosine of binary angles.">fixcos</a>, <a class="xref" href="alleg001.html#fixed" title="Fixed point integer to replace floats.">fixed</a>, <a class="xref" href="alleg032.html#fixmul" title="Multiplies two fixed point values together.">fixmul</a>, <a class="xref" href="alleg032.html#fixsin" title="Fixed point sine of binary angles.">fixsin</a>, <a class="xref" href="alleg032.html#fixtoi" title="Converts a fixed point to integer with rounding.">fixtoi</a>, <a class="xref" href="alleg018.html#font" title="A simple 8x8 fixed size font.">font</a>, <a class="xref" href="alleg008.html#gfx_capabilities" title="Bitfield describing video hardware capabilities.">gfx_capabilities</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg004.html#install_mouse" title="Installs the Allegro mouse handler.">install_mouse</a>, <a class="xref" href="alleg005.html#install_timer" title="Installs the Allegro timer interrupt handler.">install_timer</a>, <a class="xref" href="alleg032.html#itofix" title="Converts an integer to fixed point.">itofix</a>, <a class="xref" href="alleg006.html#keypressed" title="Tells if there are keypresses waiting in the input buffer.">keypressed</a>, <a class="xref" href="alleg008.html#poll_scroll" title="Checks the status of a scroll request with triple buffering.">poll_scroll</a>, <a class="xref" href="alleg009.html#release_bitmap" title="Releases a previously locked bitmap.">release_bitmap</a>, <a class="xref" href="alleg008.html#request_video_bitmap" title="Triple buffering page flip request.">request_video_bitmap</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>, <a class="xref" href="alleg011.html#set_palette" title="Sets the entire palette of 256 colors.">set_palette</a>, <a class="xref" href="alleg018.html#textout_ex" title="Writes a string on a bitmap.">textout_ex</a>, <a class="xref" href="alleg013.html#triangle" title="Draws a filled triangle.">triangle</a>, <a class="xref" href="alleg002.html#ustrzcpy" title="Copies a string into another one, specifying size.">ustrzcpy</a>.</blockquote> <div class="al-api"><b>Example <a name="ex12bit">ex12bit</a></b></div><br> This program sets up a 12-bit mode on any 8-bit card, by setting up a 256-colour palette that will fool the eye into grouping two 8-bit pixels into one 12-bit pixel. In order to do this, you make your 256-colour palette with all the combinations of blue and green, assuming green ranges from 0-15 and blue from 0-14. This takes up 16x15=240 colours. This leaves 16 colours to use as red (red ranges from 0-15). Then you put your green/blue in one pixel, and your red in the pixel next to it. The eye gets fooled into thinking it's all one pixel. <p> The example starts setting a normal 256 color mode, and construct a special palette for it. But then comes the trick: you need to write to a set of two adjacent pixels to form a single 12 bit dot. Two eight bit pixels is the same as one 16 bit pixel, so after setting the video mode you need to hack the screen bitmap about, halving the width and changing it to use the 16 bit drawing code. Then, once you have packed a color into the correct format (using the makecol12() function below), any of the normal Allegro drawing functions can be used with this 12 bit display! <p> Things to note: <p> <ul><li>The horizontal width is halved, so you get resolutions like 320x480, 400x600, and 512x768. <li>Because each dot is spread over two actual pixels, the display will be darker than in a normal video mode. <li>Any bitmap data will obviously need converting to the correct 12 bit format: regular 15 or 16 bit images won't display correctly... <li>Although this works like a truecolor mode, it is actually using a 256 color palette, so palette fades are still possible! <li>This code only works in linear screen modes (don't try Mode-X).</ul> <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg001.html#BITMAP" title="Stores the contents of a bitmap.">BITMAP</a>, <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg001.html#MATRIX" title="Fixed point matrix structure.">MATRIX</a>, <a class="xref" href="alleg001.html#PALETTE" title="Stores palette information.">PALETTE</a>, <a class="xref" href="alleg001.html#RGB" title="Single palette entry.">RGB</a>, <a class="xref" href="alleg000.html#allegro_error" title="Stores the last Allegro error message.">allegro_error</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg033.html#apply_matrix" title="Multiplies a point by a transformation matrix.">apply_matrix</a>, <a class="xref" href="alleg014.html#blit" title="Copies a rectangular area from one bitmap to another.">blit</a>, <a class="xref" href="alleg013.html#circle" title="Draws a circle.">circle</a>, <a class="xref" href="alleg013.html#clear_bitmap" title="Clears the bitmap to color 0.">clear_bitmap</a>, <a class="xref" href="alleg006.html#clear_keybuf" title="Clears the keyboard buffer.">clear_keybuf</a>, <a class="xref" href="alleg013.html#clear_to_color" title="Clears the bitmap to the specified color.">clear_to_color</a>, <a class="xref" href="alleg009.html#create_bitmap" title="Creates a memory bitmap.">create_bitmap</a>, <a class="xref" href="alleg009.html#create_bitmap_ex" title="Creates a memory bitmap specifying color depth.">create_bitmap_ex</a>, <a class="xref" href="alleg009.html#destroy_bitmap" title="Destroys any type of created bitmap.">destroy_bitmap</a>, <a class="xref" href="alleg013.html#ellipsefill" title="Draws a filled ellipse.">ellipsefill</a>, <a class="xref" href="alleg011.html#fade_out" title="Gradually fades the palette to black.">fade_out</a>, <a class="xref" href="alleg032.html#fixcos" title="Fixed point cosine of binary angles.">fixcos</a>, <a class="xref" href="alleg001.html#fixed" title="Fixed point integer to replace floats.">fixed</a>, <a class="xref" href="alleg032.html#fixsin" title="Fixed point sine of binary angles.">fixsin</a>, <a class="xref" href="alleg032.html#fixtoi" title="Converts a fixed point to integer with rounding.">fixtoi</a>, <a class="xref" href="alleg018.html#font" title="A simple 8x8 fixed size font.">font</a>, <a class="xref" href="alleg033.html#get_rotation_matrix" title="Constructs X, Y, Z rotation matrices.">get_rotation_matrix</a>, <a class="xref" href="alleg013.html#getpixel" title="Reads a pixel from a bitmap.">getpixel</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg032.html#itofix" title="Converts an integer to fixed point.">itofix</a>, <a class="xref" href="alleg006.html#keypressed" title="Tells if there are keypresses waiting in the input buffer.">keypressed</a>, <a class="xref" href="alleg013.html#line" title="Draws a line onto the bitmap.">line</a>, <a class="xref" href="alleg012.html#makecol" title="Converts an RGB value into the current pixel format.">makecol</a>, <a class="xref" href="alleg014.html#masked_blit" title="Copies a rectangle skipping pixels with the mask color.">masked_blit</a>, <a class="xref" href="alleg013.html#putpixel" title="Writes a pixel into a bitmap.">putpixel</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg009.html#set_clip_rect" title="Sets the clipping rectangle of a bitmap.">set_clip_rect</a>, <a class="xref" href="alleg011.html#set_color" title="Sets the specified palette entry to the specified RGB triplet.">set_color</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>, <a class="xref" href="alleg011.html#set_palette" title="Sets the entire palette of 256 colors.">set_palette</a>, <a class="xref" href="alleg018.html#text_height" title="Returns the height of a font in pixels.">text_height</a>, <a class="xref" href="alleg018.html#text_length" title="Returns the length of a string in pixels.">text_length</a>, <a class="xref" href="alleg018.html#textout_ex" title="Writes a string on a bitmap.">textout_ex</a>, <a class="xref" href="alleg018.html#textprintf_ex" title="Formatted output of a string.">textprintf_ex</a>.</blockquote> <div class="al-api"><b>Example <a name="exaccel">exaccel</a></b></div><br> This program demonstrates how to use an offscreen part of the video memory to store source graphics for a hardware accelerated graphics driver. The example loads the <tt>`mysha.pcx'</tt> file and then blits it several times on the screen. Depending on whether you have enough video memory and Allegro supports the hardware acceleration features of your card, your success running this example may be none at all, sluggish performance due to software emulation, or flicker free smooth hardware accelerated animation. <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg001.html#BITMAP" title="Stores the contents of a bitmap.">BITMAP</a>, <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg001.html#PALETTE" title="Stores palette information.">PALETTE</a>, <a class="xref" href="alleg009.html#SCREEN_H" title="Global define to obtain the size of the screen.">SCREEN_H</a>, <a class="xref" href="alleg009.html#SCREEN_W" title="Global define to obtain the size of the screen.">SCREEN_W</a>, <a class="xref" href="alleg009.html#acquire_bitmap" title="Locks the bitmap before drawing onto it.">acquire_bitmap</a>, <a class="xref" href="alleg000.html#allegro_error" title="Stores the last Allegro error message.">allegro_error</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg014.html#blit" title="Copies a rectangular area from one bitmap to another.">blit</a>, <a class="xref" href="alleg013.html#clear_bitmap" title="Clears the bitmap to color 0.">clear_bitmap</a>, <a class="xref" href="alleg009.html#create_video_bitmap" title="Creates a video memory bitmap.">create_video_bitmap</a>, <a class="xref" href="alleg009.html#destroy_bitmap" title="Destroys any type of created bitmap.">destroy_bitmap</a>, <a class="xref" href="alleg018.html#font" title="A simple 8x8 fixed size font.">font</a>, <a class="xref" href="alleg008.html#gfx_capabilities" title="Bitfield describing video hardware capabilities.">gfx_capabilities</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg005.html#install_timer" title="Installs the Allegro timer interrupt handler.">install_timer</a>, <a class="xref" href="alleg006.html#keypressed" title="Tells if there are keypresses waiting in the input buffer.">keypressed</a>, <a class="xref" href="alleg010.html#load_bitmap" title="Loads any supported bitmap from a file.">load_bitmap</a>, <a class="xref" href="alleg006.html#readkey" title="Returns the next character from the keyboard buffer.">readkey</a>, <a class="xref" href="alleg009.html#release_bitmap" title="Releases a previously locked bitmap.">release_bitmap</a>, <a class="xref" href="alleg030.html#replace_filename" title="Replaces path+filename with a new filename tail.">replace_filename</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>, <a class="xref" href="alleg011.html#set_palette" title="Sets the entire palette of 256 colors.">set_palette</a>, <a class="xref" href="alleg008.html#show_video_bitmap" title="Flips the hardware screen to use the specified page.">show_video_bitmap</a>, <a class="xref" href="alleg018.html#textout_ex" title="Writes a string on a bitmap.">textout_ex</a>, <a class="xref" href="alleg018.html#textprintf_ex" title="Formatted output of a string.">textprintf_ex</a>.</blockquote> <div class="al-api"><b>Example <a name="exspline">exspline</a></b></div><br> This program demonstrates the use of spline curves to create smooth paths connecting a number of node points. This can be useful for constructing realistic motion and animations. <p> The technique is to connect the series of guide points p1..p(n) with spline curves from p1-p2, p2-p3, etc. Each spline must pass though both of its guide points, so they must be used as the first and fourth of the spline control points. The fun bit is coming up with sensible values for the second and third spline control points, such that the spline segments will have equal gradients where they meet. I came up with the following solution: <p> For each guide point p(n), calculate the desired tangent to the curve at that point. I took this to be the vector p(n-1) -> p(n+1), which can easily be calculated with the inverse tangent function, and gives decent looking results. One implication of this is that two dummy guide points are needed at each end of the curve, which are used in the tangent calculations but not connected to the set of splines. <p> Having got these tangents, it becomes fairly easy to calculate the spline control points. For a spline between guide points p(a) and p(b), the second control point should lie along the positive tangent from p(a), and the third control point should lie along the negative tangent from p(b). How far they are placed along these tangents controls the shape of the curve: I found that applying a 'curviness' scaling factor to the distance between p(a) and p(b) works well. <p> One thing to note about splines is that the generated points are not all equidistant. Instead they tend to bunch up nearer to the ends of the spline, which means you will need to apply some fudges to get an object to move at a constant speed. On the other hand, in situations where the curve has a noticeable change of direction at each guide point, the effect can be quite nice because it makes the object slow down for the curve. <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg009.html#SCREEN_W" title="Global define to obtain the size of the screen.">SCREEN_W</a>, <a class="xref" href="alleg009.html#acquire_screen" title="Shortcut of acquire_bitmap(screen);">acquire_screen</a>, <a class="xref" href="alleg035.html#alert" title="Displays a popup alert box.">alert</a>, <a class="xref" href="alleg000.html#allegro_error" title="Stores the last Allegro error message.">allegro_error</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg013.html#calc_spline" title="Calculates a series of values along a Bezier spline.">calc_spline</a>, <a class="xref" href="alleg013.html#circlefill" title="Draws a filled circle.">circlefill</a>, <a class="xref" href="alleg006.html#clear_keybuf" title="Clears the keyboard buffer.">clear_keybuf</a>, <a class="xref" href="alleg013.html#clear_to_color" title="Clears the bitmap to the specified color.">clear_to_color</a>, <a class="xref" href="alleg011.html#desktop_palette" title="The palette used by the Atari ST low resolution desktop.">desktop_palette</a>, <a class="xref" href="alleg032.html#fixatan2" title="Fixed point version of the libc atan2() routine.">fixatan2</a>, <a class="xref" href="alleg032.html#fixcos" title="Fixed point cosine of binary angles.">fixcos</a>, <a class="xref" href="alleg001.html#fixed" title="Fixed point integer to replace floats.">fixed</a>, <a class="xref" href="alleg032.html#fixmul" title="Multiplies two fixed point values together.">fixmul</a>, <a class="xref" href="alleg032.html#fixsin" title="Fixed point sine of binary angles.">fixsin</a>, <a class="xref" href="alleg032.html#fixsqrt" title="Fixed point square root.">fixsqrt</a>, <a class="xref" href="alleg032.html#fixtof" title="Converts a fixed point to floating point.">fixtof</a>, <a class="xref" href="alleg032.html#fixtoi" title="Converts a fixed point to integer with rounding.">fixtoi</a>, <a class="xref" href="alleg018.html#font" title="A simple 8x8 fixed size font.">font</a>, <a class="xref" href="alleg032.html#ftofix" title="Converts a floating point value to fixed point.">ftofix</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg004.html#install_mouse" title="Installs the Allegro mouse handler.">install_mouse</a>, <a class="xref" href="alleg005.html#install_timer" title="Installs the Allegro timer interrupt handler.">install_timer</a>, <a class="xref" href="alleg032.html#itofix" title="Converts an integer to fixed point.">itofix</a>, <a class="xref" href="alleg006.html#key" title="Array of flags indicating key state.">key</a>, <a class="xref" href="alleg006.html#keypressed" title="Tells if there are keypresses waiting in the input buffer.">keypressed</a>, <a class="xref" href="alleg013.html#line" title="Draws a line onto the bitmap.">line</a>, <a class="xref" href="alleg012.html#makecol" title="Converts an RGB value into the current pixel format.">makecol</a>, <a class="xref" href="alleg004.html#mouse_b" title="Global variable with the mouse position/button state.">mouse_b</a>, <a class="xref" href="alleg004.html#mouse_x" title="Global variable with the mouse position/button state.">mouse_x</a>, <a class="xref" href="alleg004.html#mouse_y" title="Global variable with the mouse position/button state.">mouse_y</a>, <a class="xref" href="alleg012.html#palette_color" title="Maps palette indexes into the current pixel format colors.">palette_color</a>, <a class="xref" href="alleg004.html#poll_mouse" title="Polls the mouse.">poll_mouse</a>, <a class="xref" href="alleg006.html#readkey" title="Returns the next character from the keyboard buffer.">readkey</a>, <a class="xref" href="alleg009.html#release_screen" title="Shortcut of release_bitmap(screen);">release_screen</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>, <a class="xref" href="alleg011.html#set_palette" title="Sets the entire palette of 256 colors.">set_palette</a>, <a class="xref" href="alleg004.html#show_mouse" title="Tells Allegro to display a mouse pointer on the screen.">show_mouse</a>, <a class="xref" href="alleg013.html#spline" title="Draws a Bezier spline using four control points.">spline</a>, <a class="xref" href="alleg018.html#textout_centre_ex" title="Writes a centered string on a bitmap.">textout_centre_ex</a>, <a class="xref" href="alleg018.html#textprintf_centre_ex" title="Formatted centered output of a string.">textprintf_centre_ex</a>, <a class="xref" href="alleg018.html#textprintf_ex" title="Formatted output of a string.">textprintf_ex</a>, <a class="xref" href="alleg008.html#vsync" title="Waits for a vertical retrace to begin.">vsync</a>, <a class="xref" href="alleg020.html#xor_mode" title="Shortcut for toggling xor drawing mode on and off.">xor_mode</a>.</blockquote> <div class="al-api"><b>Example <a name="exsyscur">exsyscur</a></b></div><br> This program demonstrates the use of hardware accelerated mouse cursors. <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg009.html#SCREEN_H" title="Global define to obtain the size of the screen.">SCREEN_H</a>, <a class="xref" href="alleg009.html#SCREEN_W" title="Global define to obtain the size of the screen.">SCREEN_W</a>, <a class="xref" href="alleg000.html#allegro_error" title="Stores the last Allegro error message.">allegro_error</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg013.html#clear_to_color" title="Clears the bitmap to the specified color.">clear_to_color</a>, <a class="xref" href="alleg004.html#enable_hardware_cursor" title="Enables the OS hardware cursor.">enable_hardware_cursor</a>, <a class="xref" href="alleg018.html#font" title="A simple 8x8 fixed size font.">font</a>, <a class="xref" href="alleg008.html#gfx_capabilities" title="Bitfield describing video hardware capabilities.">gfx_capabilities</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg004.html#install_mouse" title="Installs the Allegro mouse handler.">install_mouse</a>, <a class="xref" href="alleg005.html#install_timer" title="Installs the Allegro timer interrupt handler.">install_timer</a>, <a class="xref" href="alleg012.html#makecol" title="Converts an RGB value into the current pixel format.">makecol</a>, <a class="xref" href="alleg006.html#readkey" title="Returns the next character from the keyboard buffer.">readkey</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg004.html#select_mouse_cursor" title="Tells Allegro to select software or hardware cursor drawing.">select_mouse_cursor</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>, <a class="xref" href="alleg004.html#show_mouse" title="Tells Allegro to display a mouse pointer on the screen.">show_mouse</a>, <a class="xref" href="alleg018.html#text_height" title="Returns the height of a font in pixels.">text_height</a>, <a class="xref" href="alleg018.html#textprintf_centre_ex" title="Formatted centered output of a string.">textprintf_centre_ex</a>.</blockquote> <div class="al-api"><b>Example <a name="exupdate">exupdate</a></b></div><br> This program demonstrates how to support double buffering, page flipping, and triple buffering as options within a single program, and how to make things run at a constant rate no matter what the speed of your computer. You have to use this example from the command line to specify as first parameter a number which represents the type of video update you want: 1 for double buffering with memory bitmaps, 2 for page flipping, 3 for triple buffering and 4 for double buffering with system bitmaps. After this, a dialog allows you to select a screen resolution and finally you will see a kaleidoscopic animation, along with a frames per second counter on the top left of the screen. <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg001.html#BITMAP" title="Stores the contents of a bitmap.">BITMAP</a>, <a class="xref" href="alleg005.html#END_OF_FUNCTION" title="Locks the code used by a timer.">END_OF_FUNCTION</a>, <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg005.html#LOCK_FUNCTION" title="Locks the memory of a function used by a timer.">LOCK_FUNCTION</a>, <a class="xref" href="alleg005.html#LOCK_VARIABLE" title="Locks the memory of a variable used by a timer.">LOCK_VARIABLE</a>, <a class="xref" href="alleg001.html#PALETTE" title="Stores palette information.">PALETTE</a>, <a class="xref" href="alleg009.html#SCREEN_H" title="Global define to obtain the size of the screen.">SCREEN_H</a>, <a class="xref" href="alleg009.html#SCREEN_W" title="Global define to obtain the size of the screen.">SCREEN_W</a>, <a class="xref" href="alleg009.html#acquire_bitmap" title="Locks the bitmap before drawing onto it.">acquire_bitmap</a>, <a class="xref" href="alleg000.html#allegro_error" title="Stores the last Allegro error message.">allegro_error</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg009.html#bitmap_color_depth" title="Returns the color depth of the specified bitmap.">bitmap_color_depth</a>, <a class="xref" href="alleg014.html#blit" title="Copies a rectangular area from one bitmap to another.">blit</a>, <a class="xref" href="alleg013.html#clear_bitmap" title="Clears the bitmap to color 0.">clear_bitmap</a>, <a class="xref" href="alleg009.html#create_bitmap" title="Creates a memory bitmap.">create_bitmap</a>, <a class="xref" href="alleg009.html#create_system_bitmap" title="Creates a system memory bitmap.">create_system_bitmap</a>, <a class="xref" href="alleg009.html#create_video_bitmap" title="Creates a video memory bitmap.">create_video_bitmap</a>, <a class="xref" href="alleg011.html#desktop_palette" title="The palette used by the Atari ST low resolution desktop.">desktop_palette</a>, <a class="xref" href="alleg009.html#destroy_bitmap" title="Destroys any type of created bitmap.">destroy_bitmap</a>, <a class="xref" href="alleg008.html#enable_triple_buffer" title="Enables triple buffering.">enable_triple_buffer</a>, <a class="xref" href="alleg032.html#fixcos" title="Fixed point cosine of binary angles.">fixcos</a>, <a class="xref" href="alleg001.html#fixed" title="Fixed point integer to replace floats.">fixed</a>, <a class="xref" href="alleg032.html#fixmul" title="Multiplies two fixed point values together.">fixmul</a>, <a class="xref" href="alleg032.html#fixsin" title="Fixed point sine of binary angles.">fixsin</a>, <a class="xref" href="alleg032.html#fixtoi" title="Converts a fixed point to integer with rounding.">fixtoi</a>, <a class="xref" href="alleg018.html#font" title="A simple 8x8 fixed size font.">font</a>, <a class="xref" href="alleg032.html#ftofix" title="Converts a floating point value to fixed point.">ftofix</a>, <a class="xref" href="alleg011.html#generate_332_palette" title="Constructs a fake truecolor palette.">generate_332_palette</a>, <a class="xref" href="alleg008.html#gfx_capabilities" title="Bitfield describing video hardware capabilities.">gfx_capabilities</a>, <a class="xref" href="alleg035.html#gfx_mode_select_ex" title="Extended version of the graphics mode selection dialog.">gfx_mode_select_ex</a>, <a class="xref" href="alleg005.html#install_int_ex" title="Adds or modifies a timer.">install_int_ex</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg004.html#install_mouse" title="Installs the Allegro mouse handler.">install_mouse</a>, <a class="xref" href="alleg005.html#install_timer" title="Installs the Allegro timer interrupt handler.">install_timer</a>, <a class="xref" href="alleg006.html#keypressed" title="Tells if there are keypresses waiting in the input buffer.">keypressed</a>, <a class="xref" href="alleg013.html#line" title="Draws a line onto the bitmap.">line</a>, <a class="xref" href="alleg012.html#makecol" title="Converts an RGB value into the current pixel format.">makecol</a>, <a class="xref" href="alleg008.html#poll_scroll" title="Checks the status of a scroll request with triple buffering.">poll_scroll</a>, <a class="xref" href="alleg009.html#release_bitmap" title="Releases a previously locked bitmap.">release_bitmap</a>, <a class="xref" href="alleg008.html#request_video_bitmap" title="Triple buffering page flip request.">request_video_bitmap</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg008.html#set_color_depth" title="Sets the global pixel color depth.">set_color_depth</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>, <a class="xref" href="alleg011.html#set_palette" title="Sets the entire palette of 256 colors.">set_palette</a>, <a class="xref" href="alleg008.html#show_video_bitmap" title="Flips the hardware screen to use the specified page.">show_video_bitmap</a>, <a class="xref" href="alleg018.html#textout_ex" title="Writes a string on a bitmap.">textout_ex</a>, <a class="xref" href="alleg018.html#textprintf_ex" title="Formatted output of a string.">textprintf_ex</a>, <a class="xref" href="alleg013.html#triangle" title="Draws a filled triangle.">triangle</a>, <a class="xref" href="alleg008.html#vsync" title="Waits for a vertical retrace to begin.">vsync</a>, <a class="xref" href="alleg020.html#xor_mode" title="Shortcut for toggling xor drawing mode on and off.">xor_mode</a>.</blockquote> <div class="al-api"><b>Example <a name="exswitch">exswitch</a></b></div><br> This program shows how to control the console switching mode, and let your program run in the background. These functions don't apply to every platform and driver, for example you can't control the switching mode from a DOS program. <p> Yes, I know the fractal drawing is very slow: that's the point! This is so you can easily check whether it goes on working in the background after you switch away from the app. <p> Depending on the type of selected switching mode, you will see whether the contents of the screen are preserved or not. <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg001.html#BITMAP" title="Stores the contents of a bitmap.">BITMAP</a>, <a class="xref" href="alleg005.html#END_OF_FUNCTION" title="Locks the code used by a timer.">END_OF_FUNCTION</a>, <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg005.html#LOCK_FUNCTION" title="Locks the memory of a function used by a timer.">LOCK_FUNCTION</a>, <a class="xref" href="alleg005.html#LOCK_VARIABLE" title="Locks the memory of a variable used by a timer.">LOCK_VARIABLE</a>, <a class="xref" href="alleg001.html#PALETTE" title="Stores palette information.">PALETTE</a>, <a class="xref" href="alleg009.html#SCREEN_H" title="Global define to obtain the size of the screen.">SCREEN_H</a>, <a class="xref" href="alleg009.html#SCREEN_W" title="Global define to obtain the size of the screen.">SCREEN_W</a>, <a class="xref" href="alleg009.html#acquire_bitmap" title="Locks the bitmap before drawing onto it.">acquire_bitmap</a>, <a class="xref" href="alleg009.html#acquire_screen" title="Shortcut of acquire_bitmap(screen);">acquire_screen</a>, <a class="xref" href="alleg000.html#allegro_error" title="Stores the last Allegro error message.">allegro_error</a>, <a class="xref" href="alleg000.html#allegro_exit" title="Closes down the Allegro system.">allegro_exit</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg009.html#bitmap_color_depth" title="Returns the color depth of the specified bitmap.">bitmap_color_depth</a>, <a class="xref" href="alleg014.html#blit" title="Copies a rectangular area from one bitmap to another.">blit</a>, <a class="xref" href="alleg013.html#clear_to_color" title="Clears the bitmap to the specified color.">clear_to_color</a>, <a class="xref" href="alleg009.html#create_sub_bitmap" title="Creates a memory sub bitmap.">create_sub_bitmap</a>, <a class="xref" href="alleg011.html#desktop_palette" title="The palette used by the Atari ST low resolution desktop.">desktop_palette</a>, <a class="xref" href="alleg009.html#destroy_bitmap" title="Destroys any type of created bitmap.">destroy_bitmap</a>, <a class="xref" href="alleg018.html#font" title="A simple 8x8 fixed size font.">font</a>, <a class="xref" href="alleg008.html#get_display_switch_mode" title="Returns the current display switching mode.">get_display_switch_mode</a>, <a class="xref" href="alleg035.html#gfx_mode_select_ex" title="Extended version of the graphics mode selection dialog.">gfx_mode_select_ex</a>, <a class="xref" href="alleg005.html#install_int" title="Installs a user timer handler.">install_int</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg004.html#install_mouse" title="Installs the Allegro mouse handler.">install_mouse</a>, <a class="xref" href="alleg005.html#install_timer" title="Installs the Allegro timer interrupt handler.">install_timer</a>, <a class="xref" href="alleg006.html#keypressed" title="Tells if there are keypresses waiting in the input buffer.">keypressed</a>, <a class="xref" href="alleg012.html#makecol" title="Converts an RGB value into the current pixel format.">makecol</a>, <a class="xref" href="alleg012.html#palette_color" title="Maps palette indexes into the current pixel format colors.">palette_color</a>, <a class="xref" href="alleg013.html#putpixel" title="Writes a pixel into a bitmap.">putpixel</a>, <a class="xref" href="alleg006.html#readkey" title="Returns the next character from the keyboard buffer.">readkey</a>, <a class="xref" href="alleg013.html#rectfill" title="Draws a solid filled rectangle.">rectfill</a>, <a class="xref" href="alleg009.html#release_bitmap" title="Releases a previously locked bitmap.">release_bitmap</a>, <a class="xref" href="alleg009.html#release_screen" title="Shortcut of release_bitmap(screen);">release_screen</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg008.html#set_color_depth" title="Sets the global pixel color depth.">set_color_depth</a>, <a class="xref" href="alleg008.html#set_display_switch_callback" title="Installs a switching notification callback.">set_display_switch_callback</a>, <a class="xref" href="alleg008.html#set_display_switch_mode" title="Tells Allegro how the program handles background switching.">set_display_switch_mode</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>, <a class="xref" href="alleg011.html#set_palette" title="Sets the entire palette of 256 colors.">set_palette</a>, <a class="xref" href="alleg018.html#textout_centre_ex" title="Writes a centered string on a bitmap.">textout_centre_ex</a>, <a class="xref" href="alleg018.html#textprintf_centre_ex" title="Formatted centered output of a string.">textprintf_centre_ex</a>.</blockquote> <div class="al-api"><b>Example <a name="exstream">exstream</a></b></div><br> This program shows how to use the audio stream functions to transfer large blocks of sample data to the sound card. In this case, the sample data is generated during runtime, and the resulting sound reminds of a car engine when you are accelerating. <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg001.html#AUDIOSTREAM" title="Stores an audiostream.">AUDIOSTREAM</a>, <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg009.html#SCREEN_H" title="Global define to obtain the size of the screen.">SCREEN_H</a>, <a class="xref" href="alleg009.html#SCREEN_W" title="Global define to obtain the size of the screen.">SCREEN_W</a>, <a class="xref" href="alleg000.html#allegro_error" title="Stores the last Allegro error message.">allegro_error</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg013.html#clear_to_color" title="Clears the bitmap to the specified color.">clear_to_color</a>, <a class="xref" href="alleg011.html#desktop_palette" title="The palette used by the Atari ST low resolution desktop.">desktop_palette</a>, <a class="xref" href="alleg018.html#font" title="A simple 8x8 fixed size font.">font</a>, <a class="xref" href="alleg028.html#free_audio_stream_buffer" title="Tells the audio stream player new data can be played.">free_audio_stream_buffer</a>, <a class="xref" href="alleg028.html#get_audio_stream_buffer" title="Tells you if you need to fill the audiostream or not.">get_audio_stream_buffer</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg024.html#install_sound" title="Initialises the sound module.">install_sound</a>, <a class="xref" href="alleg005.html#install_timer" title="Installs the Allegro timer interrupt handler.">install_timer</a>, <a class="xref" href="alleg006.html#keypressed" title="Tells if there are keypresses waiting in the input buffer.">keypressed</a>, <a class="xref" href="alleg012.html#makecol" title="Converts an RGB value into the current pixel format.">makecol</a>, <a class="xref" href="alleg028.html#play_audio_stream" title="Creates a new audio stream and starts playing it.">play_audio_stream</a>, <a class="xref" href="alleg006.html#readkey" title="Returns the next character from the keyboard buffer.">readkey</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>, <a class="xref" href="alleg011.html#set_palette" title="Sets the entire palette of 256 colors.">set_palette</a>, <a class="xref" href="alleg028.html#stop_audio_stream" title="Destroys an audio stream when it is no longer required.">stop_audio_stream</a>, <a class="xref" href="alleg018.html#textprintf_centre_ex" title="Formatted centered output of a string.">textprintf_centre_ex</a>, <a class="xref" href="alleg026.html#voice_start" title="Activates a voice.">voice_start</a>, <a class="xref" href="alleg026.html#voice_stop" title="Stops a voice.">voice_stop</a>.</blockquote> <div class="al-api"><b>Example <a name="expackf">expackf</a></b></div><br> This program demonstrates the use of the packfile functions, with some simple tests. <p> The first test uses the standard packfile functions to transfer a bitmap file into a block of memory, then reads the bitmap out of the block of memory, using a custom packfile vtable. <p> The second test reads in a bitmap with another custom packfile vtable, which uses libc's file stream functions. <p> The third test demonstrates seeking with a custom vtable. <p> The fourth test reads two bitmaps, and dumps them back into a single file, using a custom vtable again. <blockquote class="xref"><em><b>See also:</b></em> <a class="xref" href="alleg044.html#ASSERT" title="Debugging helper macro to assert.">ASSERT</a>, <a class="xref" href="alleg001.html#BITMAP" title="Stores the contents of a bitmap.">BITMAP</a>, <a class="xref" href="alleg000.html#END_OF_MAIN" title="Macro to put after your main() function.">END_OF_MAIN</a>, <a class="xref" href="alleg001.html#PACKFILE" title="Packfile structure, similar to the libc FILE structure.">PACKFILE</a>, <a class="xref" href="alleg001.html#PACKFILE_VTABLE" title="Packfile vtable structure, for custom packfiles.">PACKFILE_VTABLE</a>, <a class="xref" href="alleg009.html#SCREEN_H" title="Global define to obtain the size of the screen.">SCREEN_H</a>, <a class="xref" href="alleg009.html#SCREEN_W" title="Global define to obtain the size of the screen.">SCREEN_W</a>, <a class="xref" href="alleg035.html#alert" title="Displays a popup alert box.">alert</a>, <a class="xref" href="alleg000.html#allegro_error" title="Stores the last Allegro error message.">allegro_error</a>, <a class="xref" href="alleg000.html#allegro_init" title="Macro to initialise the Allegro library.">allegro_init</a>, <a class="xref" href="alleg000.html#allegro_message" title="Used mainly to show error messages to users.">allegro_message</a>, <a class="xref" href="alleg014.html#blit" title="Copies a rectangular area from one bitmap to another.">blit</a>, <a class="xref" href="alleg013.html#clear_bitmap" title="Clears the bitmap to color 0.">clear_bitmap</a>, <a class="xref" href="alleg009.html#destroy_bitmap" title="Destroys any type of created bitmap.">destroy_bitmap</a>, <a class="xref" href="alleg030.html#file_size_ex" title="Returns the size of a file in bytes.">file_size_ex</a>, <a class="xref" href="alleg018.html#font" title="A simple 8x8 fixed size font.">font</a>, <a class="xref" href="alleg006.html#install_keyboard" title="Installs the Allegro keyboard interrupt handler.">install_keyboard</a>, <a class="xref" href="alleg006.html#key" title="Array of flags indicating key state.">key</a>, <a class="xref" href="alleg010.html#load_bmp_pf" title="Packfile version of load_bmp.">load_bmp_pf</a>, <a class="xref" href="alleg010.html#load_pcx" title="Loads a PCX bitmap from a file.">load_pcx</a>, <a class="xref" href="alleg010.html#load_pcx_pf" title="Packfile version of load_pcx.">load_pcx_pf</a>, <a class="xref" href="alleg010.html#load_tga_pf" title="Packfile version of load_tga.">load_tga_pf</a>, <a class="xref" href="alleg030.html#pack_fclose" title="Closes a stream previously opened.">pack_fclose</a>, <a class="xref" href="alleg030.html#pack_fopen" title="Opens a file according to mode.">pack_fopen</a>, <a class="xref" href="alleg030.html#pack_fopen_vtable" title="">pack_fopen_vtable</a>, <a class="xref" href="alleg030.html#pack_fread" title="Reads n bytes from the stream.">pack_fread</a>, <a class="xref" href="alleg030.html#pack_fseek" title="Seeks inside a stream.">pack_fseek</a>, <a class="xref" href="alleg006.html#readkey" title="Returns the next character from the keyboard buffer.">readkey</a>, <a class="xref" href="alleg010.html#save_bmp_pf" title="Packfile version of save_bmp.">save_bmp_pf</a>, <a class="xref" href="alleg010.html#save_tga_pf" title="Packfile version of save_tga.">save_tga_pf</a>, <a class="xref" href="alleg009.html#screen" title="Global pointer to the screen hardware video memory.">screen</a>, <a class="xref" href="alleg008.html#set_color_depth" title="Sets the global pixel color depth.">set_color_depth</a>, <a class="xref" href="alleg008.html#set_gfx_mode" title="Sets a graphic video mode.">set_gfx_mode</a>, <a class="xref" href="alleg018.html#text_height" title="Returns the height of a font in pixels.">text_height</a>, <a class="xref" href="alleg018.html#textprintf_centre_ex" title="Formatted centered output of a string.">textprintf_centre_ex</a>, <a class="xref" href="alleg018.html#textprintf_ex" title="Formatted output of a string.">textprintf_ex</a>.</blockquote> <hr><div class="al-back-to-contents"><a href="allegro.html">Back to contents</a></div> </body> </html>