mirror of
https://github.com/J-D-K/JKSV.git
synced 2026-10-01 13:46:52 -05:00
Text wrap works now?
This commit is contained in:
4
Makefile
4
Makefile
@@ -38,7 +38,7 @@ INCLUDES := inc
|
||||
EXEFS_SRC := exefs_src
|
||||
APP_TITLE := JKSV
|
||||
APP_AUTHOR := JK_
|
||||
APP_VERSION := 06/15/2018
|
||||
APP_VERSION := 06/17/2018
|
||||
ROMFS := romfs
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
@@ -46,7 +46,7 @@ ROMFS := romfs
|
||||
#---------------------------------------------------------------------------------
|
||||
ARCH := -march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIE
|
||||
|
||||
CFLAGS := -g -Wall -O3 -ffunction-sections \
|
||||
CFLAGS := -g -Wall -O2 -ffunction-sections \
|
||||
$(ARCH) $(DEFINES)
|
||||
|
||||
CFLAGS += $(INCLUDE) -D__SWITCH__ `freetype-config --cflags`
|
||||
|
||||
@@ -27,6 +27,7 @@ namespace fs
|
||||
{
|
||||
public:
|
||||
dirList(const std::string& _path);
|
||||
void reassign(const std::string& _path);
|
||||
void rescan();
|
||||
|
||||
std::string getItem(int index);
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace gfx
|
||||
//Blends two pixels. Clr is the color to be drawn. FB should be the framebuffer pixel
|
||||
uint32_t blend(const uint32_t& clr, const uint32_t& fb);
|
||||
|
||||
//Draws text using shared font. No alpha blending yet.
|
||||
//Draws text using shared font.
|
||||
void drawText(const std::string& str, unsigned x, unsigned y, const uint32_t& sz, const uint32_t& clr);
|
||||
|
||||
//Returns width of str
|
||||
|
||||
14
src/file.cpp
14
src/file.cpp
@@ -55,6 +55,20 @@ namespace fs
|
||||
closedir(d);
|
||||
}
|
||||
|
||||
void dirList::reassign(const std::string& _path)
|
||||
{
|
||||
path = _path;
|
||||
|
||||
d = opendir(path.c_str());
|
||||
|
||||
while((ent = readdir(d)))
|
||||
{
|
||||
item.push_back(ent->d_name);
|
||||
}
|
||||
|
||||
closedir(d);
|
||||
}
|
||||
|
||||
void dirList::rescan()
|
||||
{
|
||||
item.clear();
|
||||
|
||||
@@ -37,7 +37,7 @@ int main(int argc, const char *argv[])
|
||||
break;
|
||||
|
||||
gfx::clearBufferColor(0x3B3B3BFF);
|
||||
gfx::drawText("JKSV - 6/15/2018", 16, 16, 64, 0xFFFFFFFF);
|
||||
gfx::drawText("JKSV - 6/17/2018", 16, 16, 64, 0xFFFFFFFF);
|
||||
gfx::drawRectangle(16, 64, 1248, 1, 0xFFFFFFFF);
|
||||
gfx::drawRectangle(448, 64, 1, 592, 0xFFFFFFFF);
|
||||
gfx::drawRectangle(16, 656, 1248, 1, 0xFFFFFFFF);
|
||||
|
||||
12
src/ui.cpp
12
src/ui.cpp
@@ -687,8 +687,6 @@ namespace ui
|
||||
{
|
||||
if(folderMenu.getSelected() > 0)
|
||||
{
|
||||
fs::delDir("sv:/");
|
||||
|
||||
std::string scanPath = util::getTitleDir(data::curUser, data::curData);
|
||||
fs::dirList list(scanPath);
|
||||
|
||||
@@ -703,7 +701,7 @@ namespace ui
|
||||
}
|
||||
}
|
||||
else
|
||||
ui::showMessage("NEIN! NEIN! NEIN!");
|
||||
ui::showMessage("Writing data to system save data is not allowed currently. It CAN brick your system.");
|
||||
}
|
||||
else if(down & KEY_X)
|
||||
{
|
||||
@@ -800,6 +798,7 @@ namespace ui
|
||||
void showMessage(const std::string& mess)
|
||||
{
|
||||
button ok("OK (A)", 480, 464, 320, 96);
|
||||
std::string wrapMess = util::getWrappedString(mess, 48, 752);
|
||||
while(true)
|
||||
{
|
||||
hidScanInput();
|
||||
@@ -812,7 +811,7 @@ namespace ui
|
||||
break;
|
||||
|
||||
gfx::drawRectangle(256, 128, 768, 464, 0xC0C0C0FF);
|
||||
gfx::drawText(mess, 272, 144, 48, 0x000000FF);
|
||||
gfx::drawText(wrapMess, 272, 144, 48, 0x000000FF);
|
||||
ok.draw();
|
||||
|
||||
gfx::handleBuffs();
|
||||
@@ -823,6 +822,7 @@ namespace ui
|
||||
{
|
||||
button ok("OK (A)", 480, 464, 320, 96);
|
||||
char tmp[512];
|
||||
std::string wrapMess = util::getWrappedString(mess, 48, 752);
|
||||
sprintf(tmp, "%s\n0x%08X", mess.c_str(), (unsigned)r);
|
||||
|
||||
while(true)
|
||||
@@ -851,6 +851,8 @@ namespace ui
|
||||
button yes("Yes (A)", 288, 464, 320, 96);
|
||||
button no("No (B)", 672, 464, 320, 96);
|
||||
|
||||
std::string wrapMess = util::getWrappedString(mess, 48, 752);
|
||||
|
||||
while(true)
|
||||
{
|
||||
hidScanInput();
|
||||
@@ -871,7 +873,7 @@ namespace ui
|
||||
}
|
||||
|
||||
gfx::drawRectangle(256, 128, 768, 464, 0xC0C0C0FF);
|
||||
gfx::drawText(mess, 272, 144, 48, 0x000000FF);
|
||||
gfx::drawText(wrapMess, 272, 144, 48, 0x000000FF);
|
||||
yes.draw();
|
||||
no.draw();
|
||||
|
||||
|
||||
10
src/util.cpp
10
src/util.cpp
@@ -56,14 +56,16 @@ namespace util
|
||||
{
|
||||
tmp.assign(s, first, lastSpace - first);
|
||||
|
||||
first = lastSpace + 1;
|
||||
ret += tmp + "\n";
|
||||
|
||||
tmp.assign(s, first, i);
|
||||
first = lastSpace + 1;
|
||||
i = lastSpace;
|
||||
|
||||
tmp.clear();
|
||||
}
|
||||
else if(i == s.length() - 1 && gfx::getTextWidth(tmp, sz) < maxWidth)
|
||||
ret += tmp;
|
||||
}
|
||||
if(!tmp.empty())
|
||||
ret += tmp;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user