| 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 | |
| 19 | |
| 20 | |
| 21 | #ifndef UIDRAW_H |
| 22 | #define UIDRAW_H |
| 23 | |
| 24 | // Graphics Primatives. |
| 25 | void ui_StartDraw(int left, int top, int right, int bottom); |
| 26 | void ui_EndDraw(); |
| 27 | |
| 28 | // sets text clipping within the startdraw region |
| 29 | void ui_SetTextClip(int left, int top, int right, int bottom); |
| 30 | void ui_ResetTextClip(); |
| 31 | |
| 32 | // draw primatives |
| 33 | void ui_DrawSetAlpha(uint8_t alpha); |
| 34 | void ui_DrawLine(ddgr_color color, int x1, int y1, int x2, int y2); |
| 35 | void ui_DrawBox(ddgr_color, int l, int t, int r, int b); |
| 36 | void ui_DrawLTBox(ddgr_color lt_col, ddgr_color rb_col, int l, int t, int r, int b); |
| 37 | void ui_DrawRect(ddgr_color, int l, int t, int r, int b); |
| 38 | |
| 39 | // draws all textures derived from ui_bm_handle. |
| 40 | void ui_DrawBitmap(UIBitmapItem *bi, int x, int y, uint8_t alpha); |
| 41 | int ui_GetBitmapWidth(UIBitmapItem *bi); |
| 42 | int ui_GetBitmapHeight(UIBitmapItem *bi); |
| 43 | |
| 44 | // sets font for text drawing. |
| 45 | void ui_DrawSetFont(int handle); |
| 46 | int ui_DrawGetFont(); |
| 47 | int ui_GetFontHeight(); |
| 48 | void ui_SetCharAlpha(uint8_t alpha); |
| 49 | int ui_GetTextWidth(const char *text); |
| 50 | int ui_GetTextHeight(const char *text); |
| 51 | |
| 52 | #define UI_TEXTTYPE_SATURATE 1 |
| 53 | #define UI_TEXTTYPE_SHADOW 2 |
| 54 | void ui_DrawSetTextType(int type); |
| 55 | |
| 56 | // draws a line of text. |
| 57 | void ui_DrawString(ddgr_color col, int x, int y, const char *str); |
| 58 | void ui_DrawCenteredString(ddgr_color col, int xoff, int y, const char *str); |
| 59 | |
| 60 | #endif |