diff --git a/es-core/src/components/ComponentGrid.cpp b/es-core/src/components/ComponentGrid.cpp index 4e635b647..f19053d90 100644 --- a/es-core/src/components/ComponentGrid.cpp +++ b/es-core/src/components/ComponentGrid.cpp @@ -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++) { diff --git a/es-core/src/components/ComponentGrid.h b/es-core/src/components/ComponentGrid.h index 0deb455fc..693bb1b7b 100644 --- a/es-core/src/components/ComponentGrid.h +++ b/es-core/src/components/ComponentGrid.h @@ -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: diff --git a/es-core/src/components/MenuComponent.h b/es-core/src/components/MenuComponent.h index 91cdf96e8..3ae216b30 100644 --- a/es-core/src/components/MenuComponent.h +++ b/es-core/src/components/MenuComponent.h @@ -21,10 +21,10 @@ class ButtonComponent; class ImageComponent; std::shared_ptr makeButtonGrid(Window* window, - const std::vector< std::shared_ptr >& buttons); + const std::vector>& buttons); std::shared_ptr makeArrow(Window* window); -#define TITLE_VERT_PADDING (Renderer::getScreenHeight()*0.0637f) +#define TITLE_VERT_PADDING (Renderer::getScreenHeight() * 0.0637f) class MenuComponent : public GuiComponent { diff --git a/es-core/src/components/TextComponent.h b/es-core/src/components/TextComponent.h index 91e0cf303..2547c222c 100644 --- a/es-core/src/components/TextComponent.h +++ b/es-core/src/components/TextComponent.h @@ -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 getFont() const { return mFont; } - virtual void applyTheme(const std::shared_ptr& theme, const std::string& view, const std::string& element, unsigned int properties) override; + unsigned int getColor() const override { return mColor; }; + inline std::shared_ptr getFont() const { return mFont; } + protected: virtual void onTextChanged(); diff --git a/es-core/src/resources/Font.cpp b/es-core/src/resources/Font.cpp index 8bd4a7ff0..be3f8a5ed 100644 --- a/es-core/src/resources/Font.cpp +++ b/es-core/src/resources/Font.cpp @@ -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; } diff --git a/es-core/src/resources/Font.h b/es-core/src/resources/Font.h index 4c90cf325..64bd803b8 100644 --- a/es-core/src/resources/Font.h +++ b/es-core/src/resources/Font.h @@ -22,14 +22,14 @@ class TextCache; -#define FONT_SIZE_MINI (static_cast(0.030f * std::min(static_cast( \ - Renderer::getScreenHeight()), static_cast(Renderer::getScreenWidth())))) -#define FONT_SIZE_SMALL (static_cast(0.035f * std::min(static_cast( \ - Renderer::getScreenHeight()), static_cast(Renderer::getScreenWidth())))) -#define FONT_SIZE_MEDIUM (static_cast(0.045f * std::min(static_cast( \ - Renderer::getScreenHeight()), static_cast(Renderer::getScreenWidth())))) -#define FONT_SIZE_LARGE (static_cast(0.085f * std::min(static_cast( \ - Renderer::getScreenHeight()), static_cast(Renderer::getScreenWidth())))) +#define FONT_SIZE_MINI (static_cast(0.030f * \ + std::min(Renderer::getScreenHeight(), Renderer::getScreenWidth()))) +#define FONT_SIZE_SMALL (static_cast(0.035f * \ + std::min(Renderer::getScreenHeight(), Renderer::getScreenWidth()))) +#define FONT_SIZE_MEDIUM (static_cast(0.045f * \ + std::min(Renderer::getScreenHeight(), Renderer::getScreenWidth()))) +#define FONT_SIZE_LARGE (static_cast(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"