sdl.test
Class TestAnim

java.lang.Object
  |
  +--sdl.test.TestAnim

public class TestAnim
extends java.lang.Object

Demo of sprites with JSDL. The image path must be set before the test is compiled.

This demo makes use of JSDL bit blidding


   image = new SDLSurface("leeloo.bmp"); //background
   m_Bitmap = new SDLSurface("sail.bmp"); // sprite
   ... 

   int colorkey = image.mapRGB((byte)0,(byte)0,(byte)0);
   m_Bitmap.setColorKey(Video.SDL_SRCCOLORKEY,colorkey);
   ...

  //for each frame

   image.blitSurface(src,screen,dest);
   ...

   SDLRect src = new SDLRect(0,0,m_Bitmap.m_Width,m_Bitmap.m_Height);
   SDLRect dest = new SDLRect((int)(m_X - m_Bitmap.m_Width / 2), (int)(m_Y - m_Bitmap.m_Height / 2) ,m_Bitmap.m_Width,m_Bitmap.m_Height);
   
   m_Bitmap.blitSurface(src,screen,dest);
  


Constructor Summary
TestAnim(int w, int h, sdl.video.SDLSurface bitmap)
           
 
Method Summary
 void display(sdl.video.SDLSurface screen)
           
static void main(java.lang.String[] args)
           
 void move()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestAnim

public TestAnim(int w,
                int h,
                sdl.video.SDLSurface bitmap)
Method Detail

move

public void move()

display

public void display(sdl.video.SDLSurface screen)

main

public static void main(java.lang.String[] args)