home *** CD-ROM | disk | FTP | other *** search
/ Amiga ACS 1998 #6 / amigaacscoverdisc1998-061998.iso / games / descent / source / 2d / fdraw.c < prev    next >
Text File  |  1998-06-08  |  2KB  |  74 lines

  1. /*
  2. THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
  3. SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
  4. END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
  5. ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
  6. IN USING, DISPLAYING,  AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
  7. SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
  8. FREE PURPOSES.  IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
  9. CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES.  THE END-USER UNDERSTANDS
  10. AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.  
  11. COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
  12. */
  13. #include <stdlib.h>
  14. #include <stdio.h>
  15. #include <conio.h>
  16. #include <math.h>
  17. #include <string.h>
  18.  
  19. #include "gr.h"
  20. #include "key.h"
  21. #include "timer.h"
  22. #include "grdef.h"
  23. #include "mono.h"
  24. #include "fix.h"
  25. #include "iff.h"
  26. #include "palette.h"
  27. #include "rle.h"
  28. #include "pcx.h"
  29.  
  30. main(int argc, char * argv[] )
  31. {
  32.     int y;
  33.     FILE * fp;
  34.     char line[200];
  35.     grs_font * font;
  36.     
  37.     if ( argc < 2 )    {
  38.         printf( "Usage: fdraw fontfile textfile outfile.pcx\n" );
  39.         printf( " example: fdraw font3-1.fnt config.sys config.pcx\n" );
  40.         printf( "Requires PALETTE.256 to be in current directory\n" );
  41.         exit(1);
  42.     }
  43.  
  44.     fp = fopen( argv[2], "rt" );
  45.     if ( fp == NULL )    {
  46.         printf( "Error opening text file '%s'\n", argv[2] );
  47.         exit(1);
  48.     }
  49.  
  50.     gr_init( SM_320x200C );
  51.    gr_use_palette_table( "PALETTE.256" );
  52.     gr_palette_load( gr_palette );
  53.  
  54.     font = gr_init_font( argv[1] );
  55.     gr_set_fontcolor( gr_getcolor( 0,63,0), gr_getcolor(0,0,0) );
  56.     if ( font == NULL )    {
  57.         printf( "Error opening font file '%s'\n", argv[1] );
  58.         exit(1);
  59.     }
  60.  
  61.     y = 0;
  62.     while (fgets(line, 200, fp)) {
  63.         gr_string( 0, y, line );
  64.         y += font->ft_h+1;
  65.     }
  66.  
  67.     getch();
  68.  
  69.     pcx_write_bitmap( argv[3], &grd_curcanv->cv_bitmap, gr_palette );
  70. }
  71.  
  72.  
  73. 
  74.