Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
2240 connectés 

  FORUM HardWare.fr
  Programmation
  C++

  [Allegro] Animation / Sprite en 2D, théorie...

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

[Allegro] Animation / Sprite en 2D, théorie...

n°348774
antsite
Je me souviens
Posté le 01-04-2003 à 09:32:10  profilanswer
 

   Salut,
J'ai trouvé un exemple qui propose la méthode suivante pour animer un sprite:
 

Citation :


As you probably know, VIDEO RAM is much slower than "normal" RAM, so
 *  it's advisable to reduce VRAM blits to a minimum.
 *  So, drawing sprite on the screen (I mean in VRAM) and then clearing
 *  a background for him is not very fast. I've used a different method which
 *  is much faster, but require a bit more memory.
 *  I clear a buffer (it's a normal BITMAP), then I draw sprite to it, and
 *  after all I blit only one time this buffer to the screen. So, I'm using a
 *  single VRAM blit instead of blitting/clearing background and drawing
 *  a sprite on it. It's a good method even when I have to restore background.
 *  And of course, it completely remove 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.


 
j'ai fait un bête copier coller de son explication.
Je ne comprends pas trop lorsqu'il dit que c'est mieux que blitting/clearing background & drawing.
 
La théorie c'est quoi (sans parler d'allegro), pour déplacer un sprite par exemple?
 
on dessine dans le back buffer et après on blit à une certaine position. Si on blit juste un petit carré de la taille du sprite, ça écrase ce qu'il y a l'écran? Comment ensuite redessiner à la position précédente le background?
 
Je demande juste l'idée pour faire ça de la manière la plus optimisée possible! De plus si des personnes connaissent bien allegro, peut être pourront-ils m'indiquer des fonctions aidant à faire de l'animation de sprite... (draw_sprite,...)
si y a un exemple simple je suis aussi preneur, merci.
   ANT

mood
Publicité
Posté le 01-04-2003 à 09:32:10  profilanswer
 


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  C++

  [Allegro] Animation / Sprite en 2D, théorie...

 

Sujets relatifs
[JAVA][OpenGL][3DS] Animation d'objAnimation flash comment faire ?
Interfacage Allegro/MFC[C,Allegro] Afficher la liste des repertoires contenus sur le disque
théorie des langages[ théorie ] - L'algorithme le plus balèze que vous connaissez ?
[C, Allegro] Problème avec bitmaps !!pb avec allegro sous linux
[HTML] Précharger une animation flash avant de la lancertheorie des graphes et vocabulaire
Plus de sujets relatifs à : [Allegro] Animation / Sprite en 2D, théorie...


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR