mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
ImGui drawing code now takes place in the main thread, a snapshot of the render data is created in CMaterialSystem::SwapBuffers(), and is being rendered in the render thread right before SpinPresent(). The reason why this was necessary, is because ConVar::GetString() isn't thread safe if its not marked FCVAR_MATERIAL_SYSTEM_THREAD or FCVAR_ACCESSIBLE_FROM_THREADS, and we used it for the console suggestions window, which iterates over every ConVar, accessible from threads or not.
88 lines
2.3 KiB
C++
88 lines
2.3 KiB
C++
#pragma once
|
|
#ifndef DEDICATED
|
|
#include "common/sdkdefs.h"
|
|
#include "windows/resource.h"
|
|
#include "networksystem/serverlisting.h"
|
|
#include "networksystem/pylon.h"
|
|
#include "public/isurfacesystem.h"
|
|
#include "thirdparty/imgui/misc/imgui_utility.h"
|
|
|
|
class CBrowser : public IDebugSurface
|
|
{
|
|
public:
|
|
CBrowser(void);
|
|
virtual ~CBrowser(void);
|
|
|
|
virtual bool Init(void);
|
|
virtual void Think(void);
|
|
|
|
virtual void RunFrame(void);
|
|
virtual void RunTask(void);
|
|
|
|
virtual void DrawSurface(void);
|
|
|
|
void BrowserPanel(void);
|
|
void RefreshServerList(void);
|
|
|
|
void HiddenServersModal(void);
|
|
void HostPanel(void);
|
|
|
|
void UpdateHostingStatus(void);
|
|
void InstallHostingDetails(const bool postFailed, const char* const hostMessage, const char* const hostToken, const string& hostIp);
|
|
void SendHostingPostRequest(const NetGameServer_t& gameServer);
|
|
|
|
void ProcessCommand(const char* pszCommand) const;
|
|
|
|
virtual void SetStyleVar(void);
|
|
|
|
inline bool IsVisible() { return m_flFadeAlpha > 0.0f; }
|
|
|
|
public:
|
|
// Command callbacks
|
|
static void ToggleBrowser_f();
|
|
|
|
const char* m_pszBrowserLabel;
|
|
bool m_bActivate;
|
|
|
|
private:
|
|
inline void SetServerListMessage(const char* const message) { m_svServerListMessage = message; };
|
|
inline void SetHostMessage(const char* const message) { m_svHostMessage = message; }
|
|
inline void SetHostToken(const char* const message) { m_svHostToken = message; }
|
|
|
|
private:
|
|
bool m_bInitialized;
|
|
bool m_bReclaimFocus;
|
|
bool m_bReclaimFocusTokenField;
|
|
bool m_bQueryListNonRecursive; // When set, refreshes the server list once the next frame.
|
|
bool m_bQueryGlobalBanList;
|
|
char m_szServerAddressBuffer[128];
|
|
char m_szServerEncKeyBuffer[30];
|
|
float m_flFadeAlpha;
|
|
|
|
ID3D11ShaderResourceView* m_idLockedIcon;
|
|
MODULERESOURCE m_rLockedIconBlob;
|
|
|
|
////////////////////
|
|
// Server List //
|
|
////////////////////
|
|
ImGuiTextFilter m_imServerBrowserFilter;
|
|
string m_svServerListMessage;
|
|
|
|
////////////////////
|
|
// Host Server //
|
|
////////////////////
|
|
string m_svHostMessage;
|
|
string m_svHostToken;
|
|
ImVec4 m_HostMessageColor;
|
|
|
|
////////////////////
|
|
// Private Server //
|
|
////////////////////
|
|
string m_svHiddenServerRequestMessage;
|
|
ImVec4 m_ivHiddenServerMessageColor;
|
|
|
|
ImGuiStyle_t m_Style;
|
|
};
|
|
|
|
extern CBrowser g_Browser;
|
|
#endif |