OpenMoHAA 0.82.0
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
26 class Event;
27 class Listener;
28#endif
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34typedef int uihandle_t;
35typedef struct tiki_s tiki_t;
36/*typedef struct refEntity_t;
37typedef struct polyVert_t;
38typedef struct refdef_t;
39typedef struct glconfig_t;*/
40typedef struct fontheader_s fontheader_t;
41typedef struct AliasListNode_s AliasListNode_t;
42
43typedef 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
52typedef 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
69struct Event;
70struct Listener;
71#endif
72
73typedef struct uiimport_s {
74 uihandle_t( *Rend_RegisterMaterial )( const char *name );
75 uihandle_t( *Rend_RefreshMaterial )( const char *name );
76 void( *Rend_Set2D )( int x, int y, int w, int h, float left, float right, float bottom, float top, float n, float f );
77 void( *Rend_SetColor )( const vec4_t rgba );
78 void( *Rend_Scissor )( int x, int y, int width, int height );
79 void( *Rend_DrawPicStretched )( float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t hShader );
80 void( *Rend_DrawPicStretched2 )( float x, float y, float w, float h, float s1, float t1, float s2, float t2, float sx, float sy, qhandle_t hShader );
81 void( *Rend_DrawPicTiled )( float x, float y, float w, float h, qhandle_t hShader );
82 fontheader_t *( *Rend_LoadFont )( const char *name );
83 void( *Rend_DrawString )( fontheader_t *font, const char *text, float x, float y, int maxlen, const float *pvVirtualScreen );
84 void( *Rend_DrawBox )( float x, float y, float w, float h );
85 int( *Rend_GetShaderWidth )( qhandle_t hShader );
86 int( *Rend_GetShaderHeight )( qhandle_t hShader );
87 qboolean ( *Rend_ImageExists )( const char* name );
88#ifdef __cplusplus
89 void ( *File_PickFile )( const char *name, Listener *obj, Event& event );
90#else
91 void (*File_PickFile)(const char* name, struct Listener* obj, struct Event* event);
92#endif
93 void ( *File_ListFiles )( const char *filespec );
94 long ( *File_OpenFile )( const char *qpath, void **buffer );
95 void ( *File_FreeFile )( void *buffer );
96 void ( *File_WriteFile )( const char *qpath, const void *buffer, int size );
97 uihandle_t ( *Snd_RegisterSound )( const char *sample, qboolean streamed );
98 void ( *Snd_PlaySound )( const char *sound_name );
99 void ( *Snd_PlaySoundDialog )( const char *sound_name );
100 void ( *Snd_FadeSound )( float fTime );
101 void ( *Snd_StopAllSound )();
102 qboolean ( *Alias_Add )( const char *alias, const char *name, const char *parameters );
103 const char *( *Alias_FindRandom )( const char *alias, AliasListNode_t **ret );
104 const char *( *Cvar_GetString )( const char *name, const char *defval );
105 cvar_t *( *Cvar_Find )( const char *var_name );
106 void ( *Cvar_Set )( const char *var_name, const char *value );
107 void ( *Cvar_Reset )( const char *var_name );
108 void ( *Cmd_Stuff )( const char *text );
109 void ( *Sys_Printf )( const char *text, ... );
110 void ( *Sys_Error )( int error, const char *text, ... );
111 void ( *Sys_DPrintf )( const char *text, ... );
112 int ( *Sys_Milliseconds )();
113 int ( *Sys_IsKeyDown )( int key );
114 const char *( *Sys_GetClipboard )( void );
115 void( *Sys_SetClipboard )( const char *foo );
116 const char *( *Cmd_CompleteCommandByNumber )( const char *partial, int number );
117 const char *( *Cvar_CompleteCvarByNumber )( const char *partial, int number );
118 void( *UI_WantsKeyboard )( void );
119 const char *( *Client_TranslateWidgetName )( const char *widget );
120 void( *Connect )( const char *server, netadrtype_t family );
121 const char *( *Key_GetKeynameForCommand )( const char *command );
122 const char *( *Key_GetCommandForKey )( int keynum );
123 void ( *Key_SetBinding )( int keynum, const char *binding );
124 void ( *Key_GetKeysForCommand )( const char *command, int *key1, int *key2 );
125 const char *( *Key_KeynumToString )( int keynum );
126 const char *( *GetConfigstring )( int index );
127 void ( *UI_CloseDMConsole )( void );
128 void ( *GetClipboardData )( char *buf, int buflen );
129
130 //
131 // Added in OPM
132 //
133 int (*GetRefSequence)(void);
134 qboolean (*IsRendererLoaded)(void);
135 qboolean (*Rend_LoadRawImage)(const char *name, byte **pic, int *width, int *height);
136 void (*Rend_FreeRawImage)(byte *pic);
137} uiimport_t;
138
139#if 1
140typedef struct uiexport_s {
141 void ( *AddFileToList )( const char *name );
142 void ( *ResolutionChange )( void );
143 void ( *Init )( void );
144 void ( *Shutdown )( void );
145 int ( *FontStringWidth )( fontheader_t *pFont, const char *pszString, int iMaxLen );
146} uiexport_t;
147#else
148
149typedef struct uiexport_s {
150 void (*Init)( void );
151 void (*Shutdown)( void );
152 void (*KeyEvent)( int key, int down );
153 void (*MouseEvent)( int dx, int dy );
154 void (*Refresh)( int time );
155 void (*DrawHUD)( playerState_t *ps );
156 qboolean (*IsFullscreen)( void );
157 void (*SetActiveMenu)( uiMenuCommand_t menu );
158 qboolean (*ConsoleCommand)( int realTime );
159 void (*DrawConnectScreen)( qboolean overlay );
160 void (*AddFileToList)( const char *name );
161 void (*ResolutionChange)( void );
162 int (*FontStringWidth)( fontheader_t *pFont, const char *pszString, int iMaxLen );
163} uiexport_t;
164
165#endif
166
167typedef struct uidef_s {
168 int time;
169 int vidWidth;
170 int vidHeight;
171 int mouseX;
172 int mouseY;
173 unsigned int mouseFlags;
174 qboolean uiHasMouse;
175 qboolean bHighResScaling;
176 vec2_t scaleRes;
177} uidef_t;
178
179extern uidef_t uid;
180extern uiexport_t uie;
181extern uiimport_t uii;
182
183void UI_Init(void);
184void UI_Shutdown(void);
185void UI_InitExports();
186void UI_StartStageKeyEvent(void);
187void UI_GetMouseState( int *mouseX, int *mouseY, int *flags );
188int UI_GetCvarInt( const char *name, int def );
189float UI_GetCvarFloat( const char *name, float def );
190const char *UI_GetCvarString( const char *cvar, char *def );
191cvar_t *UI_FindCvar( const char *cvar );
192void UI_SetCvarInt( const char *cvar, int value );
193void UI_SetCvarFloat( const char *cvar, float value );
194void UI_ListFiles( const char *filespec );
195const char *UI_ConfigString( int index );
196void UI_UpdateCenterPrint(const char* s, float alpha);
197void UI_UpdateLocationPrint(int x, int y, const char* s, float alpha);
198void UI_SetupFiles(void);
199void UI_PrintConsole(const char* msg);
200void UI_PrintDeveloperConsole(const char* msg);
201
202#ifdef __cplusplus
203}
204#endif
Definition listener.h:246
Definition listener.h:450
Definition alias.h:40
Definition tr_types_new.h:57
Definition ui_public.h:43
Definition ui_public.h:167
Definition ui_public.h:140
Definition ui_public.h:73