Code Search for Developers
 
 
  

exscale.c from Allegro game programming library at Krugle


Show exscale.c syntax highlighted

/*
 *    Example program for the Allegro library, by Grzegorz Ludorowski.
 *
 *    This example demonstrates how to use pcx files, palettes and stretch
 *    blits. It loads a pcx file, sets its palette and does some random
 *    stretch_blits. Don't worry - it's VERY slowed down using al_vsync().
 */


#include "allegro.h"



int main(int argc, char *argv[])
{
   AL_PALETTE my_palette;
   AL_BITMAP *scr_buffer;
   char pcx_name[256];

   allegro_init();
   al_install_keyboard();
   if (al_set_gfx_mode(AL_GFX_SAFE, 320, 200, 0, 0) != 0) {
      al_set_gfx_mode(AL_GFX_NONE, 0, 0, 0, 0);
      al_show_message("Unable to set any graphic mode\n%s\n", al_error);
      return 1;
   }

   al_replace_filename(pcx_name, argv[0], "mysha.pcx", sizeof(pcx_name));
   scr_buffer = al_load_pcx(pcx_name, my_palette);
   if (!scr_buffer) {
      al_set_gfx_mode(AL_GFX_NONE, 0, 0, 0, 0);
      al_show_message("Error loading %s!\n", pcx_name);
      return 1;
   }

   al_set_palette(my_palette);
   al_blit(scr_buffer, al_screen, 0, 0, 0, 0, scr_buffer->w, scr_buffer->h);

   while (!al_key_pressed()) {
      al_stretch(scr_buffer, al_screen, 0, 0, rand()%scr_buffer->w,
		   rand()%scr_buffer->h, rand()%AL_SCREEN_W, rand()%AL_SCREEN_H,
		   rand()%AL_SCREEN_W, rand()%AL_SCREEN_H);
      al_vsync();
   }

   al_destroy_bitmap(scr_buffer);
   return 0;
}

AL_END_OF_MAIN();




See more files for this project here

Allegro game programming library

Allegro is a cross-platform library intended for use in computer games and other types of multimedia programming.

Project homepage: http://sourceforge.net/projects/alleg
Programming language(s): Assembly,C,Shell Script
License: other

  allegro.pcx
  ex12bit.c
  ex3buf.c
  ex3d.c
  exaccel.c
  exalpha.c
  example.dat
  example.h
  examples.txt
  exbitmap.c
  exblend.c
  excamera.c
  excolmap.c
  excustom.c
  exdata.c
  exdbuf.c
  exdodgy.c
  exexedat.c
  exfixed.c
  exflame.c
  exflip.c
  exgui.c
  exhello.c
  exjoy.c
  exkeys.c
  exlights.c
  exmem.c
  exmidi.c
  exmouse.c
  expal.c
  expat.c
  exquat.c
  exrgbhsv.c
  exsample.c
  exscale.c
  exscn3d.c
  exscroll.c
  exshade.c
  exspline.c
  exsprite.c
  exstars.c
  exstream.c
  exswitch.c
  extimer.c
  extrans.c
  extruec.c
  exunicod.c
  exupdate.c
  exxfade.c
  exzbuf.c
  mysha.pcx
  planet.pcx
  running.dat
  running.h
  unifont.dat