cs16-client-legacy/mainui/udll_int.cpp

89 lines
2.2 KiB
C++

/*
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 );
}