2024-04-05 18:22:56 +02:00
|
|
|
#ifndef IMGUI_SURFACE_H
|
|
|
|
#define IMGUI_SURFACE_H
|
|
|
|
|
|
|
|
#define IMGUI_SURFACE_FADE_ANIM_SPEED 5.0f
|
|
|
|
|
|
|
|
#include "imgui/misc/imgui_utility.h"
|
|
|
|
|
|
|
|
class CImguiSurface
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CImguiSurface();
|
|
|
|
virtual ~CImguiSurface() { };
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
|
2024-04-05 18:22:56 +02:00
|
|
|
virtual bool Init() = 0;
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
virtual void Shutdown() = 0;
|
2024-04-05 18:22:56 +02:00
|
|
|
|
|
|
|
virtual void Animate();
|
|
|
|
virtual void RunFrame() = 0;
|
|
|
|
|
|
|
|
virtual bool DrawSurface() = 0;
|
|
|
|
virtual void SetStyleVar(const float width, const float height, const float x, const float y);
|
|
|
|
|
|
|
|
// inlines:
|
|
|
|
inline void ToggleActive() { m_activated ^= true; }
|
|
|
|
|
|
|
|
inline bool IsActivated() { return m_activated; }
|
|
|
|
inline bool IsVisible() { return m_fadeAlpha > 0.0f; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
const char* m_surfaceLabel;
|
|
|
|
|
|
|
|
float m_fadeAlpha;
|
|
|
|
ImGuiStyle_t m_surfaceStyle;
|
|
|
|
|
|
|
|
bool m_initialized;
|
|
|
|
bool m_activated;
|
|
|
|
bool m_reclaimFocus;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // IMGUI_SURFACE_H
|