mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-18 15:15:37 +00:00
Minor code cleanup and log output changes.
This commit is contained in:
parent
ce16c8e3ec
commit
34e10ec319
|
@ -168,6 +168,7 @@ void ComponentGrid::updateSeparators()
|
|||
|
||||
Vector2f pos;
|
||||
Vector2f size;
|
||||
|
||||
for (auto it = mCells.cbegin(); it != mCells.cend(); it++) {
|
||||
if (!it->border && !drawAll)
|
||||
continue;
|
||||
|
@ -334,7 +335,7 @@ bool ComponentGrid::cursorValid()
|
|||
|
||||
void ComponentGrid::update(int deltaTime)
|
||||
{
|
||||
// Update ALL THE THINGS.
|
||||
// Update everything.
|
||||
const GridEntry* cursorEntry = getCellAt(mCursor);
|
||||
for (auto it = mCells.cbegin(); it != mCells.cend(); it++)
|
||||
{
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace GridFlags
|
|||
};
|
||||
};
|
||||
|
||||
// Used to arrange a bunch of components in a spreadsheet-esque grid.
|
||||
// Provides basic layout of components in an X*Y grid.
|
||||
class ComponentGrid : public GuiComponent
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -21,10 +21,10 @@ class ButtonComponent;
|
|||
class ImageComponent;
|
||||
|
||||
std::shared_ptr<ComponentGrid> makeButtonGrid(Window* window,
|
||||
const std::vector< std::shared_ptr<ButtonComponent> >& buttons);
|
||||
const std::vector<std::shared_ptr<ButtonComponent>>& buttons);
|
||||
std::shared_ptr<ImageComponent> makeArrow(Window* window);
|
||||
|
||||
#define TITLE_VERT_PADDING (Renderer::getScreenHeight()*0.0637f)
|
||||
#define TITLE_VERT_PADDING (Renderer::getScreenHeight() * 0.0637f)
|
||||
|
||||
class MenuComponent : public GuiComponent
|
||||
{
|
||||
|
|
|
@ -48,7 +48,6 @@ public:
|
|||
void setBackgroundColor(unsigned int color);
|
||||
void setRenderBackground(bool render);
|
||||
|
||||
unsigned int getColor() const override { return mColor; };
|
||||
void render(const Transform4x4f& parentTrans) override;
|
||||
|
||||
std::string getValue() const override;
|
||||
|
@ -60,11 +59,12 @@ public:
|
|||
unsigned char getOpacity() const override;
|
||||
void setOpacity(unsigned char opacity) override;
|
||||
|
||||
inline std::shared_ptr<Font> getFont() const { return mFont; }
|
||||
|
||||
virtual void applyTheme(const std::shared_ptr<ThemeData>& theme, const std::string& view,
|
||||
const std::string& element, unsigned int properties) override;
|
||||
|
||||
unsigned int getColor() const override { return mColor; };
|
||||
inline std::shared_ptr<Font> getFont() const { return mFont; }
|
||||
|
||||
protected:
|
||||
virtual void onTextChanged();
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ void Font::initLibrary()
|
|||
assert(sLibrary == nullptr);
|
||||
if (FT_Init_FreeType(&sLibrary)) {
|
||||
sLibrary = nullptr;
|
||||
LOG(LogError) << "Error initializing FreeType!";
|
||||
LOG(LogError) << "Couldn't initialize FreeType";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -206,7 +206,7 @@ void Font::getTextureForNewGlyph(const Vector2i& glyphSize,
|
|||
bool ok = tex_out->findEmpty(glyphSize, cursor_out);
|
||||
if (!ok) {
|
||||
LOG(LogError) << "Glyph too big to fit on a new texture (glyph size > " <<
|
||||
tex_out->textureSize.x() << ", " << tex_out->textureSize.y() << ")!";
|
||||
tex_out->textureSize.x() << ", " << tex_out->textureSize.y() << ")";
|
||||
tex_out = nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -284,7 +284,7 @@ Font::Glyph* Font::getGlyph(unsigned int id)
|
|||
// Nope, need to make a glyph.
|
||||
FT_Face face = getFaceForChar(id);
|
||||
if (!face) {
|
||||
LOG(LogError) << "Could not find appropriate font face for character " <<
|
||||
LOG(LogError) << "Couldn't find appropriate font face for character " <<
|
||||
id << " for font " << mPath;
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -292,8 +292,8 @@ Font::Glyph* Font::getGlyph(unsigned int id)
|
|||
FT_GlyphSlot g = face->glyph;
|
||||
|
||||
if (FT_Load_Char(face, id, FT_LOAD_RENDER)) {
|
||||
LOG(LogError) << "Could not find glyph for character " <<
|
||||
id << " for font " << mPath << ", size " << mSize << "!";
|
||||
LOG(LogError) << "Couldn't find glyph for character " <<
|
||||
id << " for font " << mPath << ", size " << mSize;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -306,8 +306,8 @@ Font::Glyph* Font::getGlyph(unsigned int id)
|
|||
// getTextureForNewGlyph can fail if the glyph is bigger than the max texture
|
||||
// size (absurdly large font size).
|
||||
if (tex == nullptr) {
|
||||
LOG(LogError) << "Could not create glyph for character " << id << " for font " <<
|
||||
mPath << ", size " << mSize << " (no suitable texture found)!";
|
||||
LOG(LogError) << "Couldn't create glyph for character " << id << " for font " <<
|
||||
mPath << ", size " << mSize << " (no suitable texture found)";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -369,7 +369,7 @@ void Font::rebuildTextures()
|
|||
void Font::renderTextCache(TextCache* cache)
|
||||
{
|
||||
if (cache == nullptr) {
|
||||
LOG(LogError) << "Attempted to draw nullptr TextCache!";
|
||||
LOG(LogError) << "Attempted to draw nullptr TextCache";
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,14 +22,14 @@
|
|||
|
||||
class TextCache;
|
||||
|
||||
#define FONT_SIZE_MINI (static_cast<unsigned int>(0.030f * std::min(static_cast<int>( \
|
||||
Renderer::getScreenHeight()), static_cast<int>(Renderer::getScreenWidth()))))
|
||||
#define FONT_SIZE_SMALL (static_cast<unsigned int>(0.035f * std::min(static_cast<int>( \
|
||||
Renderer::getScreenHeight()), static_cast<int>(Renderer::getScreenWidth()))))
|
||||
#define FONT_SIZE_MEDIUM (static_cast<unsigned int>(0.045f * std::min(static_cast<int>( \
|
||||
Renderer::getScreenHeight()), static_cast<int>(Renderer::getScreenWidth()))))
|
||||
#define FONT_SIZE_LARGE (static_cast<unsigned int>(0.085f * std::min(static_cast<int>( \
|
||||
Renderer::getScreenHeight()), static_cast<int>(Renderer::getScreenWidth()))))
|
||||
#define FONT_SIZE_MINI (static_cast<unsigned int>(0.030f * \
|
||||
std::min(Renderer::getScreenHeight(), Renderer::getScreenWidth())))
|
||||
#define FONT_SIZE_SMALL (static_cast<unsigned int>(0.035f * \
|
||||
std::min(Renderer::getScreenHeight(), Renderer::getScreenWidth())))
|
||||
#define FONT_SIZE_MEDIUM (static_cast<unsigned int>(0.045f * \
|
||||
std::min(Renderer::getScreenHeight(), Renderer::getScreenWidth())))
|
||||
#define FONT_SIZE_LARGE (static_cast<unsigned int>(0.085f * \
|
||||
std::min(Renderer::getScreenHeight(), Renderer::getScreenWidth())))
|
||||
|
||||
#define FONT_PATH_LIGHT ":/fonts/opensans_hebrew_condensed_light.ttf"
|
||||
#define FONT_PATH_REGULAR ":/fonts/opensans_hebrew_condensed_regular.ttf"
|
||||
|
|
Loading…
Reference in a new issue