Minor fixes & Revision

This commit is contained in:
J-D-K 2024-06-23 18:08:39 -04:00
parent bd463c3668
commit b9f4795104
2 changed files with 9 additions and 7 deletions

View File

@ -16,10 +16,14 @@ const char *TITLE_SELECT_RENDER_TARGET = "titleSelectionRenderTarget";
static const int RENDER_TARGET_WIDTH = 1080;
static const int RENDER_TARGET_HEIGHT = 555;
// X coordinate to subtract from for guide text
static const int GUIDE_STARTING_X = 1220;
titleSelectionState::titleSelectionState(data::user *currentUser) :
m_CurrentUser(currentUser),
m_TitleSelection(std::make_unique<ui::titleSelection>(m_CurrentUser)),
m_TitleControlGuide(ui::strings::getString(LANG_TITLE_GUIDE, 0))
m_TitleControlGuide(ui::strings::getString(LANG_TITLE_GUIDE, 0)),
m_TitleControlGuideX(GUIDE_STARTING_X - graphics::systemFont::getTextWidth(m_TitleControlGuide, 18))
{
// Render target to render everything too
m_RenderTarget = graphics::textureCreate(TITLE_SELECT_RENDER_TARGET, RENDER_TARGET_WIDTH, RENDER_TARGET_HEIGHT, SDL_TEXTUREACCESS_STATIC | SDL_TEXTUREACCESS_TARGET);

View File

@ -1,3 +1,4 @@
#include <algorithm>
#include <array>
#include <string>
#include <cstring>
@ -22,7 +23,7 @@ static const uint32_t s_BlueMask = 0x0000FF00;
static const uint32_t s_AlphaMask = 0x000000FF;
//Codepoints to break a line at
static const uint32_t s_BreakPoints[7] = {' ', L' ', '/', '_', '-', L'', L''};
static const std::array<uint32_t, 7> s_BreakPoints = {' ', L' ', '/', '_', '-', L'', L''};
//This struct is for caching glyph data needed
typedef struct
@ -112,12 +113,9 @@ static glyphData *getGlyph(const uint32_t& c, const int &fontSize)
//Returns if line breakable character
static bool isBreakableCharacter(const uint32_t &codepoint)
{
for(int i = 0; i < 7; i++)
if(std::find(s_BreakPoints.begin(), s_BreakPoints.end(), codepoint) != s_BreakPoints.end())
{
if(codepoint == s_BreakPoints[i])
{
return true;
}
return true;
}
return false;
}