diff --git a/inc/gfx.h b/inc/gfx.h index 2c8b3cd..d14910a 100644 --- a/inc/gfx.h +++ b/inc/gfx.h @@ -6,7 +6,7 @@ namespace gfx { //Inits graphics and shared font. Code for shared font is from switch-portlibs examples - bool init(const uint32_t& _fontSize); + bool init(); bool fini(); //Changes gfx mode to linear double @@ -48,6 +48,9 @@ namespace gfx ~tex(); void draw(uint32_t x, uint32_t y); + //This is specifically for the topbar. + void drawRepeatHori(uint32_t x, uint32_t y, uint32_t w); + private: uint32_t sz; uint16_t width, height; diff --git a/inc/util.h b/inc/util.h index 44aef1f..e49f335 100644 --- a/inc/util.h +++ b/inc/util.h @@ -8,10 +8,10 @@ namespace util //Returns string with date + time std::string getDateTime(); - //Creates Dir 'JKSV/[user]/[title] + //Creates Dir 'JKSV/[title] void makeTitleDir(data::user& u, data::titledata& t); - //Returns 'JKSV/[user]/[title]/' + //Returns 'JKSV/[title]/' std::string getTitleDir(data::user& u, data::titledata& t); //Just returns string with '\n' inserted. diff --git a/romfs/img/topbar.data b/romfs/img/topbar.data index 9bfe955..b0de73f 100644 Binary files a/romfs/img/topbar.data and b/romfs/img/topbar.data differ diff --git a/src/gfx.cpp b/src/gfx.cpp index f47f521..db926f7 100644 --- a/src/gfx.cpp +++ b/src/gfx.cpp @@ -16,7 +16,7 @@ static uint32_t frameBufWidth = 0; namespace gfx { - bool init(const uint32_t& _fontSize) + bool init() { Result res = 0; @@ -149,11 +149,7 @@ namespace gfx } glyphIndex = FT_Get_Char_Index(face, tmpChr); - ret = FT_Load_Glyph(face, glyphIndex, FT_LOAD_DEFAULT); - if(ret == 0) - { - ret = FT_Render_Glyph(face->glyph, FT_RENDER_MODE_NORMAL); - } + ret = FT_Load_Glyph(face, glyphIndex, FT_LOAD_RENDER); if(ret) return; @@ -187,11 +183,7 @@ namespace gfx i += unitCount; glyphIndex = FT_Get_Char_Index(face, tmpChr); - ret = FT_Load_Glyph(face, glyphIndex, FT_LOAD_DEFAULT); - if(ret == 0) - { - ret = FT_Render_Glyph(face->glyph, FT_RENDER_MODE_NORMAL); - } + ret = FT_Load_Glyph(face, glyphIndex, FT_LOAD_RENDER); if(ret) return 0; @@ -304,4 +296,22 @@ namespace gfx } } } + + void tex::drawRepeatHori(uint32_t x, uint32_t y, uint32_t w) + { + if(data != NULL) + { + uint32_t tY, tX, i = 0; + uint32_t *fb = (uint32_t *)gfxGetFramebuffer(NULL, NULL); + + for(tY = y; tY < y + height; tY++, i++) + { + for(tX = x; tX < x + w; tX++) + { + uint32_t fbPx = fb[tY * frameBufWidth + tX]; + fb[tY * frameBufWidth + tX] = blend(data[i], fbPx); + } + } + } + } } diff --git a/src/main.cpp b/src/main.cpp index 79a520a..4f582ea 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -12,7 +12,7 @@ int main(int argc, const char *argv[]) { bool init = false; - init = gfx::init(64); + init = gfx::init(); if(init) init = sys::init(); if(init) @@ -39,7 +39,10 @@ int main(int argc, const char *argv[]) gfx::clearBufferColor(0xFF3B3B3B); ui::drawTitleBar("JKSV - 06/17/2018"); gfx::drawRectangle(448, 64, 1, 592, 0xFF7B7B7B); + gfx::drawRectangle(449, 64, 2, 592, 0xFF2B2B2B); + gfx::drawRectangle(16, 656, 1248, 1, 0xFF7B7B7B); + gfx::drawRectangle(16, 657, 1248, 2, 0xFF2B2B2B); ui::runApp(down, held); diff --git a/src/ui.cpp b/src/ui.cpp index f8f00b5..8cb458a 100644 --- a/src/ui.cpp +++ b/src/ui.cpp @@ -567,7 +567,7 @@ namespace ui void drawTitleBar(const std::string& txt) { - titleBar.draw(0, 0); + titleBar.drawRepeatHori(0, 0, 1280); gfx::drawText(txt, 16, 16, 64, 0xFFFFFFFF); }