home *** CD-ROM | disk | FTP | other *** search
/ CD/PC Actual 4 / CD_ACTUAL_4.iso / share / lectores / gfp / example.pak / EXAMPLE.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1995-06-20  |  1.8 KB  |  117 lines

  1. {$G+}
  2. { this is an example for use the sprites in a programa }
  3. {          by Enrique Sanchez Martinez 1995 }
  4. program juego;
  5.  
  6. uses svga,crt,dos,graph;
  7.  
  8.  
  9.  
  10. var
  11.  
  12. f:file;
  13. x,y,size,I,result:word;
  14. sprite,fondo:pointer;
  15. nombrespr:string;
  16. REG:REGISTERS;
  17. PALL:ARRAY[0..767]OF BYTE;
  18.  
  19.  
  20.  
  21.  
  22.  
  23. procedure leerspr(nombrespr:string);
  24. begin
  25. IF POS('.',nombrespr)<1 THEN
  26. nombrespr:=nombrespr+'.SPR';
  27. {$I-}
  28. assign(F,nombrespr);
  29. reset(f,1);
  30. RESULT:=IORESULT;
  31. if RESULT <> 0 then
  32.    begin
  33.    Writeln(' ■ File '+nombrespr+' not found ');
  34.    halt(1);
  35.    end;
  36. {$I+}
  37. SIZE:=FILESIZE(F);
  38. GETMEM(SPRITE,SIZE);
  39. BLOCKREAD(F,SPRITE^,SIZE,SIZE);
  40. close(f);
  41. end;
  42.  
  43.  
  44.  
  45. procedure leerpall(nombrepal:string);
  46. begin
  47. IF POS('.',nombrepal)<1 THEN
  48. nombrepal:=nombrepal+'.PAL';
  49. {$I-}
  50. assign(F,nombrepal);
  51. reset(f,1);
  52. RESULT:=IORESULT;
  53. if RESULT <> 0 then
  54.    begin
  55.    Writeln(' ■ File '+nombrepal+' not found ');
  56.    halt(1);
  57.    end;
  58. {$I+}
  59. SIZE:=768;
  60. BLOCKREAD(F,pall,SIZE,SIZE);
  61. close(f);
  62. end;
  63.  
  64.  
  65. procedure ponpall;
  66. begin
  67. REG.AX:=$1012;
  68. REG.BX:=$00;
  69. REG.CX:=$100;
  70. REG.ES:=SEG(PALL);
  71. REG.DX:=OFS(PALL);
  72. INTR($10,REG);
  73. end;
  74.  
  75.  
  76.  
  77. begin
  78. leerspr('p1');
  79. GETMEM(fondo,2600);
  80. leerpall('pal1');
  81. inicia(0);
  82.  
  83.  
  84. ponpall;
  85. putimage(0,0,sprite^,normalput);
  86. leerspr('balaex');
  87. x:=10;
  88. y:=20;
  89. getimage(x,y,x+50,y+16,fondo^);
  90. putimage(x,y,sprite^,trans_copy_put);
  91. for x := 10 to 300 do
  92.     begin
  93.     putimage(x,y,fondo^,normalput);
  94.     getimage(x+1,y,x+51,y+16,fondo^);
  95.     putimage(x+1,y,sprite^,trans_copy_put);
  96.  
  97.     DELAY(20);
  98.     end;
  99.  
  100. leerspr('balaex');
  101. for x := 10 to 300 do
  102.     begin
  103.     putimage(x,y,sprite^,trans_copy_put);
  104.     end;
  105.  
  106. leerspr('bala');
  107. cleardevice;
  108. for i:=1 to 5 do
  109.     begin
  110.     for x := 10 to 300 do
  111.         begin
  112.         putimage(x,y,sprite^,normalput);
  113.         end;
  114.     end;
  115.  
  116. closegraph;
  117. end.