There are several structures and types defined by Allegro which are used in many functions (like the BITMAP structure). This section of the manual describes their useful content from a user point of view when they don't fit very well any of the existing manual sections, and redirects you to the appropriate section when it's already described there. Note that unless stated otherwise, the contents shown here are just for read only purposes, there might be other internal flags, but you shouldn't depend on them being available in past/future versions of Allegro.
See also: Fixed point math routines.
Examples using this: ex12bit, ex3buf, ex3d, excustom, exfixed, exspline, exsprite, exstars, exupdate.
There is some other stuff in the structure as well, but it is liable to change and you shouldn't use anything except the above. The `w' and `h' fields can be used to obtain the size of an existing bitmap:int w, h; - size of the bitmap in pixels int clip; - non-zero if clipping is turned on int cl, cr, ct, cb; - clip rectangle left, right, top, and bottom unsigned char *line[]; - pointers to the start of each line
The clipping rectangle is inclusive on the left and top (0 allows drawing to position 0) but exclusive on the right and bottom (10 allows drawing to position 9, but not to 10). Note this is not the same format as that of the clipping API, which takes inclusive coordinates for all four corners. All the values of this structure should be regarded as read-only, with the exception of the line field, whose access is described in depth in the "Direct access to video memory" section of the manual. If you want to modify the clipping region, please refrain from changing this structure. Use set_clip_rect() instead.bmp = load_bitmap("file.bmp", pal); allegro_message("Bitmap size: (%dx%d)\n", bmp->w, bmp->h);
See also: create_bitmap, set_clip_rect, bitmap_color_depth, RLE_SPRITE, COMPILED_SPRITE, Direct access to video memory.
Examples using this: Available Allegro examples.
RLE sprites store the image in a simple run-length encoded format, where repeated zero pixels are replaced by a single length count, and strings of non-zero pixels are preceded by a counter giving the length of the solid run. Read chapter "RLE sprites" for a description of the restrictions and how to obtain/use this structure.int w, h; - width and height in pixels int color_depth; - color depth of the image
See also: get_rle_sprite, BITMAP, COMPILED_SPRITE, RLE sprites.
Compiled sprites are stored as actual machine code instructions that draw a specific image onto a bitmap, using mov instructions with immediate data values. Read chapter "Compiled sprites" for a description of the restrictions and how to obtain/use this structure.short planar; - set if it's a planar (mode-X) sprite short color_depth; - color depth of the image short w, h; - size of the sprite
See also: get_compiled_sprite, BITMAP, RLE_SPRITE, Compiled sprites.
Read chapter "Joystick routines" for a description on how to obtain/use this structure.int flags; - status flags for this joystick int num_sticks; - how many stick inputs? int num_buttons; - how many buttons? JOYSTICK_STICK_INFO stick[n]; - stick state information JOYSTICK_BUTTON_INFO button[n]; - button state information
See also: joy, Joystick routines.
Read chapter "Joystick routines" for a description on how to obtain/use this structure.int b; - boolean on/off flag char *name; - description of this button
See also: joy, Joystick routines.
Read chapter "Joystick routines" for a description on how to obtain/use this structure.int flags; - status flags for this input int num_axis; - how many axes do we have? (note the misspelling) JOYSTICK_AXIS_INFO axis[n]; - axis state information char *name; - description of this input
See also: joy, Joystick routines.
Read chapter "Joystick routines" for a description on how to obtain/use this structure.int pos; - analogue axis position int d1, d2; - digital axis position char *name; - description of this axis
See also: joy, Joystick routines.
Structure returned by get_gfx_mode_list, which contains an array of GFX_MODE structures.int num_modes; GFX_MODE *mode;
See also: GFX_MODE, get_gfx_mode_list.
Structure contained in GFX_MODE_LIST.int width, height, bpp;
See also: GFX_MODE_LIST, get_gfx_mode_list.
See also: RGB, PALETTE, COLOR_MAP.
See also: RGB, Palette routines.
Examples using this: Available Allegro examples.
Palette entry. It contains an additional field for the purpose of padding but you should not usually care about it. Read chapter "Palette routines" for a description on how to obtain/use this structure.unsigned char r, g, b;
See also: Palette routines, PALETTE.
Examples using this: ex12bit, ex3d, excolmap, exconfig, expal, exrgbhsv, exscroll, exshade, extrans, extruec.
A vertex structure used by polygon3d and other polygon rendering functions. Read the description of polygon3d() for a description on how to obtain/use this structure.fixed x, y, z; - position fixed u, v; - texture map coordinates int c; - color
See also: V3D_f, polygon3d, Fixed point trig.
Examples using this: ex3d.
Like V3D but using float values instead of fixed ones. Read the description of polygon3d_f() for a description on how to obtain/use this structure.float x, y, z; - position float u, v; - texture map coordinates int c; - color
See also: V3D, polygon3d_f, Fixed point trig.
Examples using this: excamera, exscn3d, exzbuf.
Read chapter "Transparency and patterned drawing", section "256-color transparency" for a description on how to obtain/use this structure.unsigned char data[PAL_SIZE][PAL_SIZE];
See also: 256-color transparency, color_map.
Examples using this: ex3d, excolmap, exlights, exshade, extrans.
Read chapter "Converting between color formats" for a description on how to obtain/use this structure.unsigned char data[32][32][32];
See also: Converting between color formats, create_rgb_table.
Examples using this: ex3d, excolmap, exrgbhsv, exshade, extrans.
Read the description of al_findfirst for a description on how to obtain/use this structure.int attrib; - actual attributes of the file found time_t time; - modification time of file char name[512]; - name of file
See also: al_findfirst, al_ffblk_get_size.
Read chapter "Datafile routines", section "Using datafiles" for a description on how to obtain/use this structure.void *dat; - pointer to the actual data int type; - type of the data long size; - size of the data in bytes void *prop; - list of object properties
See also: load_datafile, Using datafiles.
Examples using this: excustom, exdata, exexedat, exgui, exsprite, exunicod.
Fixed point matrix structure. Read chapter "3D math routines" for a description on how to obtain/use this structure.fixed v[3][3]; - 3x3 scaling and rotation component fixed t[3]; - x/y/z translation component
See also: MATRIX_f, 3D math routines.
Examples using this: ex12bit, ex3d, exstars.
Floating point matrix structure. Read chapter "3D math routines" for a description on how to obtain/use this structure.float v[3][3]; - 3x3 scaling and rotation component float t[3]; - x/y/z translation component
See also: MATRIX, 3D math routines.
Examples using this: excamera, exquat, exscn3d, exzbuf.
Read chapter "Quaternion math routines" for a description on how to obtain/use this structure.float w, x, y, z;
See also: Quaternion math routines.
Examples using this: exquat.
This is the structure which contains a GUI object. Read chapter "GUI routines" for a description on how to obtain/use this structure.int (*proc)(int, DIALOG *, int); - dialog procedure (message handler) int x, y, w, h; - position and size of the object int fg, bg; - foreground and background colors int key; - ASCII keyboard shortcut int flags; - flags about the status of the object int d1, d2; - whatever you want to use them for void *dp, *dp2, *dp3; - pointers to more object-specific data
See also: do_dialog, GUI routines.
Examples using this: excustom, exgui, exrgbhsv.
Structure used to hold an entry of a menu. Read chapter "GUI routines", section "GUI menus" for a description on how to obtain/use this structure.char *text; - the text to display for the menu item int (*proc)(void); - called when the menu item is clicked struct MENU *child; - nested child menu int flags; - disabled or checked state void *dp; - pointer to any data you need
See also: do_menu, GUI menus.
Examples using this: exgui.
See also: init_dialog, update_dialog, shutdown_dialog, GUI routines.
See also: init_menu, update_menu, shutdown_menu, GUI menus.
See also: font.
Examples using this: excustom, exfont, exunicod.
See also: Zbuffered rendering, BITMAP.
Examples using this: exzbuf.
A sample structure, which holds sound data, used by the digital sample routines. You can consider all of these fields as read only except priority, loop_start and loop_end, which you can change them for example after loading a sample from disk.int bits; - 8 or 16 int stereo; - sample type flag int freq; - sample frequency int priority; - 0-255 unsigned long len; - length (in samples) unsigned long loop_start; - loop start position unsigned long loop_end; - loop finish position void *data; - raw sample data
The priority is a value from 0 to 255 (by default set to 128) and controls how hardware voices on the sound card are allocated if you attempt to play more than the driver can handle. This may be used to ensure that the less important sounds are cut off while the important ones are preserved.
The variables loop_start and loop_end specify the loop position in sample units, and are set by default to the start and end of the sample.
If you are creating your own samples on the fly, you might also want to modify the raw data of the sample pointed by the data field. The sample data are always in unsigned format. This means that if you are loading a PCM encoded sound file with signed 16-bit samples, you would have to XOR every two bytes (i.e. every sample value) with 0x8000 to change the signedness.
See also: load_sample, Digital sample routines, Voice control.
Examples using this: exsample.
See also: load_midi, Music routines (MIDI).
Examples using this: exmidi.
A structure holding an audiostream, which is a convenience wrapper around a SAMPLE structure to double buffer sounds too big to fit into memory, or do clever things like generating the sound wave real time.int voice; - the hardware voice used for the sample
While you shouldn't modify directly the value of the voice, you can use all of the voice functions in chapter "Digital sample routines" to modify the properties of the sound, like the frequency.
See also: play_audio_stream, Audio stream routines, Voice control.
Examples using this: exstream.
See also: File and compression routines, pack_fopen, pack_fopen_chunk, pack_fopen_vtable.
Examples using this: expackf.
This is the vtable which must be provided for custom packfiles, which then can read from and write to wherever you like (eg. files in memory). You should provide all the entries of the vtable, even if they are empty stubs doing nothing, to avoid Allegro (or you) calling a NULL method at some point.int pf_fclose(void *userdata); int pf_getc(void *userdata); int pf_ungetc(int c, void *userdata); long pf_fread(void *p, long n, void *userdata); int pf_putc(int c, void *userdata); long pf_fwrite(const void *p, long n, void *userdata); int pf_fseek(void *userdata, int offset); int pf_feof(void *userdata); int pf_ferror(void *userdata);
See also: File and compression routines, pack_fopen_vtable.
Examples using this: expackf.
See also: File and compression routines, create_lzss_pack_data.
See also: File and compression routines, create_lzss_unpack_data.