[Deps]: Rename stb_truetype.h to stb_truetype.hpp (#719)

This commit is contained in:
Edo 2023-01-12 14:55:26 +00:00 committed by GitHub
parent 3ff8486fc3
commit 0d96a0882b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 1736 additions and 1661 deletions

View File

@ -5008,4 +5008,4 @@ AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
*/ */

View File

@ -2,7 +2,7 @@
#include "IFont_s.hpp" #include "IFont_s.hpp"
#define STB_TRUETYPE_IMPLEMENTATION #define STB_TRUETYPE_IMPLEMENTATION
#include <stb_truetype.h> #include <stb_truetype.hpp>
#include <json.hpp> #include <json.hpp>

View File

@ -56,6 +56,19 @@ namespace Components
Game::SV_GameSendServerCommand(player - Game::g_entities, Game::SV_CMD_CAN_IGNORE, Utils::String::VA("%c \"You are muted\"", 0x65)); Game::SV_GameSendServerCommand(player - Game::g_entities, Game::SV_CMD_CAN_IGNORE, Utils::String::VA("%c \"You are muted\"", 0x65));
} }
if (sv_disableChat.get<bool>())
{
SendChat = false;
Game::SV_GameSendServerCommand(player - Game::g_entities, Game::SV_CMD_CAN_IGNORE, Utils::String::VA("%c \"Chat is disabled\"", 0x65));
}
// Message might be empty after processing the '/'
if (text[msgIndex] == '\0')
{
SendChat = false;
return text;
}
for (const auto& callback : SayCallbacks) for (const auto& callback : SayCallbacks)
{ {
if (!ChatCallback(player, callback.getPos(), (text + msgIndex), mode)) if (!ChatCallback(player, callback.getPos(), (text + msgIndex), mode))
@ -64,12 +77,6 @@ namespace Components
} }
} }
if (sv_disableChat.get<bool>())
{
SendChat = false;
Game::SV_GameSendServerCommand(player - Game::g_entities, Game::SV_CMD_CAN_IGNORE, Utils::String::VA("%c \"Chat is disabled\"", 0x65));
}
TextRenderer::StripMaterialTextIcons(text, text, std::strlen(text) + 1); TextRenderer::StripMaterialTextIcons(text, text, std::strlen(text) + 1);
Game::Scr_AddEntity(player); Game::Scr_AddEntity(player);

View File

