forked from Avatarchik/cs16-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathudll_int.cpp
88 lines (73 loc) · 2.21 KB
/
udll_int.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*
dll_int.cpp - dll entry point
Copyright (C) 2010 Uncle Mike
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
#include "extdll.h"
#include "basemenu.h"
#include "utils.h"
ui_enginefuncs_t g_engfuncs;
ui_textfuncs_t g_textfuncs;
ui_globalvars_t *gpGlobals;
CMenu gMenu;
static UI_FUNCTIONS gFunctionTable =
{
UI_VidInit,
UI_Init,
UI_Shutdown,
UI_UpdateMenu,
UI_KeyEvent,
UI_MouseMove,
UI_SetActiveMenu,
UI_AddServerToList,
UI_GetCursorPos,
UI_SetCursorPos,
UI_ShowCursor,
UI_CharEvent,
UI_MouseInRect,
UI_IsVisible,
UI_CreditsActive,
UI_FinalCredits
};
#ifdef _WIN32
#define EXPORT __declspec(dllexport)
#else
#define EXPORT
#endif
//=======================================================================
// GetApi
//=======================================================================
extern "C" EXPORT int GetMenuAPI(UI_FUNCTIONS *pFunctionTable, ui_enginefuncs_t* pEngfuncsFromEngine, ui_globalvars_t *pGlobals)
{
if( !pFunctionTable || !pEngfuncsFromEngine )
{
return FALSE;
}
// copy HUD_FUNCTIONS table to engine, copy engfuncs table from engine
memcpy( pFunctionTable, &gFunctionTable, sizeof( UI_FUNCTIONS ));
memcpy( &g_engfuncs, pEngfuncsFromEngine, sizeof( ui_enginefuncs_t ));
memset( &g_textfuncs, 0, sizeof( ui_textfuncs_t ));
gpGlobals = pGlobals;
return TRUE;
}
extern "C" EXPORT int GiveTextAPI( ui_textfuncs_t* pTextfuncsFromEngine )
{
if( !pTextfuncsFromEngine )
{
return FALSE;
}
// copy HUD_FUNCTIONS table to engine, copy engfuncs table from engine
memcpy( &g_textfuncs, pTextfuncsFromEngine, sizeof( ui_textfuncs_t ));
return TRUE;
}
extern "C" EXPORT void AddTouchButtonToList( const char *name, const char *texture, const char *command, unsigned char *color, int flags )
{
UI_TouchButtons_AddButtonToList( name, texture, command, color, flags );
}