mirror of
https://github.com/J-D-K/JKSV.git
synced 2026-03-21 17:24:37 -05:00
Tweak Nav buttons
This commit is contained in:
parent
5845099fd4
commit
cee671c682
|
|
@ -51,6 +51,9 @@ namespace data
|
|||
std::string getTitle() { return title;}
|
||||
std::string getTitleSafe() { return titleSafe; }
|
||||
|
||||
//Just for testing to make sure only ASCII folders
|
||||
void debugCreate(const uint64_t& _id, const std::string& t);
|
||||
|
||||
//Returns ID
|
||||
uint64_t getID() { return id; }
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,6 @@ namespace util
|
|||
|
||||
std::string getInfoString(data::user& u, data::titledata& d);
|
||||
|
||||
void debugPrintf(const char *format, ...);
|
||||
void debugPrintf(const char *out);
|
||||
}
|
||||
#endif // UTIL_H
|
||||
|
|
|
|||
29
src/data.cpp
29
src/data.cpp
|
|
@ -15,11 +15,17 @@ static struct
|
|||
{
|
||||
bool operator()(data::titledata& a, data::titledata& b)
|
||||
{
|
||||
for(unsigned i = 0; i < a.getTitle().length(); i++)
|
||||
uint32_t tmpA, tmpB;
|
||||
for(unsigned i = 0; i < a.getTitle().length(); )
|
||||
{
|
||||
int charA = tolower(a.getTitle().c_str()[i]), charB = tolower(b.getTitle().c_str()[i]);
|
||||
if(charA != charB)
|
||||
return charA < charB;
|
||||
ssize_t uCnt = decode_utf8(&tmpA, (const uint8_t *)&a.getTitle().data()[i]);
|
||||
decode_utf8(&tmpB, (const uint8_t *)&b.getTitle().data()[i]);
|
||||
tmpA = tolower(tmpA);
|
||||
tmpB = tolower(tmpB);
|
||||
if(tmpA != tmpB)
|
||||
return tmpA < tmpB;
|
||||
|
||||
i += uCnt;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
@ -228,6 +234,21 @@ namespace data
|
|||
return false;
|
||||
}
|
||||
|
||||
//ASCII Testing
|
||||
void titledata::debugCreate(const uint64_t& _id, const std::string& t)
|
||||
{
|
||||
id = _id;
|
||||
title = t;
|
||||
|
||||
titleSafe = util::safeString(t);
|
||||
if(titleSafe.empty())
|
||||
{
|
||||
char tmp[18];
|
||||
sprintf(tmp, "%016lX", id);
|
||||
titleSafe.assign(tmp);
|
||||
}
|
||||
}
|
||||
|
||||
bool user::init(const u128& _id)
|
||||
{
|
||||
Result res = 0;
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ void drawText(const char *str, tex *target, const font *f, int x, int y, int sz,
|
|||
size_t length = strlen(str);
|
||||
for(unsigned i = 0; i < length; )
|
||||
{
|
||||
unitCnt = decode_utf8(&tmpChr, (uint8_t *)&str[i]);
|
||||
unitCnt = decode_utf8(&tmpChr, (const uint8_t *)&str[i]);
|
||||
if(unitCnt <= 0)
|
||||
break;
|
||||
|
||||
|
|
@ -152,7 +152,7 @@ size_t textGetWidth(const char *str, const font *f, int sz)
|
|||
size_t length = strlen(str);
|
||||
for(unsigned i = 0; i < length; )
|
||||
{
|
||||
untCnt = decode_utf8(&tmpChr, (uint8_t *)&str[i]);
|
||||
untCnt = decode_utf8(&tmpChr, (const uint8_t *)&str[i]);
|
||||
|
||||
if(untCnt <= 0)
|
||||
break;
|
||||
|
|
|
|||
22
src/ui.cpp
22
src/ui.cpp
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
#define TITLE_TEXT "JKSV - 08/05/2018"
|
||||
|
||||
//Secret background that can be drawn from "/JKSV/back.jpg"
|
||||
//background that can be drawn from "/JKSV/back.jpg"
|
||||
static tex *background = NULL;
|
||||
|
||||
//Nav buttons
|
||||
|
|
@ -164,28 +164,28 @@ namespace ui
|
|||
{
|
||||
//User Select
|
||||
int startX = 848;
|
||||
ui::button sel("", startX, 672, 110, 32);
|
||||
ui::button dmp("", startX += 110, 672, 110, 32);
|
||||
ui::button cls("", startX += 110, 672, 110, 32);
|
||||
ui::button sel("", startX, 656, 110, 64);
|
||||
ui::button dmp("", startX += 110, 656, 110, 64);
|
||||
ui::button cls("", startX += 110, 656, 110, 64);
|
||||
usrNav.push_back(sel);
|
||||
usrNav.push_back(dmp);
|
||||
usrNav.push_back(cls);
|
||||
|
||||
//Title
|
||||
startX = 914;
|
||||
ui::button ttlSel("", startX, 672, 110, 32);
|
||||
ui::button ttlDmp("", startX += 110, 672, 110, 32);
|
||||
ui::button ttlBck("", startX += 110, 672, 110, 32);
|
||||
ui::button ttlSel("", startX, 656, 110, 64);
|
||||
ui::button ttlDmp("", startX += 110, 656, 110, 64);
|
||||
ui::button ttlBck("", startX += 110, 656, 110, 64);
|
||||
ttlNav.push_back(ttlSel);
|
||||
ttlNav.push_back(ttlDmp);
|
||||
ttlNav.push_back(ttlBck);
|
||||
|
||||
//Folder. Skip adv since it can't be touch controlled
|
||||
startX = 800;
|
||||
ui::button fldBackup("", startX, 672, 110, 32);
|
||||
ui::button fldRestor("", startX += 110, 672, 110, 32);
|
||||
ui::button fldDelete("", startX += 110, 672, 110, 32);
|
||||
ui::button fldBack("", startX += 110, 672, 110, 32);
|
||||
ui::button fldBackup("", startX, 656, 110, 64);
|
||||
ui::button fldRestor("", startX += 110, 656, 110, 64);
|
||||
ui::button fldDelete("", startX += 110, 656, 110, 64);
|
||||
ui::button fldBack("", startX += 110, 672, 110, 64);
|
||||
fldNav.push_back(fldBackup);
|
||||
fldNav.push_back(fldRestor);
|
||||
fldNav.push_back(fldDelete);
|
||||
|
|
|
|||
|
|
@ -147,6 +147,10 @@ namespace ui
|
|||
if(confirm("Are you sure you want to overwrite \"" + folderName + "\"?"))
|
||||
{
|
||||
std::string toPath = util::getTitleDir(data::curUser, data::curData) + folderName + "/";
|
||||
//Delete and recreate
|
||||
fs::delDir(toPath);
|
||||
mkdir(toPath.c_str(), 777);
|
||||
|
||||
std::string root = "sv:/";
|
||||
|
||||
fs::copyDirToDir(root, toPath);
|
||||
|
|
|
|||
|
|
@ -74,6 +74,10 @@ namespace ui
|
|||
if(confirm("Are you sure you want to overwrite \"" + folderName + "\"?"))
|
||||
{
|
||||
std::string toPath = util::getTitleDir(data::curUser, data::curData) + folderName + "/";
|
||||
//Delete and recreate
|
||||
fs::delDir(toPath);
|
||||
mkdir(toPath.c_str(), 777);
|
||||
|
||||
std::string root = "sv:/";
|
||||
|
||||
fs::copyDirToDir(root, toPath);
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ namespace ui
|
|||
}
|
||||
}
|
||||
|
||||
for(unsigned i = 41; i < 44; i++)
|
||||
for(unsigned i = 41; i < 45; i++)
|
||||
keys[i].update(p);
|
||||
|
||||
//shift
|
||||
|
|
|
|||
10
src/util.cpp
10
src/util.cpp
|
|
@ -55,7 +55,7 @@ namespace util
|
|||
|
||||
if(textGetWidth(tmp.c_str(), ui::shared, sz) >= maxWidth)
|
||||
{
|
||||
tmp.assign(s, first, lastSpace - first);
|
||||
tmp.assign(s, first, (lastSpace + 1) - first);
|
||||
|
||||
ret += tmp + "\n";
|
||||
|
||||
|
|
@ -169,14 +169,10 @@ namespace util
|
|||
return ret;
|
||||
}
|
||||
|
||||
void debugPrintf(const char *format, ...)
|
||||
void debugPrintf(const char *out)
|
||||
{
|
||||
#ifdef __debug__
|
||||
char buff[512];
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
vsnprintf(buff, 512, format, args);
|
||||
va_end(args);
|
||||
printf("%s", out);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user