@ -102,8 +102,6 @@ namespace Components
const char Debug::StrTemplate[] = "%s: %s All those moments will be lost in time, like tears in rain."; const char Debug::StrTemplate[] = "%s: %s All those moments will be lost in time, like tears in rain.";
const float Debug::ColorWhite[] = {1.0f, 1.0f, 1.0f, 1.0f};
std::string Debug::BuildPMFlagsString(const Game::playerState_s* ps) std::string Debug::BuildPMFlagsString(const Game::playerState_s* ps)
{ {
std::string result; std::string result;
@ -163,19 +161,19 @@ namespace Components
auto* const font2 = Game::UI_GetFontHandle(scrPlace, 6, MY_SCALE2); auto* const font2 = Game::UI_GetFontHandle(scrPlace, 6, MY_SCALE2);
Game::UI_DrawText(scrPlace, "Client View of Flags", maxChars, font2, -60.0f, 0, 1, 1, Game::UI_DrawText(scrPlace, "Client View of Flags", maxChars, font2, -60.0f, 0, 1, 1,
MY_SCALE2, ColorWhite, 1); MY_SCALE2, TextRenderer::WHITE_COLOR, 1);
const auto pmf = BuildPMFlagsString(&cgameGlob->predictedPlayerState); const auto pmf = BuildPMFlagsString(&cgameGlob->predictedPlayerState);
Game::UI_DrawText(scrPlace, pmf.data(), maxChars, font1, 30.0f, MY_Y, 1, 1, MY_SCALE_2, ColorWhite, 3); Game::UI_DrawText(scrPlace, pmf.data(), maxChars, font1, 30.0f, MY_Y, 1, 1, MY_SCALE_2, TextRenderer::WHITE_COLOR, 3);
const auto pof = BuildPOFlagsString(&cgameGlob->predictedPlayerState); const auto pof = BuildPOFlagsString(&cgameGlob->predictedPlayerState);
Game::UI_DrawText(scrPlace, pof.data(), maxChars, font1, 350.0f, MY_Y, 1, 1, MY_SCALE_2, ColorWhite, 3); Game::UI_DrawText(scrPlace, pof.data(), maxChars, font1, 350.0f, MY_Y, 1, 1, MY_SCALE_2, TextRenderer::WHITE_COLOR, 3);
const auto plf = BuildPLFlagsString(&cgameGlob->predictedPlayerState); const auto plf = BuildPLFlagsString(&cgameGlob->predictedPlayerState);
Game::UI_DrawText(scrPlace, plf.data(), maxChars, font1, 350.0f, 250.0f, 1, 1, MY_SCALE_2, ColorWhite, 3); Game::UI_DrawText(scrPlace, plf.data(), maxChars, font1, 350.0f, 250.0f, 1, 1, MY_SCALE_2, TextRenderer::WHITE_COLOR, 3);
const auto pef = BuildPEFlagsString(&cgameGlob->predictedPlayerState); const auto pef = BuildPEFlagsString(&cgameGlob->predictedPlayerState);
Game::UI_DrawText(scrPlace, pef.data(), maxChars, font1, 525.0f, MY_Y, 1, 1, MY_SCALE_2, ColorWhite, 3); Game::UI_DrawText(scrPlace, pef.data(), maxChars, font1, 525.0f, MY_Y, 1, 1, MY_SCALE_2, TextRenderer::WHITE_COLOR, 3);
} }
void Debug::CG_DrawDebugPlayerHealth(const int localClientNum) void Debug::CG_DrawDebugPlayerHealth(const int localClientNum)
@ -223,23 +221,23 @@ namespace Components
sprintf_s(strFinal, StrTemplate, font1->fontName, StrButtons); sprintf_s(strFinal, StrTemplate, font1->fontName, StrButtons);
Game::UI_FilterStringForButtonAnimation(strFinal, sizeof(strFinal)); Game::UI_FilterStringForButtonAnimation(strFinal, sizeof(strFinal));
Game::UI_DrawText(scrPlace, strFinal, std::numeric_limits<int>::max(), font1, MY_X, 10.0f, 1, 1, 0.4f, ColorWhite, 3); Game::UI_DrawText(scrPlace, strFinal, std::numeric_limits<int>::max(), font1, MY_X, 10.0f, 1, 1, 0.4f, TextRenderer::WHITE_COLOR, 3);
sprintf_s(strFinal, StrTemplate, font2->fontName, StrButtons); sprintf_s(strFinal, StrTemplate, font2->fontName, StrButtons);
Game::UI_FilterStringForButtonAnimation(strFinal, sizeof(strFinal)); Game::UI_FilterStringForButtonAnimation(strFinal, sizeof(strFinal));
Game::UI_DrawText(scrPlace, strFinal, std::numeric_limits<int>::max(), font2, MY_X, 35.0f, 1, 1, 0.4f, ColorWhite, 3); Game::UI_DrawText(scrPlace, strFinal, std::numeric_limits<int>::max(), font2, MY_X, 35.0f, 1, 1, 0.4f, TextRenderer::WHITE_COLOR, 3);
sprintf_s(strFinal, StrTemplate, font3->fontName, StrButtons); sprintf_s(strFinal, StrTemplate, font3->fontName, StrButtons);
Game::UI_FilterStringForButtonAnimation(strFinal, sizeof(strFinal)); Game::UI_FilterStringForButtonAnimation(strFinal, sizeof(strFinal));
Game::UI_DrawText(scrPlace, strFinal, std::numeric_limits<int>::max(), font3, MY_X, 60.0f, 1, 1, 0.4f, ColorWhite, 3); Game::UI_DrawText(scrPlace, strFinal, std::numeric_limits<int>::max(), font3, MY_X, 60.0f, 1, 1, 0.4f, TextRenderer::WHITE_COLOR, 3);
sprintf_s(strFinal, StrTemplate, font5->fontName, StrButtons); sprintf_s(strFinal, StrTemplate, font5->fontName, StrButtons);
Game::UI_FilterStringForButtonAnimation(strFinal, sizeof(strFinal)); Game::UI_FilterStringForButtonAnimation(strFinal, sizeof(strFinal));
Game::UI_DrawText(scrPlace, strFinal, std::numeric_limits<int>::max(), font5, MY_X, 85.0f, 1, 1, 0.4f, ColorWhite, 3); Game::UI_DrawText(scrPlace, strFinal, std::numeric_limits<int>::max(), font5, MY_X, 85.0f, 1, 1, 0.4f, TextRenderer::WHITE_COLOR, 3);
sprintf_s(strFinal, StrTemplate, font6->fontName, StrButtons); sprintf_s(strFinal, StrTemplate, font6->fontName, StrButtons);
Game::UI_FilterStringForButtonAnimation(strFinal, sizeof(strFinal)); Game::UI_FilterStringForButtonAnimation(strFinal, sizeof(strFinal));
Game::UI_DrawText(scrPlace, strFinal, std::numeric_limits<int>::max(), font6, MY_X, 110.0f, 1, 1, 0.4f, ColorWhite, 3); Game::UI_DrawText(scrPlace, strFinal, std::numeric_limits<int>::max(), font6, MY_X, 110.0f, 1, 1, 0.4f, TextRenderer::WHITE_COLOR, 3);
} }
void Debug::CG_DrawDebugOverlays_Hk(const int localClientNum) void Debug::CG_DrawDebugOverlays_Hk(const int localClientNum)

