Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 1 | pmbaty | 1 | /* |
| 2 | * Portions of this file are copyright Rebirth contributors and licensed as |
||
| 3 | * described in COPYING.txt. |
||
| 4 | * Portions of this file are copyright Parallax Software and licensed |
||
| 5 | * according to the Parallax license below. |
||
| 6 | * See COPYING.txt for license details. |
||
| 7 | |||
| 8 | THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX |
||
| 9 | SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO |
||
| 10 | END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A |
||
| 11 | ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS |
||
| 12 | IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS |
||
| 13 | SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE |
||
| 14 | FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE |
||
| 15 | CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS |
||
| 16 | AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. |
||
| 17 | COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. |
||
| 18 | */ |
||
| 19 | |||
| 20 | /* |
||
| 21 | * |
||
| 22 | * UI init and close functions. |
||
| 23 | * |
||
| 24 | */ |
||
| 25 | |||
| 26 | #include <stdio.h> |
||
| 27 | #include <stdlib.h> |
||
| 28 | #include <stdarg.h> |
||
| 29 | #include <string.h> |
||
| 30 | #include "maths.h" |
||
| 31 | #include "pstypes.h" |
||
| 32 | #include "gr.h" |
||
| 33 | #include "key.h" |
||
| 34 | #include "ui.h" |
||
| 35 | #include "mouse.h" |
||
| 36 | #include "dxxerror.h" |
||
| 37 | |||
| 38 | namespace dcx { |
||
| 39 | |||
| 40 | static int Initialized = 0; |
||
| 41 | |||
| 42 | color_palette_index CBLACK, CGREY, CWHITE, CBRIGHT, CRED; |
||
| 43 | |||
| 44 | grs_font_ptr ui_small_font; |
||
| 45 | |||
| 46 | int ui_init() |
||
| 47 | { |
||
| 48 | |||
| 49 | if (Initialized) return 1; |
||
| 50 | |||
| 51 | const grs_font *org_font = grd_curcanv->cv_font; |
||
| 52 | ui_small_font = gr_init_font(*grd_curcanv, "pc6x8.fnt"); |
||
| 53 | if (!ui_small_font) |
||
| 54 | { |
||
| 55 | Warning("Could not find pc6x8.fnt"); |
||
| 56 | return 0; |
||
| 57 | } |
||
| 58 | grd_curcanv->cv_font =org_font; |
||
| 59 | |||
| 60 | CBLACK = gr_find_closest_color( 1, 1, 1 ); |
||
| 61 | CGREY = gr_find_closest_color( 45, 45, 45 ); |
||
| 62 | CWHITE = gr_find_closest_color( 50, 50, 50 ); |
||
| 63 | CBRIGHT = gr_find_closest_color( 58, 58, 58 ); |
||
| 64 | CRED = gr_find_closest_color( 63, 0, 0 ); |
||
| 65 | |||
| 66 | //key_init(); |
||
| 67 | |||
| 68 | gr_set_fontcolor(*grd_curcanv, CBLACK, CWHITE); |
||
| 69 | |||
| 70 | ui_pad_init(); |
||
| 71 | |||
| 72 | atexit(ui_close ); |
||
| 73 | |||
| 74 | Initialized = 1; |
||
| 75 | |||
| 76 | return 1; |
||
| 77 | } |
||
| 78 | |||
| 79 | void ui_close() |
||
| 80 | { |
||
| 81 | if (Initialized) |
||
| 82 | { |
||
| 83 | Initialized = 0; |
||
| 84 | |||
| 85 | menubar_close(); |
||
| 86 | |||
| 87 | ui_pad_close(); |
||
| 88 | ui_small_font.reset(); |
||
| 89 | } |
||
| 90 | |||
| 91 | return; |
||
| 92 | } |
||
| 93 | |||
| 94 | } |