![]() |
PRooFPS-dd Dev Doc 1.0
PRooFPS-dd Developer Documentation
|
#include <GUI.h>
Public Types | |
enum class | MenuState { None , Main , CreateGame , JoinGame , Settings , Exiting } |
enum class | GameInfoPage { None , FragTable , ServerConfig , COUNT } |
Public Member Functions | |
void | initialize () |
void | shutdown () |
const MenuState & | getMenuState () const |
void | resetMenuState (bool bExitingFromGameSession) |
void | showLoadingScreen (int nProgress, const std::string &sMapFilename) |
void | hideLoadingScreen () |
bool | showBgWithLogo () |
bool | hideBgWithLogo () |
XHair * | getXHair () |
Minimap * | getMinimap () |
DeathKillEventLister * | getDeathKillEvents () |
EventLister * | getItemPickupEvents () |
EventLister * | getPlayerHpChangeEvents () |
EventLister * | getPlayerApChangeEvents () |
EventLister * | getPlayerAmmoChangeEvents () |
void | showGameObjectives () |
void | hideGameObjectives () |
void | showAndLoopGameInfoPages () |
void | textForNextFrame (const std::string &s, int nPureX, int nPureY) const |
void | textPermanent (const std::string &s, int nPureX, int nPureY) const |
void | showRespawnTimer (const Player *const pKillerPlayer) |
void | hideRespawnTimer () |
void | setGameModeInstance (proofps_dd::GameMode &gm) |
Static Public Member Functions | |
static GUI & | getGuiInstance (PGE &pge, proofps_dd::Config &config, proofps_dd::Maps &maps, proofps_dd::Networking &networking, std::map< pge_network::PgeNetworkConnectionHandle, proofps_dd::Player > &mapPlayers) |
Gets the singleton instance. | |
static const char * | getLoggerModuleName () |
static CConsole & | getConsole () |
Static Public Attributes | |
static constexpr char * | CVAR_GUI_MAINMENU = "gui_mainmenu" |
Private Member Functions | |
GUI () | |
~GUI () | |
GUI (const GUI &)=delete | |
GUI & | operator= (const GUI &)=delete |
GUI (GUI &&)=delete | |
GUI && | operator= (GUI &&)=delete |
Static Private Member Functions | |
static void | addHintToItemByCVar (std::string &sHint, const PGEcfgVariable &cvar) |
static float | calcContentStartY (const float &fContentHeight, const float &fRemainingSpaceY) |
static void | drawMainMenu (const float &fRemainingSpaceY) |
static float | drawPlayerNameInputBox () |
static void | drawCreateGameMenu (const float &fRemainingSpaceY) |
static void | drawJoinGameMenu (const float &fRemainingSpaceY) |
static void | showConfigApplyAndRestartDialogBox (PGEcfgVariable &cvar, const std::string &sPopupId) |
static void | drawSettingsMenu (const float &fRemainingSpaceY) |
static void | drawWindowForMainMenu () |
static void | drawRespawnTimer () |
static void | drawXHairHoverText () |
static void | updateXHair () |
static void | drawCurrentPlayerInfo (const proofps_dd::Player &player) |
static void | updateDeathKillEvents () |
static void | updateItemPickupEvents () |
static void | updatePlayerHpChangeEvents () |
static void | updatePlayerApChangeEvents () |
static void | updatePlayerAmmoChangeEvents () |
static void | calculatePlayerNameColWidthAndTableWidthPixels (float &fTableWidthPixels, float &fPlayerNameColWidthPixels, float fPlayerNameColReqWidthPixels, const float &fTableColIndentPixels, const float &fColsTotalWidthAfterPlayerNameCol) |
static void | drawGameObjectivesServer (const std::string &sTableCaption, const float &fStartPosY) |
static void | drawGameObjectivesClient (const std::string &sTableCaption, const float &fStartPosY) |
static void | drawGameObjectives () |
static void | drawClientConnectionDebugInfo (float fThisRowY) |
static void | drawGameServerConfig () |
static void | drawGameInfoPages () |
static float | getDearImGui2DposXFromPure2DposX (const float &fPureX) |
Converts the given X position specified in PURE 2D coordinate system to an X position in ImGui's 2D coordinate system. | |
static float | getDearImGui2DposYFromPure2DposY (const float &fPureY) |
Converts the given Y position specified in PURE 2D coordinate system to an Y position in ImGui's 2D coordinate system. | |
static float | getDearImGui2DposXforCenteredText (const std::string &text, const float &fImGuiX) |
static float | getDearImGui2DposXforRightAdjustedText (const std::string &text, const float &fImGuiX) |
static float | getDearImGui2DposXforTableCurrentCellCenteredText (const std::string &text) |
static float | getDearImGui2DposXforTableCurrentCellRightAdjustedText (const std::string &text) |
static float | getDearImGui2DposXforWindowCenteredText (const std::string &text) |
static void | drawText (const float &fImGuiX, const float &fImGuiY, const std::string &text) |
static void | drawTextShadowed (const float &fImGuiX, const float &fImGuiY, const std::string &text) |
static void | drawTextHighlighted (const float &fImGuiX, const float &fImGuiY, const std::string &text) |
static void | ImGuiTextTableCurrentCellShortenedFit (const std::string &text, size_t nAppendLastNChars=0) |
Renders the given text in the current cell, with automatic shortening if cell width is not enough for the whole text. | |
static void | ImGuiTextTableCurrentCellCentered (const std::string &text) |
static void | ImGuiTextTableCurrentCellRightAdjusted (const std::string &text) |
static void | drawDearImGuiCb () |
Primary GUI draw function called back by PURE. | |
Static Private Attributes | |
static PGE * | m_pPge = nullptr |
static Config * | m_pConfig = nullptr |
static Maps * | m_pMaps = nullptr |
static Networking * | m_pNetworking = nullptr |
static std::map< pge_network::PgeNetworkConnectionHandle, proofps_dd::Player > * | m_pMapPlayers = nullptr |
static MenuState | m_currentMenu = proofps_dd::GUI::MenuState::Main |
static bool | m_bShowRespawnTimer = false |
static std::chrono::time_point< std::chrono::steady_clock > | m_timePlayerDied {} |
static std::string | m_sRespawnTimerExtraText |
static std::string | m_sRespawnTimerExtraText2 |
static bool | m_bShowHealthAndArmor = false |
static XHair * | m_pXHair = nullptr |
static Minimap * | m_pMinimap = nullptr |
static DeathKillEventLister * | m_pEventsDeathKill = nullptr |
static EventLister * | m_pEventsItemPickup = nullptr |
static EventLister * | m_pEventsPlayerHpChange = nullptr |
static EventLister * | m_pEventsPlayerApChange = nullptr |
static EventLister * | m_pEventsPlayerAmmoChange = nullptr |
static PureObject3D * | m_pObjLoadingScreenBg = nullptr |
static PureObject3D * | m_pObjLoadingScreenLogoImg = nullptr |
static std::string | m_sAvailableMapsListForForceSelectComboBox |
static ImFont * | m_pImFontFragTable = nullptr |
static ImFont * | m_pImFontHudGeneral = nullptr |
static float | m_fFontSizePxHudGeneral = fDefaultFontSizePixels |
static GameInfoPage | m_gameInfoPageCurrent = proofps_dd::GUI::GameInfoPage::None |
static GameMode * | m_pGameMode = nullptr |
|
strong |
|
strong |
|
privatedelete |
|
privatedelete |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
Primary GUI draw function called back by PURE.
PURE invokes this function every frame, AFTER rendering the 2D sticked-to-screen objects (PureObject3D::SetStickedToScreen()). Thus, calculations in this function having effect on the PURE sticked-to-screen objects, will be visible only in the next frame. So in general it is highly recommended to do ONLY Dear ImGui-specific stuff here.
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
Converts the given X position specified in PURE 2D coordinate system to an X position in ImGui's 2D coordinate system.
Dear ImGui coordinates are the same as OS desktop/native coordinates which means that operating with ImGui::GetMainViewport() is different than operating with getPure().getCamera().getViewport():
fPureX | The input X position in PURE 2D coordinate system. |
|
staticprivate |
Converts the given Y position specified in PURE 2D coordinate system to an Y position in ImGui's 2D coordinate system.
Dear ImGui coordinates are the same as OS desktop/native coordinates which means that operating with ImGui::GetMainViewport() is different than operating with getPure().getCamera().getViewport():
fPureY | The input Y position in PURE 2D coordinate system. |
proofps_dd::DeathKillEventLister * proofps_dd::GUI::getDeathKillEvents | ( | ) |
|
static |
proofps_dd::EventLister * proofps_dd::GUI::getItemPickupEvents | ( | ) |
const proofps_dd::GUI::MenuState & proofps_dd::GUI::getMenuState | ( | ) | const |
proofps_dd::Minimap * proofps_dd::GUI::getMinimap | ( | ) |
proofps_dd::EventLister * proofps_dd::GUI::getPlayerAmmoChangeEvents | ( | ) |
proofps_dd::EventLister * proofps_dd::GUI::getPlayerApChangeEvents | ( | ) |
proofps_dd::EventLister * proofps_dd::GUI::getPlayerHpChangeEvents | ( | ) |
proofps_dd::XHair * proofps_dd::GUI::getXHair | ( | ) |
|
staticprivate |
|
staticprivate |
|
staticprivate |
Renders the given text in the current cell, with automatic shortening if cell width is not enough for the whole text.
I dont know why Dear ImGui is not always automatically shortening too long text in cells with "..." so I made this function.
However, this function is very useful especially when shortening player names, since in case of colliding player names, server appends a 3-digit unique number to the end of each player name, and we can see those numbers even if name is too long, if we set nAppendLastNChars to 3, to be able to distinguish players with too long names!
text | The text to be rendered in current cell. |
nAppendLastNChars | How many last characters of 'text' should be rendered in the cell after "..." if we are shortening. |
void proofps_dd::GUI::resetMenuState | ( | bool | bExitingFromGameSession | ) |
void proofps_dd::GUI::setGameModeInstance | ( | proofps_dd::GameMode & | gm | ) |
|
staticprivate |
void proofps_dd::GUI::showLoadingScreen | ( | int | nProgress, |
const std::string & | sMapFilename ) |
void proofps_dd::GUI::showRespawnTimer | ( | const Player *const | pKillerPlayer | ) |
void proofps_dd::GUI::textForNextFrame | ( | const std::string & | s, |
int | nPureX, | ||
int | nPureY ) const |
void proofps_dd::GUI::textPermanent | ( | const std::string & | s, |
int | nPureX, | ||
int | nPureY ) const |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticconstexpr |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |