OpenMoHAA 0.82.1
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 } uiimport_t;
156
157#if 1
158 typedef struct uiexport_s {
159 void (*AddFileToList)(const char *name);
160 void (*ResolutionChange)(void);
161 void (*Init)(void);
162 void (*Shutdown)(void);
163 int (*FontStringWidth)(fontheader_t *pFont, const char *pszString, int iMaxLen);
164 } uiexport_t;
165#else
166
167typedef struct uiexport_s {
168 void (*Init)(void);
169 void (*Shutdown)(void);
170 void (*KeyEvent)(int key, int down);
171 void (*MouseEvent)(int dx, int dy);
172 void (*Refresh)(int time);
173 void (*DrawHUD)(playerState_t *ps);
174 qboolean (*IsFullscreen)(void);
175 void (*SetActiveMenu)(uiMenuCommand_t menu);
176 qboolean (*ConsoleCommand)(int realTime);
177 void (*DrawConnectScreen)(qboolean overlay);
178 void (*AddFileToList)(const char *name);
179 void (*ResolutionChange)(void);
180 int (*FontStringWidth)(fontheader_t *pFont, const char *pszString, int iMaxLen);
181} uiexport_t;
182
183#endif
184
185 typedef struct uidef_s {
186 int time;
187 int vidWidth;
188 int vidHeight;
189 int mouseX;
190 int mouseY;
191 unsigned int mouseFlags;
192 qboolean uiHasMouse;
193 qboolean bHighResScaling;
194 vec2_t scaleRes;
195 } uidef_t;
196
197 extern uidef_t uid;
198 extern uiexport_t uie;
199 extern uiimport_t uii;
200
201 void UI_Init(void);
202 void UI_Shutdown(void);
203 void UI_InitExports();
204 void UI_StartStageKeyEvent(void);
205 void UI_GetMouseState(int *mouseX, int *mouseY, int *flags);
206 int UI_GetCvarInt(const char *name, int def);
207 float UI_GetCvarFloat(const char *name, float def);
208 const char *UI_GetCvarString(const char *cvar, char *def);
209 cvar_t *UI_FindCvar(const char *cvar);
210 void UI_SetCvarInt(const char *cvar, int value);
211 void UI_SetCvarFloat(const char *cvar, float value);
212 void UI_ListFiles(const char *filespec);
213 const char *UI_ConfigString(int index);
214 void UI_UpdateCenterPrint(const char *s, float alpha);
215 void UI_UpdateLocationPrint(int x, int y, const char *s, float alpha);
216 void UI_SetupFiles(void);
217 void UI_PrintConsole(const char *msg);
218 void UI_PrintDeveloperConsole(const char *msg);
219
220#ifdef __cplusplus
221}
222#endif
Definition listener.h:246
Definition listener.h:450
Definition alias.h:39
Definition tr_types_new.h:57
Definition ui_public.h:43
Definition ui_public.h:185
Definition ui_public.h:158
Definition ui_public.h:73