| 1 | /* |
| 2 | * Descent 3 |
| 3 | * Copyright (C) 2024 Parallax Software |
| 4 | * |
| 5 | * This program is free software: you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation, either version 3 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | |
| 18 | --- HISTORICAL COMMENTS FOLLOW --- |
| 19 | |
| 20 | * $Logfile: /DescentIII/Main/ui/UIlib.h $ |
| 21 | * $Revision: 14 $ |
| 22 | * $Date: 2/17/99 8:32p $ |
| 23 | * $Author: Samir $ |
| 24 | * |
| 25 | * UI Library internal header. |
| 26 | * |
| 27 | * $Log: /DescentIII/Main/ui/UIlib.h $ |
| 28 | * |
| 29 | * 14 2/17/99 8:32p Samir |
| 30 | * fixed bugs in remove gadget, added callbacks for attaching and |
| 31 | * detaching gadgets. |
| 32 | * |
| 33 | * 13 10/13/98 8:23p Samir |
| 34 | * added more keyboard input options. |
| 35 | * |
| 36 | * 12 6/05/98 5:35p Samir |
| 37 | * massive improvement in UI keyboard interface. |
| 38 | * |
| 39 | * 11 5/06/98 4:34p Samir |
| 40 | * added function to set ui screen resolution. |
| 41 | * |
| 42 | * 10 3/13/98 5:18p Jeff |
| 43 | * Added arrow character defines |
| 44 | * |
| 45 | * 9 3/05/98 6:40p Samir |
| 46 | * Implemented radio buttons. |
| 47 | * |
| 48 | * 8 2/13/98 6:35p Samir |
| 49 | * Added double click delay constant. |
| 50 | * |
| 51 | * 7 1/30/98 7:06p Samir |
| 52 | * Moved a lot of functions out to uixxx.h library files. |
| 53 | * |
| 54 | * 6 1/18/98 4:23p Samir |
| 55 | * Took out old bitmap management system for UI. |
| 56 | * |
| 57 | * 5 1/13/98 6:59p Jeff |
| 58 | * (Samir) moved defines from UIlib.h to ui.h. |
| 59 | * |
| 60 | * 4 1/13/98 4:32p Samir |
| 61 | * Made tUIInput a shared structure to be used by ui_DoFrame to return UI |
| 62 | * input values. |
| 63 | * |
| 64 | * 3 1/13/98 4:29p Samir |
| 65 | * Added some ID numbers and macros. |
| 66 | * |
| 67 | * 2 1/02/98 12:49p Samir |
| 68 | * Added ui_GetTextWidth. |
| 69 | * |
| 70 | * 1 12/30/97 4:37p Samir |
| 71 | * Initial revision |
| 72 | * |
| 73 | * $NoKeywords: $ |
| 74 | */ |
| 75 | |
| 76 | #ifndef UILIB_H |
| 77 | #define UILIB_H |
| 78 | |
| 79 | #include "ui.h" |
| 80 | #include "ddio.h" |
| 81 | |
| 82 | struct tUIOutput { |
| 83 | int id; // return value |
| 84 | UIGadget *gadget; // object that's linked to return value. |
| 85 | }; |
| 86 | |
| 87 | // ids internal to UI system |
| 88 | #define UID_UP 0 |
| 89 | #define UID_RIGHT 1 |
| 90 | #define UID_DOWN 2 |
| 91 | #define UID_LEFT 3 |
| 92 | |
| 93 | // constants |
| 94 | #define UI_SCROLL_REGION_EXTENT 40 |
| 95 | #define UI_LEFT_ARROW_CHAR 24 |
| 96 | #define UI_UP_ARROW_CHAR 25 |
| 97 | #define UI_RIGHT_ARROW_CHAR 26 |
| 98 | #define UI_DOWN_ARROW_CHAR 27 |
| 99 | #define UI_CHECKBOX_OFF_CHAR 28 |
| 100 | #define UI_CHECKBOX_ON_CHAR 29 |
| 101 | #define UI_RADIO_OFF_CHAR 30 |
| 102 | #define UI_RADIO_ON_CHAR 31 |
| 103 | |
| 104 | // user ouput structure |
| 105 | extern tUIOutput UI_output; |
| 106 | |
| 107 | extern float UI_aspect_x; |
| 108 | extern float UI_aspect_y; |
| 109 | |
| 110 | #define UI_X(_x) ((int)(UI_aspect_x * (_x))) |
| 111 | #define UI_Y(_y) ((int)(UI_aspect_y * (_y))) |
| 112 | |
| 113 | // retrieves input for user interface |
| 114 | bool ui_Poll(); |
| 115 | |
| 116 | // flushes out key input info currently in ui. |
| 117 | void ui_KeyFlush(); |
| 118 | |
| 119 | #endif |