UI.C 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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. /*
  14. * $Source: f:/miner/source/ui/rcs/ui.c $
  15. * $Revision: 1.9 $
  16. * $Author: john $
  17. * $Date: 1994/11/13 15:37:18 $
  18. *
  19. * UI init and close functions.
  20. *
  21. * $Log: ui.c $
  22. * Revision 1.9 1994/11/13 15:37:18 john
  23. * Made ui_close not close key and mouse.
  24. *
  25. * Revision 1.8 1994/10/27 09:58:53 john
  26. * *** empty log message ***
  27. *
  28. * Revision 1.7 1994/10/27 09:43:00 john
  29. * Fixed colors after removing gr_inverse_table.
  30. *
  31. * Revision 1.6 1994/09/23 14:57:41 john
  32. * Took out calls to init_mouse and init_keyboard.
  33. *
  34. * Revision 1.5 1993/12/10 14:16:45 john
  35. * made buttons have 2 user-functions.
  36. *
  37. * Revision 1.4 1993/12/07 12:31:32 john
  38. * new version.
  39. *
  40. * Revision 1.3 1993/10/26 13:46:12 john
  41. * *** empty log message ***
  42. *
  43. * Revision 1.2 1993/10/05 17:31:55 john
  44. * *** empty log message ***
  45. *
  46. * Revision 1.1 1993/09/20 10:35:49 john
  47. * Initial revision
  48. *
  49. *
  50. */
  51. #pragma off (unreferenced)
  52. static char rcsid[] = "$Id: ui.c 1.9 1994/11/13 15:37:18 john Exp $";
  53. #pragma on (unreferenced)
  54. #include <stdio.h>
  55. #include <stdlib.h>
  56. #include <stdarg.h>
  57. #include <string.h>
  58. #include <dos.h>
  59. #include "fix.h"
  60. #include "types.h"
  61. #include "gr.h"
  62. #include "key.h"
  63. #include "ui.h"
  64. #include "mouse.h"
  65. #include "mono.h"
  66. extern void InstallErrorHandler();
  67. static int Initialized = 0;
  68. unsigned char CBLACK,CGREY,CWHITE,CBRIGHT,CRED;
  69. grs_font * ui_small_font = NULL;
  70. void ui_init()
  71. {
  72. grs_font * org_font;
  73. if (Initialized) return;
  74. Initialized = 1;
  75. org_font = grd_curcanv->cv_font;
  76. ui_small_font = gr_init_font( "pc6x8.fnt" );
  77. grd_curcanv->cv_font =org_font;
  78. CBLACK = gr_find_closest_color( 1, 1, 1 );
  79. CGREY = gr_find_closest_color( 45, 45, 45 );
  80. CWHITE = gr_find_closest_color( 50, 50, 50 );
  81. CBRIGHT = gr_find_closest_color( 58, 58, 58 );
  82. CRED = gr_find_closest_color( 63, 0, 0 );
  83. //key_init();
  84. ui_mouse_init();
  85. gr_set_fontcolor( CBLACK, CWHITE );
  86. CurWindow = NULL;
  87. InstallErrorHandler();
  88. ui_pad_init();
  89. atexit(ui_close );
  90. }
  91. void ui_close()
  92. {
  93. if (Initialized)
  94. {
  95. Initialized = 0;
  96. ui_pad_close();
  97. ui_mouse_close();
  98. // mouse_close();
  99. // key_close();
  100. _harderr( NULL );
  101. gr_close_font( ui_small_font );
  102. }
  103. return;
  104. }
  105.