1 /** @file hu_lib.h  HUD widget library.
2  *
3  * @authors Copyright © 2005-2017 Jaakko Keränen <jaakko.keranen@iki.fi>
4  * @authors Copyright © 2005-2014 Daniel Swanson <danij@dengine.net>
5  *
6  * @par License
7  * GPL: http://www.gnu.org/licenses/gpl.html
8  *
9  * <small>This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by the
11  * Free Software Foundation; either version 2 of the License, or (at your
12  * option) any later version. This program is distributed in the hope that it
13  * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
14  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
15  * Public License for more details. You should have received a copy of the GNU
16  * General Public License along with this program; if not, write to the Free
17  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18  * 02110-1301 USA</small>
19  */
20 
21 #ifndef LIBCOMMON_GUI_LIBRARY_H
22 #define LIBCOMMON_GUI_LIBRARY_H
23 
24 #include "hud/hudwidget.h"
25 
26 // TODO If HudElementName needs to be this specific, then it it needs to be refactored
27 //      in to something that's not an enum.
28 //      If HudElementName is the means to refer to hud elements, and plugins can create their
29 //      own, then this is severely broken
30 enum HudElementName
31 {
32     GUI_NONE,
33     GUI_BOX,
34     GUI_GROUP,
35     GUI_HEALTH,
36     GUI_ARMOR,
37     GUI_KEYS,
38     GUI_READYAMMO,
39     GUI_FRAGS,
40     GUI_LOG,
41     GUI_CHAT,
42     GUI_AMMO,
43     GUI_MAXAMMO,
44     GUI_WEAPONSLOT,
45     GUI_FACE,
46     GUI_HEALTHICON,
47     GUI_ARMORICON,
48 #if __JHERETIC__
49     GUI_TOME,
50 #endif
51 #if __JHEXEN__
52     GUI_ARMORICONS,
53     GUI_WEAPONPIECES,
54     GUI_BLUEMANAICON,
55     GUI_BLUEMANA,
56     GUI_BLUEMANAVIAL,
57     GUI_GREENMANAICON,
58     GUI_GREENMANA,
59     GUI_GREENMANAVIAL,
60     GUI_BOOTS,
61     GUI_SERVANT,
62     GUI_DEFENSE,
63     GUI_WORLDTIME,
64 #endif
65     GUI_READYAMMOICON,
66     GUI_KEYSLOT,
67     GUI_SECRETS,
68     GUI_ITEMS,
69     GUI_KILLS,
70 #if __JHERETIC__ || __JHEXEN__
71     GUI_INVENTORY,
72     GUI_CHAIN,
73     GUI_READYITEM,
74     GUI_FLIGHT,
75 #endif
76     GUI_AUTOMAP
77 };
78 
79 void GUI_Register();
80 
81 void GUI_Init();
82 void GUI_Shutdown();
83 void GUI_LoadResources();
84 void GUI_ReleaseResources();
85 
86 HudWidget *GUI_TryFindWidgetById(uiwidgetid_t id);
87 
88 HudWidget &GUI_FindWidgetById(uiwidgetid_t id);
89 
90 HudWidget *GUI_AddWidget(HudWidget *wi);
91 
92 void GUI_UpdateWidgetGeometry(HudWidget *wi);
93 
94 void GUI_DrawWidget(HudWidget *wi, Point2Raw const *origin);
95 void GUI_DrawWidgetXY(HudWidget *wi, int x, int y);
96 
97 void GUI_SpriteSize(int sprite, float scale, int *width, int *height);
98 
99 enum hotloc_t
100 {
101     HOT_TLEFT,
102     HOT_TRIGHT,
103     HOT_BRIGHT,
104     HOT_BLEFT,
105     HOT_B,
106     HOT_LEFT
107 };
108 
109 void GUI_DrawSprite(int sprite, float x, float y, hotloc_t hotspot, float scale, float alpha,
110     dd_bool flip, int *drawnWidth, int *drawnHeight);
111 
112 struct ui_rendstate_t
113 {
114     float pageAlpha;
115 };
116 
117 DENG_EXTERN_C ui_rendstate_t const *uiRendState;
118 
119 #endif  // LIBCOMMON_UI_LIBRARY_H
120