exsprite - Online Linux Manual PageSection : 3
Updated : version 4.4.3
Source : Allegro
Note : Allegro manual

NAMEexsprite − Datafiles access and sprite animation. Allegro game programming library.​

SYNOPSIS#include <allegro.h> Example exsprite

DESCRIPTIONThis example demonstrates how to use datafiles, various sprite drawing routines and flicker-free animation. 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. 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. 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. 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.

SEE ALSOBITMAP(3), DATAFILE(3), END_OF_FUNCTION(3), END_OF_MAIN(3), LOCK_FUNCTION(3), LOCK_VARIABLE(3), SCREEN_H(3), SCREEN_W(3), allegro_error(3), allegro_init(3), allegro_message(3), blit(3), circle(3), clear_bitmap(3), clear_keybuf(3), create_bitmap(3), destroy_bitmap(3), draw_sprite(3), draw_sprite_h_flip(3), draw_sprite_v_flip(3), draw_sprite_vh_flip(3), fixed(3), font(3), hline(3), install_int_ex(3), install_keyboard(3), install_sound(3), install_timer(3), itofix(3), key(3), keypressed(3), load_datafile(3), makecol(3), palette_color(3), pivot_sprite(3), pivot_sprite_v_flip(3), play_sample(3), rectfill(3), replace_filename(3), rest(3), screen(3), set_gfx_mode(3), set_palette(3), text_height(3), textout_centre_ex(3), unload_datafile(3), vsync(3)
0
Johanes Gumabo
Data Size   :   11,001 byte
man-exsprite.3Build   :   2024-12-05, 20:55   :  
Visitor Screen   :   x
Visitor Counter ( page / site )   :   2 / 203,432
Visitor ID   :     :  
Visitor IP   :   3.138.137.244   :  
Visitor Provider   :   AMAZON-02   :  
Provider Position ( lat x lon )   :   39.962500 x -83.006100   :   x
Provider Accuracy Radius ( km )   :   1000   :  
Provider City   :   Columbus   :  
Provider Province   :   Ohio ,   :   ,
Provider Country   :   United States   :  
Provider Continent   :   North America   :  
Visitor Recorder   :   Version   :  
Visitor Recorder   :   Library   :  
Online Linux Manual Page   :   Version   :   Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page   :   Library   :   lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page   :   Library   :   lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base   :   Version   :   Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base   :   Library   :   lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36

Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.