OpenMoHAA ..
Loading...
Searching...
No Matches
ui_public.h
1/*
2===========================================================================
3Copyright (C) 2015 the OpenMoHAA team
4
5This file is part of OpenMoHAA source code.
6
7OpenMoHAA source code is free software; you can redistribute it
8and/or modify it under the terms of the GNU General Public License as
9published by the Free Software Foundation; either version 2 of the License,
10or (at your option) any later version.
11
12OpenMoHAA source code is distributed in the hope that it will be
13useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with OpenMoHAA source code; if not, write to the Free Software
19Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20===========================================================================
21*/
22
23#pragma once
24
25#ifdef __cplusplus
26class Event;
27class Listener;
28#endif
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34 typedef int uihandle_t;
35 typedef struct tiki_s tiki_t;
36 /*typedef struct refEntity_t;
37typedef struct polyVert_t;
38typedef struct refdef_t;
39typedef struct glconfig_t;*/
40 typedef struct fontheader_s fontheader_t;
41 typedef struct AliasListNode_s AliasListNode_t;
42
43 typedef struct {
44 connstate_t connState;
45 int connectPacketCount;
46 int clientNum;
47 char servername[MAX_STRING_CHARS];
48 char updateInfoString[MAX_STRING_CHARS];
49 char messageString[MAX_STRING_CHARS];
51
52 typedef enum {
53 UIMENU_NONE,
54 UIMENU_MAIN,
55 UIMENU_INGAME,
56 UIMENU_NEED_CD,
57 UIMENU_BAD_CD_KEY,
58 UIMENU_TEAM,
59 UIMENU_POSTGAME
60 } uiMenuCommand_t;
61
62#define SORT_HOST 0
63#define SORT_MAP 1
64#define SORT_CLIENTS 2
65#define SORT_GAME 3
66#define SORT_PING 4
67
68#ifndef __cplusplus
69 struct Event;
70 struct Listener;
71#endif
72
73 typedef struct uiimport_s {
74 uihandle_t (*Rend_RegisterMaterial)(const char *name);
75 uihandle_t (*Rend_RefreshMaterial)(const char *name);
76 void (*Rend_Set2D)(
77 int x, int y, int w, int h, float left, float right, float bottom, float top, float n, float f
78 );
79 void (*Rend_SetColor)(const vec4_t rgba);
80 void (*Rend_Scissor)(int x, int y, int width, int height);
81 void (*Rend_DrawPicStretched)(
82 float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t hShader
83 );
84 void (*Rend_DrawPicStretched2)(
85 float x,
86 float y,
87 float w,
88 float h,
89 float s1,
90 float t1,
91 float s2,
92 float t2,
93 float sx,
94 float sy,
95 qhandle_t hShader
96 );
97 void (*Rend_DrawPicTiled)(float x, float y, float w, float h, qhandle_t hShader);
98 fontheader_t *(*Rend_LoadFont)(const char *name);
99 void (*Rend_DrawString)(
100 fontheader_t *font, const char *text, float x, float y, int maxlen, const float *pvVirtualScreen
101 );
102 void (*Rend_DrawBox)(float x, float y, float w, float h);
103 int (*Rend_GetShaderWidth)(qhandle_t hShader);
104 int (*Rend_GetShaderHeight)(qhandle_t hShader);
105 qboolean (*Rend_ImageExists)(const char *name);
106#ifdef __cplusplus
107 void (*File_PickFile)(const char *name, Listener *obj, Event& event);
108#else
109 void (*File_PickFile)(const char *name, struct Listener *obj, struct Event *event);
110#endif
111 void (*File_ListFiles)(const char *filespec);
112 long (*File_OpenFile)(const char *qpath, void **buffer);
113 void (*File_FreeFile)(void *buffer);
114 void (*File_WriteFile)(const char *qpath, const void *buffer, int size);
115 uihandle_t (*Snd_RegisterSound)(const char *sample, qboolean streamed);
116 void (*Snd_PlaySound)(const char *sound_name);
117 void (*Snd_PlaySoundDialog)(const char *sound_name);
118 void (*Snd_FadeSound)(float fTime);
119 void (*Snd_StopAllSound)();
120 qboolean (*Alias_Add)(const char *alias, const char *name, const char *parameters);
121 const char *(*Alias_FindRandom)(const char *alias, AliasListNode_t **ret);
122 const char *(*Cvar_GetString)(const char *name, const char *defval);
123 cvar_t *(*Cvar_Find)(const char *var_name);
124 void (*Cvar_Set)(const char *var_name, const char *value);
125 void (*Cvar_Reset)(const char *var_name);
126 void (*Cmd_Stuff)(const char *text);
127 void (*Sys_Printf)(const char *text, ...);
128 void (*Sys_Error)(int error, const char *text, ...);
129 void (*Sys_DPrintf)(const char *text, ...);
130 int (*Sys_Milliseconds)();
131 int (*Sys_IsKeyDown)(int key);
132 const char *(*Sys_GetClipboard)(void);
133 void (*Sys_SetClipboard)(const char *foo);
134 const char *(*Cmd_CompleteCommandByNumber)(const char *partial, int number);
135 const char *(*Cvar_CompleteCvarByNumber)(const char *partial, int number);
136 void (*UI_WantsKeyboard)(void);
137 const char *(*Client_TranslateWidgetName)(const char *widget);
138 void (*Connect)(const char *server, netadrtype_t family);
139 const char *(*Key_GetKeynameForCommand)(const char *command);
140 const char *(*Key_GetCommandForKey)(int keynum);
141 void (*Key_SetBinding)(int keynum, const char *binding);
142 void (*Key_GetKeysForCommand)(const char *command, int *key1, int *key2);
143 const char *(*Key_KeynumToString)(int keynum);
144 const char *(*GetConfigstring)(int index);
145 void (*UI_CloseDMConsole)(void);
146 void (*GetClipboardData)(char *buf, int buflen);
147
148 //
149 // Added in OPM
150 //
151 int (*GetRefSequence)(void);
152 qboolean (*IsRendererLoaded)(void);
153 qboolean (*Rend_LoadRawImage)(const char *name, byte **pic, int *width, int *height);
154 void (*Rend_FreeRawImage)(byte *pic);
155
156 void (*Rend_Set2DStartTime)(float startTime);
157 } uiimport_t;
158
159#if 1
160 typedef struct uiexport_s {
161 void (*AddFileToList)(const char *name);
162 void (*ResolutionChange)(void);
163 void (*Init)(void);
164 void (*Shutdown)(void);
165 int (*FontStringWidth)(fontheader_t *pFont, const char *pszString, int iMaxLen);
166 } uiexport_t;
167#else
168
169typedef struct uiexport_s {
170 void (*Init)(void);
171 void (*Shutdown)(void);
172 void (*KeyEvent)(int key, int down);
173 void (*MouseEvent)(int dx, int dy);
174 void (*Refresh)(int time);
175 void (*DrawHUD)(playerState_t *ps);
176 qboolean (*IsFullscreen)(void);
177 void (*SetActiveMenu)(uiMenuCommand_t menu);
178 qboolean (*ConsoleCommand)(int realTime);
179 void (*DrawConnectScreen)(qboolean overlay);
180 void (*AddFileToList)(const char *name);
181 void (*ResolutionChange)(void);
182 int (*FontStringWidth)(fontheader_t *pFont, const char *pszString, int iMaxLen);
183} uiexport_t;
184
185#endif
186
187 typedef struct uidef_s {
188 int time;
189 int vidWidth;
190 int vidHeight;
191 int mouseX;
192 int mouseY;
193 unsigned int mouseFlags;
194 qboolean uiHasMouse;
195 qboolean bHighResScaling;
196 vec2_t scaleRes;
197 } uidef_t;
198
199 extern uidef_t uid;
200 extern uiexport_t uie;
201 extern uiimport_t uii;
202
203 void UI_Init(void);
204 void UI_Shutdown(void);
205 void UI_InitExports();
206 void UI_StartStageKeyEvent(void);
207 void UI_GetMouseState(int *mouseX, int *mouseY, int *flags);
208 int UI_GetCvarInt(const char *name, int def);
209 float UI_GetCvarFloat(const char *name, float def);
210 const char *UI_GetCvarString(const char *cvar, char *def);
211 cvar_t *UI_FindCvar(const char *cvar);
212 void UI_SetCvarInt(const char *cvar, int value);
213 void UI_SetCvarFloat(const char *cvar, float value);
214 void UI_ListFiles(const char *filespec);
215 const char *UI_ConfigString(int index);
216 void UI_UpdateCenterPrint(const char *s, float alpha);
217 void UI_UpdateLocationPrint(int x, int y, const char *s, float alpha);
218 void UI_SetupFiles(void);
219 void UI_PrintConsole(const char *msg);
220 void UI_PrintDeveloperConsole(const char *msg);
221
222#ifdef __cplusplus
223}
224#endif
Definition alias.h:39
Definition tr_types_new.h:57
Definition ui_public.h:43
Definition ui_public.h:187
Definition ui_public.h:160
Definition ui_public.h:73