FDRAW.C 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. #include "gr.h"
  19. #include "key.h"
  20. #include "timer.h"
  21. #include "grdef.h"
  22. #include "mono.h"
  23. #include "fix.h"
  24. #include "iff.h"
  25. #include "palette.h"
  26. #include "rle.h"
  27. #include "pcx.h"
  28. main(int argc, char * argv[] )
  29. {
  30. int y;
  31. FILE * fp;
  32. char line[200];
  33. grs_font * font;
  34. if ( argc < 2 ) {
  35. printf( "Usage: fdraw fontfile textfile outfile.pcx\n" );
  36. printf( " example: fdraw font3-1.fnt config.sys config.pcx\n" );
  37. printf( "Requires PALETTE.256 to be in current directory\n" );
  38. exit(1);
  39. }
  40. fp = fopen( argv[2], "rt" );
  41. if ( fp == NULL ) {
  42. printf( "Error opening text file '%s'\n", argv[2] );
  43. exit(1);
  44. }
  45. gr_init( SM_320x200C );
  46. gr_use_palette_table( "PALETTE.256" );
  47. gr_palette_load( gr_palette );
  48. font = gr_init_font( argv[1] );
  49. gr_set_fontcolor( gr_getcolor( 0,63,0), gr_getcolor(0,0,0) );
  50. if ( font == NULL ) {
  51. printf( "Error opening font file '%s'\n", argv[1] );
  52. exit(1);
  53. }
  54. y = 0;
  55. while (fgets(line, 200, fp)) {
  56. gr_string( 0, y, line );
  57. y += font->ft_h+1;
  58. }
  59. getch();
  60. pcx_write_bitmap( argv[3], &grd_curcanv->cv_bitmap, gr_palette );
  61. }
  62.