2017-01-20 08:36:52 -05:00
|
|
|
#pragma once
|
|
|
|
|
2022-09-20 12:33:21 -04:00
|
|
|
#include "Terminus_4.49.1.ttf.hpp"
|
|
|
|
|
2017-01-19 16:23:59 -05:00
|
|
|
#define OUTPUT_HEIGHT 250
|
|
|
|
#define OUTPUT_MAX_TOP (OUTPUT_HEIGHT - (Console::Height - 2))
|
|
|
|
|
|
|
|
namespace Components
|
|
|
|
{
|
|
|
|
class Console : public Component
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Console();
|
|
|
|
~Console();
|
|
|
|
|
|
|
|
static void SetSkipShutdown();
|
|
|
|
|
|
|
|
static void FreeNativeConsole();
|
|
|
|
|
2017-02-10 03:50:08 -05:00
|
|
|
static HWND GetWindow();
|
|
|
|
|
2017-05-27 11:17:12 -04:00
|
|
|
static void ShowAsyncConsole();
|
|
|
|
|
2017-01-19 16:23:59 -05:00
|
|
|
private:
|
2022-09-20 12:33:21 -04:00
|
|
|
|
|
|
|
static constexpr int OUTPUT_BOX = 0x64;
|
|
|
|
static constexpr int INPUT_BOX = 0x65;
|
|
|
|
|
2017-01-19 16:23:59 -05:00
|
|
|
// Text-based console stuff
|
|
|
|
static WINDOW* OutputWindow;
|
|
|
|
static WINDOW* InputWindow;
|
|
|
|
static WINDOW* InfoWindow;
|
|
|
|
|
|
|
|
static int Width;
|
|
|
|
static int Height;
|
|
|
|
|
|
|
|
static int OutputTop;
|
|
|
|
static int OutBuffer;
|
|
|
|
static int LastRefresh;
|
|
|
|
|
2022-09-20 12:33:21 -04:00
|
|
|
static COLORREF TextColor;
|
|
|
|
static COLORREF BackgroundColor;
|
|
|
|
static HBRUSH ForegroundBrush;
|
|
|
|
static HBRUSH BackgroundBrush;
|
|
|
|
|
|
|
|
static HANDLE CustomConsoleFont;
|
|
|
|
|
2017-01-19 16:23:59 -05:00
|
|
|
static char LineBuffer[1024];
|
|
|
|
static char LineBuffer2[1024];
|
|
|
|
static int LineBufferIndex;
|
|
|
|
|
|
|
|
static bool HasConsole;
|
|
|
|
static bool SkipShutdown;
|
|
|
|
|
|
|
|
static std::thread ConsoleThread;
|
|
|
|
|
|
|
|
static Game::SafeArea OriginalSafeArea;
|
|
|
|
|
|
|
|
static void ShowPrompt();
|
|
|
|
static void RefreshStatus();
|
|
|
|
static void RefreshOutput();
|
|
|
|
static void ScrollOutput(int amount);
|
|
|
|
|
|
|
|
static const char* Input();
|
|
|
|
static void Print(const char* message);
|
2022-06-12 17:07:53 -04:00
|
|
|
static void Error(const char* fmt, ...);
|
2017-01-19 16:23:59 -05:00
|
|
|
static void Create();
|
|
|
|
static void Destroy();
|
|
|
|
|
|
|
|
static void StdOutPrint(const char* message);
|
2022-06-12 17:07:53 -04:00
|
|
|
static void StdOutError(const char* fmt, ...);
|
2017-01-19 16:23:59 -05:00
|
|
|
|
|
|
|
static void ConsoleRunner();
|
|
|
|
|
|
|
|
static void DrawSolidConsoleStub();
|
|
|
|
static void StoreSafeArea();
|
|
|
|
static void RestoreSafeArea();
|
|
|
|
|
2022-08-23 03:12:20 -04:00
|
|
|
static const char** GetAutoCompleteFileList(const char *path, const char *extension, Game::FsListBehavior_e behavior, int *numfiles, int allocTrackType);
|
2017-01-19 16:23:59 -05:00
|
|
|
|
2022-07-23 09:49:56 -04:00
|
|
|
static void Con_ToggleConsole();
|
|
|
|
static void AddConsoleCommand();
|
|
|
|
|
2022-03-08 07:20:28 -05:00
|
|
|
static Game::dvar_t* RegisterConColor(const char* dvarName, float r, float g, float b, float a, float min, float max, unsigned __int16 flags, const char* description);
|
2022-09-20 12:33:21 -04:00
|
|
|
|
|
|
|
static LRESULT CALLBACK ConWndProc(HWND hWnd, UINT Msg, WPARAM wParam, unsigned int lParam);
|
|
|
|
static ATOM CALLBACK RegisterClassHook(WNDCLASSA* lpWndClass);
|
|
|
|
static BOOL CALLBACK ResizeChildWindow(HWND hwndChild, LPARAM lParam);
|
|
|
|
static HFONT CALLBACK ReplaceFont(
|
|
|
|
int cHeight,
|
|
|
|
int cWidth,
|
|
|
|
int cEscapement,
|
|
|
|
int cOrientation,
|
|
|
|
int cWeight,
|
|
|
|
DWORD bItalic,
|
|
|
|
DWORD bUnderline,
|
|
|
|
DWORD bStrikeOut,
|
|
|
|
DWORD iCharSet,
|
|
|
|
DWORD iOutPrecision,
|
|
|
|
DWORD iClipPrecision,
|
|
|
|
DWORD iQuality,
|
|
|
|
DWORD iPitchAndFamily,
|
|
|
|
LPCSTR pszFaceName);
|
|
|
|
static void ApplyConsoleStyle();
|
|
|
|
static void GetWindowPos(HWND hWnd, int* x, int* y);
|
|
|
|
static void Sys_PrintStub();
|
|
|
|
static void MakeRoomForText(int addedCharacters);
|
|
|
|
static float GetDpiScale(const HWND hWnd);
|
2017-01-19 16:23:59 -05:00
|
|
|
};
|
|
|
|
}
|