mirror of
https://github.com/YGGverse/hlsdk-portable.git
synced 2025-01-11 15:38:12 +00:00
Get vgui back for goldsource fullscreen support
This commit is contained in:
parent
34c577572b
commit
d904505f6a
@ -27,7 +27,12 @@ set (CLDLL_LIBRARY client)
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-write-strings -DLINUX -D_LINUX -Dstricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp -DCLIENT_WEAPONS -DCLIENT_DLL -w")
|
||||
if (GOLDSOURCE_SUPPORT)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DGOLDSOURCE_SUPPORT -lSDL2 -Wl,--no-undefined")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DGOLDSOURCE_SUPPORT -L${CMAKE_CURRENT_SOURCE_DIR}/.. -lSDL2 -Wl,--no-undefined")
|
||||
if (APPLE)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -l:vgui.dylib")
|
||||
else()
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -l:vgui.so")
|
||||
endif()
|
||||
endif()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}")
|
||||
|
||||
@ -96,7 +101,7 @@ set (CLDLL_SOURCES
|
||||
scoreboard.cpp
|
||||
MOTD.cpp)
|
||||
|
||||
include_directories (. hl/ ../dlls ../dlls/wpn_shared ../common ../engine ../pm_shared ../game_shared ../public)
|
||||
include_directories (. hl/ ../dlls ../dlls/wpn_shared ../common ../engine ../pm_shared ../game_shared ../public ../utils/vgui/include)
|
||||
|
||||
if(USE_VOICEMGR)
|
||||
#set(CLDLL_SOURCES
|
||||
|
@ -23,6 +23,13 @@
|
||||
#include "netadr.h"
|
||||
#include "parsemsg.h"
|
||||
|
||||
#if defined(GOLDSOURCE_SUPPORT) && (defined(_WIN32) || defined(__linux__) || defined(__APPLE__)) && (defined(__i386) || defined(_M_IX86))
|
||||
#define USE_VGUI_FOR_GOLDSOURCE_SUPPORT
|
||||
#include "VGUI_Panel.h"
|
||||
#include "VGUI_BorderLayout.h"
|
||||
#include "VGUI_App.h"
|
||||
#endif
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "pm_shared.h"
|
||||
@ -177,6 +184,46 @@ int *HUD_GetRect( void )
|
||||
return extent;
|
||||
}
|
||||
|
||||
#ifdef USE_VGUI_FOR_GOLDSOURCE_SUPPORT
|
||||
class TeamFortressViewport : public vgui::Panel
|
||||
{
|
||||
public:
|
||||
TeamFortressViewport(int x,int y,int wide,int tall);
|
||||
void Initialize( void );
|
||||
|
||||
virtual void paintBackground();
|
||||
void *operator new( size_t stAllocateBlock );
|
||||
};
|
||||
|
||||
static TeamFortressViewport* gViewPort = NULL;
|
||||
|
||||
TeamFortressViewport::TeamFortressViewport(int x, int y, int wide, int tall)
|
||||
{
|
||||
gViewPort = this;
|
||||
Initialize();
|
||||
}
|
||||
|
||||
void TeamFortressViewport::Initialize()
|
||||
{
|
||||
vgui::App::getInstance()->setCursorOveride( vgui::App::getInstance()->getScheme()->getCursor(vgui::Scheme::scu_none) );
|
||||
}
|
||||
|
||||
void TeamFortressViewport::paintBackground()
|
||||
{
|
||||
int wide, tall;
|
||||
getParent()->getSize( wide, tall );
|
||||
setSize( wide, tall );
|
||||
gEngfuncs.VGui_ViewportPaintBackground(HUD_GetRect());
|
||||
}
|
||||
|
||||
void *TeamFortressViewport::operator new( size_t stAllocateBlock )
|
||||
{
|
||||
void *mem = ::operator new( stAllocateBlock );
|
||||
memset( mem, 0, stAllocateBlock );
|
||||
return mem;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
==========================
|
||||
HUD_VidInit
|
||||
@ -190,7 +237,21 @@ so the HUD can reinitialize itself.
|
||||
int DLLEXPORT HUD_VidInit( void )
|
||||
{
|
||||
gHUD.VidInit();
|
||||
#ifdef USE_VGUI_FOR_GOLDSOURCE_SUPPORT
|
||||
vgui::Panel* root=(vgui::Panel*)gEngfuncs.VGui_GetPanel();
|
||||
root->setBgColor(128,128,0,0);
|
||||
root->setLayout(new vgui::BorderLayout(0));
|
||||
|
||||
if (gViewPort != NULL)
|
||||
{
|
||||
gViewPort->Initialize();
|
||||
}
|
||||
else
|
||||
{
|
||||
gViewPort = new TeamFortressViewport(0,0,root->getWide(),root->getTall());
|
||||
gViewPort->setParent(root);
|
||||
}
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -270,7 +331,10 @@ Called by engine every frame that client .dll is loaded
|
||||
*/
|
||||
|
||||
void DLLEXPORT HUD_Frame( double time )
|
||||
{ gEngfuncs.VGui_ViewportPaintBackground(HUD_GetRect());
|
||||
{
|
||||
#ifndef USE_VGUI_FOR_GOLDSOURCE_SUPPORT
|
||||
gEngfuncs.VGui_ViewportPaintBackground(HUD_GetRect());
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user