Esempio n. 1
0
////////////////////////////////////////////////////////////
// TBitmap256Control
// -----------------
//  Display bitmap
void
TBitmap256Control::Paint (TDC& dc, BOOL erase, TRect& rect)
{
	TControl::Paint(dc, erase, rect);

	DisplayBitmap (dc, rect);
}
Esempio n. 2
0
void AnimateSprite(BUFFER *pBuffer, SPRITE *pSprite)
{
	// Display the currentBitmap indexed into the hBitmap array.
	// We then increase the current bitmap AFTER it displays with a "++"
	DisplayBitmap(pBuffer, pSprite->pBitmaps[pSprite->currentBitmap++], 
			pSprite->position.x, pSprite->position.y);

	// Check if we reached the end of the animation
	if(pSprite->currentBitmap >= pSprite->bitmapCount)
	{
		// Reset the currentBitmap to the beginning
		pSprite->currentBitmap = 0;
	}
}
Esempio n. 3
0
void Init(HWND hwnd)
{	
	// Create our double buffering
	CreateDoubleBuffering(&gBuffer, hwnd);

	// Load the monster
	LoadSprite(&gMonster, "monster.bmp", MONSTER_WIDTH, MONSTER_HEIGHT, MONSTER_FRAMES);
	// Set the sprites position
	SetSpritePosition(&gMonster, 100, 200);
	// Set the direction of the sprite
	SetSpriteState(&gMonster, EAST);
	// Set the X and Y speed of the monster
	SetSpriteSpeed(&gMonster, 8, 12);

	// Load the background image
	hBackground = LoadABitmap("background.bmp");
															
	// Set the backbuffer to white first (This clears the backbuffer)
	ClearScreen(gBuffer.hdcBack, gBuffer.scrnRect, WHITE_BRUSH);			

	// Display the background image
	DisplayBitmap(&gBuffer, hBackground, 0, 0);
}
Esempio n. 4
0
int main(int argc, char **argv) 
{
   int      forced;
   int      filetype;
   int      i;
   PBITMAP  pBmp;
   pid_t    pid;


   if ( argc==1 )
   {
      PrintHelp();
      return 1;      
   }

   filetype = UNKNOWN_FILETYPE;
   forced = 0;
   i = 1;
   while ( i < argc )
   {
      if ( argv[i][0]=='-' )
      {
         if (!strcmp(&argv[i][1],"pix"))
         {
            filetype = PIX_FILETYPE;
            forced = 1;
         }
         else if (!strcmp(&argv[i][1],"tiff") || !strcmp(&argv[i][1],"tif"))
         {
            filetype = TIFF_FILETYPE;
            forced = 1;
         }
         else if (!strcmp(&argv[i][1],"tga"))
         {
            filetype = TGA_FILETYPE;
            forced = 1;
         }
         else if (!strcmp(&argv[i][1],"iff"))
         {
            filetype = IFF_FILETYPE;
            forced = 1;
         }
         else if (!strcmp(&argv[i][1],"auto"))
         {
            filetype = UNKNOWN_FILETYPE;
            forced = 0;
         }
         else
         {
            PrintHelp();
            return 1;
         }
      }
      else
      {
         if ( !filetype )
         {
            filetype = GetFileType( argv[i] );
         }
         if ( filetype )
         {
            switch ( filetype )
            {
             case PIX_FILETYPE:
               pBmp = ReadPix( argv[i] );
               break;
             case TIFF_FILETYPE:
               pBmp = ReadTiff( argv[i], READTIFF_CONVERT16TO8 );
               break;
             case TGA_FILETYPE:
               pBmp = ReadTga( argv[i] );
               break;
             case IFF_FILETYPE:
               pBmp = ReadIff( argv[i], READIFF_CONVERT16TO8 );
               break;
             default:
               exit(1);
            }
   
            pid = fork();
            if ( pid < 0 )
            {
               printf( "Error:  fork()\n" );
               return 1;
            }
            else if ( pid==0 )
            {
               DisplayBitmap( pBmp, argv[i] );
               exit(1);
            }
            if (!forced)
            {
               filetype = UNKNOWN_FILETYPE;
            }
         }
         else
         {
            printf( "ERROR:  Unknown file type: %s.\n", argv[i] );
            PrintHelp();
         }
      }     
      i++;
   }

   return 0;
}