-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Instead of using VGUI v1, it's better to rewrite the UI to VGUI v2 that Source uses, since v1 cannot resize images.
- Loading branch information
1 parent
f58d1c0
commit 7966f1e
Showing
17 changed files
with
263 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
|
||
#include "VGUI_Font.h" | ||
#include "VGUI_TextImage.h" | ||
|
||
#include <VGUI_StackLayout.h> | ||
|
||
#include "hud.h" | ||
#include "cl_util.h" | ||
#include "camera.h" | ||
#include "kbutton.h" | ||
#include "const.h" | ||
#include "vgui_TeamFortressViewport.h" | ||
#include "vgui_int.h" | ||
#include "vgui_worldmap.h" | ||
#include "vgui_loadtga.h" | ||
|
||
using namespace vgui; | ||
|
||
#define MOTD_TITLE_X XRES(16) | ||
#define MOTD_TITLE_Y YRES(16) | ||
|
||
#define MOTD_WINDOW_X XRES(112) | ||
#define MOTD_WINDOW_Y YRES(80) | ||
#define MOTD_WINDOW_SIZE_X XRES(424) | ||
#define MOTD_WINDOW_SIZE_Y YRES(312) | ||
|
||
static CImageLabel *_background = NULL; | ||
extern bool g_iVisibleMouse; | ||
|
||
//============================================================================== | ||
char* GetTGAWorldMap( const char* pszName ) | ||
{ | ||
static char gd[256]; | ||
sprintf( gd, "%s/gfx/vgui/worldmap/%s.tga", gEngfuncs.pfnGetGameDirectory(), pszName ); | ||
gEngfuncs.Con_Printf("----: GetTGAWorldMap :----\n"); | ||
gEngfuncs.Con_Printf("TGA: %s\n", gd); | ||
return gd; | ||
} | ||
|
||
//============================================================================== | ||
BitmapTGAWorldMap* LoadWorldMapForRes( const char* pImageName, int wide, int tall ) | ||
{ | ||
BitmapTGAWorldMap *pWorldTGA = vgui_LoadWorldMapTGA( GetTGAWorldMap( pImageName ) ); | ||
if ( pWorldTGA ) | ||
pWorldTGA->SetMapSzie( wide, tall ); | ||
return pWorldTGA; | ||
} | ||
|
||
//============================================================================== | ||
UIWorldMap::UIWorldMap(int iTrans, bool iRemoveMe, int x, int y, int wide, int tall) : CMenuPanel(iTrans, iRemoveMe, x, y, wide, tall) | ||
{ | ||
_worldmap1 = LoadWorldMapForRes( "worldmap", wide, tall ); | ||
_worldmap2 = LoadWorldMapForRes( "worldmap2", wide, tall ); | ||
|
||
// Create the Health Label | ||
_background = new CImageLabel( _worldmap1, 0, 0, ScreenWidth, ScreenHeight ); | ||
_background->setParent( this ); | ||
_background->setSize( ScreenWidth, ScreenHeight ); | ||
|
||
// BELOW THIS IS JUST DEBUG TEST | ||
// Get the scheme used for the Titles | ||
CSchemeManager* pSchemes = gViewPort->GetSchemeManager(); | ||
|
||
// schemes | ||
SchemeHandle_t hTitleScheme = pSchemes->getSchemeHandle( "Title Font" ); | ||
|
||
// color schemes | ||
int r, g, b, a; | ||
|
||
// Create the title | ||
Label* pLabel = new Label( "", MOTD_TITLE_X, MOTD_TITLE_Y ); | ||
pLabel->setParent(this); | ||
pLabel->setFont(pSchemes->getFont(hTitleScheme)); | ||
pLabel->setFont(Scheme::sf_primary1); | ||
|
||
pSchemes->getFgColor(hTitleScheme, r, g, b, a); | ||
pLabel->setFgColor(r, g, b, a); | ||
pLabel->setFgColor(Scheme::sc_primary1); | ||
pSchemes->getBgColor(hTitleScheme, r, g, b, a); | ||
pLabel->setBgColor(r, g, b, a); | ||
pLabel->setContentAlignment(vgui::Label::a_west); | ||
pLabel->setText("WorldMap: POTATO LAND"); | ||
|
||
CommandButton* pButton = new CommandButton(CHudTextMessage::BufferedLocaliseTextString("#Menu_OK"), XRES(16), tall - YRES(16) - BUTTON_SIZE_Y, CMENU_SIZE_X, BUTTON_SIZE_Y); | ||
pButton->addActionSignal(new CMenuHandler_TextWindow(HIDE_TEXTWINDOW)); | ||
pButton->setParent(this); | ||
} | ||
|
||
|
||
//============================================================================== | ||
void UIWorldMap::Initialize() | ||
{ | ||
gEngfuncs.Con_Printf("----: UIWorldMap >> Initialize :----\n"); | ||
} | ||
|
||
|
||
//============================================================================== | ||
void UIWorldMap::paintBackground() | ||
{ | ||
CMenuPanel::paintBackground(); | ||
|
||
int wide, tall; | ||
getParent()->getSize( wide, tall ); | ||
setSize( wide, tall ); | ||
|
||
_background->setSize( wide, tall ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
#pragma once | ||
|
||
#include <VGUI_Panel.h> | ||
#include <VGUI_Label.h> | ||
#include <VGUI_Button.h> | ||
#include <VGUI_BitmapTGA.h> | ||
|
||
class CMenuPanel; | ||
|
||
//============================================================================== | ||
class UIWorldMap : public CMenuPanel | ||
{ | ||
private: | ||
vgui::BitmapTGA *_worldmap1; | ||
vgui::BitmapTGA *_worldmap2; | ||
|
||
public: | ||
UIWorldMap(int iTrans, bool iRemoveMe, int x, int y, int wide, int tall); | ||
void Initialize(); | ||
|
||
virtual void paintBackground(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
|
||
#include "extdll.h" | ||
#include "util.h" | ||
#include "cbase.h" | ||
#include "triggers.h" | ||
#include "player.h" | ||
#include "UserMessages.h" | ||
|
||
class CItemWorldMap : public CBaseTrigger | ||
{ | ||
public: | ||
void Spawn() override; | ||
void EXPORT OnUse(CBaseEntity* pActivator, CBaseEntity* pCaller, USE_TYPE useType, float value); | ||
}; | ||
LINK_ENTITY_TO_CLASS( item_worldmap, CItemWorldMap ); | ||
|
||
void CItemWorldMap::OnUse( CBaseEntity* pActivator, CBaseEntity* pCaller, USE_TYPE useType, float value ) | ||
{ | ||
MESSAGE_BEGIN( MSG_ALL, gmsgWorldMap ); | ||
MESSAGE_END(); | ||
} | ||
|
||
void CItemWorldMap::Spawn() | ||
{ | ||
InitTrigger(); | ||
SetUse( &CItemWorldMap::OnUse ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Oops, something went wrong.