added main menus, improved shading
This commit is contained in:
@@ -1,11 +1,65 @@
|
||||
#include "console.h"
|
||||
#include "fgui/rect.h"
|
||||
#include "fgui/widget.h"
|
||||
#include "fgui/label.h"
|
||||
#include "filesystem.h"
|
||||
#include "rendering.h"
|
||||
#include "tier1/utlstring.h"
|
||||
#include "tier1/utlvector.h"
|
||||
#include "stdarg.h"
|
||||
|
||||
CUtlVector<ConVar*> g_convars;
|
||||
CUtlVector<ConCommand*> g_commands;
|
||||
|
||||
enum EConsoleMessageType
|
||||
{
|
||||
CONSOLE_MESSAGE_TYPE_MESSAGE,
|
||||
CONSOLE_MESSAGE_TYPE_WARNING,
|
||||
CONSOLE_MESSAGE_TYPE_ERROR,
|
||||
};
|
||||
|
||||
struct ConsoleMessage_t
|
||||
{
|
||||
EConsoleMessageType type;
|
||||
CUtlString szMessage;
|
||||
};
|
||||
|
||||
uint32_t g_nNumConsoleMessages = 0;
|
||||
ConsoleMessage_t g_consoleLog[1024];
|
||||
|
||||
void Msg( const char* message )
|
||||
{
|
||||
printf(message);
|
||||
g_consoleLog[g_nNumConsoleMessages] = {CONSOLE_MESSAGE_TYPE_MESSAGE, message};
|
||||
g_nNumConsoleMessages = (g_nNumConsoleMessages+1)%1024;
|
||||
|
||||
}
|
||||
|
||||
void Warning( const char* message )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Error( const char* message )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void IConsole::Init()
|
||||
{
|
||||
}
|
||||
|
||||
void IConsole::Frame()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void IConsole::Deinit()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void IConsole::RegisterVar( ConVar *cvar )
|
||||
{
|
||||
g_convars.AppendTail(cvar);
|
||||
@@ -267,3 +321,63 @@ void IConsole_Exec( int argc, char **argv)
|
||||
}
|
||||
|
||||
ConCommand IConsole_ExecCmd("exec", IConsole_Exec);
|
||||
|
||||
class CConsoleGUI: public CFGUI_Widget
|
||||
{
|
||||
public:
|
||||
CConsoleGUI();
|
||||
virtual void Event( FGUI_Event_t event ) override;
|
||||
virtual void Draw() override;
|
||||
virtual void Frame() override;
|
||||
private:
|
||||
CFGUI_Rect *m_pBackground = 0;
|
||||
CFGUI_Label *m_pLog = 0;
|
||||
};
|
||||
|
||||
bool console_bDrawUI = false;
|
||||
|
||||
CConsoleGUI::CConsoleGUI()
|
||||
{
|
||||
m_pBackground = new CFGUI_Rect();
|
||||
m_pBackground->SetBoxColor(0.13, 0.13, 0.13, 1);
|
||||
m_pBackground->SetSize(200, 200);
|
||||
m_pBackground->SetParent(this);
|
||||
|
||||
m_pLog = new CFGUI_Label();
|
||||
m_pLog->SetFont("fonts/IBMPlexMono-Regular");
|
||||
m_pLog->SetLabel("CONSOLE");
|
||||
m_pLog->SetGlyphSize(24);
|
||||
m_pLog->SetParent(this);
|
||||
};
|
||||
|
||||
void CConsoleGUI::Event( FGUI_Event_t event )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CConsoleGUI::Draw()
|
||||
{
|
||||
SetPosition(20, 20);
|
||||
m_pBackground->SetSize(g_nWindowWidth-40, g_nWindowHeight-40);
|
||||
m_pBackground->SetSize(g_nWindowWidth-40, g_nWindowHeight-40);
|
||||
}
|
||||
|
||||
void CConsoleGUI::Frame()
|
||||
{
|
||||
SetVisibility(console_bDrawUI);
|
||||
}
|
||||
|
||||
void IConsoleUI::Init()
|
||||
{
|
||||
new CConsoleGUI;
|
||||
};
|
||||
|
||||
void IConsoleUI::SetVisibility( bool bIsVisisble )
|
||||
{
|
||||
console_bDrawUI = bIsVisisble;
|
||||
}
|
||||
|
||||
bool IConsoleUI::IsVisibile()
|
||||
{
|
||||
return console_bDrawUI;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user