View File

@ -28,8 +28,6 @@ namespace Components
static constexpr auto MY_X = -25.0f; static constexpr auto MY_X = -25.0f;
static constexpr auto MY_Y = 20.0f; static constexpr auto MY_Y = 20.0f;
static const float ColorWhite[];
static std::string BuildPMFlagsString(const Game::playerState_s* ps); static std::string BuildPMFlagsString(const Game::playerState_s* ps);
static std::string BuildPOFlagsString(const Game::playerState_s* ps); static std::string BuildPOFlagsString(const Game::playerState_s* ps);
static std::string BuildPLFlagsString(const Game::playerState_s* ps); static std::string BuildPLFlagsString(const Game::playerState_s* ps);

File diff suppressed because it is too large Load Diff

View File

@ -42,6 +42,7 @@ namespace Components
class TextRenderer : public Component class TextRenderer : public Component
{ {
public:
static constexpr auto STRING_BUFFER_SIZE_BIG = 1024; static constexpr auto STRING_BUFFER_SIZE_BIG = 1024;
static constexpr auto STRING_BUFFER_SIZE_SMALL = 128; static constexpr auto STRING_BUFFER_SIZE_SMALL = 128;
@ -88,7 +89,6 @@ namespace Components
1.0f 1.0f
}; };
public:
static constexpr char FONT_ICON_SEPARATOR_CHARACTER = ':'; static constexpr char FONT_ICON_SEPARATOR_CHARACTER = ':';
static constexpr char FONT_ICON_MODIFIER_SEPARATOR_CHARACTER = '+'; static constexpr char FONT_ICON_MODIFIER_SEPARATOR_CHARACTER = '+';
static constexpr char FONT_ICON_MODIFIER_FLIP_HORIZONTALLY = 'h'; static constexpr char FONT_ICON_MODIFIER_FLIP_HORIZONTALLY = 'h';
@ -139,7 +139,7 @@ namespace Components
class BufferedLocalizedString class BufferedLocalizedString
{ {
public: public:
BufferedLocalizedString(const char* reference, size_t bufferSize); BufferedLocalizedString(const char* reference, std::size_t bufferSize);
void Cache(); void Cache();
const char* Format(const char* value); const char* Format(const char* value);
const char* GetString() const; const char* GetString() const;
@ -148,7 +148,7 @@ namespace Components
private: private:
const char* stringReference; const char* stringReference;
std::unique_ptr<char[]> stringBuffer; std::unique_ptr<char[]> stringBuffer;
size_t stringBufferSize; std::size_t stringBufferSize;
int stringWidth[FONT_ICON_ACI_COUNT]; int stringWidth[FONT_ICON_ACI_COUNT];
}; };