my latest work.

This commit is contained in:
StackZ
2019-12-23 21:10:22 +01:00
parent 350401b357
commit 7351204b9a
11 changed files with 114 additions and 60 deletions
+1
View File
@@ -3,6 +3,7 @@
sprites/arrow.png
sprites/bottom_screen_bot.png
sprites/bottom_screen_top.png
sprites/download_all.png
sprites/top_screen_bot.png
sprites/top_screen_top.png
sprites/search.png
Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 723 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 456 B

After

Width:  |  Height:  |  Size: 10 KiB

+1 -1
View File
@@ -46,7 +46,7 @@ namespace Gui
// Draw a Sprite from the sheet.
void sprite(int key, int x, int y, float ScaleX = 1, float ScaleY = 1);
void spriteBlend(int key, int x, int y, float ScaleX = 1, float ScaleY = 1);
void DrawArrow(int x, int y, float rotation = 0);
// Misc.
+1
View File
@@ -52,6 +52,7 @@ private:
{295, 0, 25, 25, -1}, // Arrow Up.
{295, 215, 25, 25, -1}, // Arrow Down.
{0, 215, 25, 25, -1}, // Back Arrow.
{0, 0, 25, 25, -1}, // Download All.
};
};
+32 -1
View File
@@ -91,13 +91,44 @@ void Gui::sprite(int key, int x, int y, float ScaleX, float ScaleY)
C2D_DrawImageAt(C2D_SpriteSheetGetImage(sprites, key), x, y, 0.5f, NULL, ScaleX, ScaleY);
}
void Gui::spriteBlend(int key, int x, int y, float ScaleX, float ScaleY)
{
C2D_ImageTint tint;
if (isScriptSelected) {
C2D_SetImageTint(&tint, C2D_TopLeft, TextColor, 0.5);
C2D_SetImageTint(&tint, C2D_TopRight, TextColor, 0.5);
C2D_SetImageTint(&tint, C2D_BotLeft, TextColor, 0.5);
C2D_SetImageTint(&tint, C2D_BotRight, TextColor, 0.5);
} else {
C2D_SetImageTint(&tint, C2D_TopLeft, Config::TxtColor, 0.5);
C2D_SetImageTint(&tint, C2D_TopRight, Config::TxtColor, 0.5);
C2D_SetImageTint(&tint, C2D_BotLeft, Config::TxtColor, 0.5);
C2D_SetImageTint(&tint, C2D_BotRight, Config::TxtColor, 0.5);
}
C2D_DrawImageAt(C2D_SpriteSheetGetImage(sprites, key), x, y, 0.5f, &tint, ScaleX, ScaleY);
}
void Gui::DrawArrow(int x, int y, float rotation) {
C2D_Sprite sprite;
C2D_ImageTint tint;
if (isScriptSelected) {
C2D_SetImageTint(&tint, C2D_TopLeft, TextColor, 0.5);
C2D_SetImageTint(&tint, C2D_TopRight, TextColor, 0.5);
C2D_SetImageTint(&tint, C2D_BotLeft, TextColor, 0.5);
C2D_SetImageTint(&tint, C2D_BotRight, TextColor, 0.5);
} else {
C2D_SetImageTint(&tint, C2D_TopLeft, Config::TxtColor, 0.5);
C2D_SetImageTint(&tint, C2D_TopRight, Config::TxtColor, 0.5);
C2D_SetImageTint(&tint, C2D_BotLeft, Config::TxtColor, 0.5);
C2D_SetImageTint(&tint, C2D_BotRight, Config::TxtColor, 0.5);
}
C2D_SpriteFromSheet(&sprite, sprites, sprites_arrow_idx);
C2D_SpriteRotateDegrees(&sprite, rotation);
C2D_SpriteSetPos(&sprite, x, y);
C2D_SpriteSetDepth(&sprite, 0.5);
C2D_DrawSprite(&sprite);
C2D_DrawSpriteTinted(&sprite, &tint);
}
void Gui::DisplayWarnMsg(std::string Text)
+1 -1
View File
@@ -122,7 +122,7 @@ std::string Input::Numpad(uint maxLength, std::string Text)
C2D_TargetClear(bottom, BLACK);
Gui::DrawTop();
Gui::DrawString((400-Gui::GetStringWidth(0.55f, Text))/2, 2, 0.55f, WHITE, Text, 400);
Gui::DrawString(180, 212, 0.8, WHITE, (string+(cursorBlink-- > 0 ? "_" : "")).c_str(), 400);
Gui::DrawString(180, 217, 0.8, WHITE, (string+(cursorBlink-- > 0 ? "_" : "")).c_str(), 400);
if(cursorBlink < -20) cursorBlink = 20;
Gui::setDraw(bottom);
Gui::Draw_Rect(0, 0, 320, 240, Config::Color3);
+25 -6
View File
@@ -126,11 +126,11 @@ void ScriptBrowse::Draw(void) const {
Gui::DrawStringCentered(0, 217, 0.7f, Config::TxtColor, Lang::get("FUTURE_SCRIPT"), 400);
}
Gui::DrawBottom();
Gui::DrawArrow(295, 0);
Gui::DrawArrow(315, 240, 180.0);
// Gui::sprite(sprites_search_idx, -3, 0);
// Gui::DrawString(7.5, 1.5, 0.72f, BLACK, "\uE003");
Gui::DrawArrow(295, -3);
Gui::DrawArrow(315, 242, 180.0);
// Gui::spriteBlend(sprites_search_idx, -3, 0, Config::TxtColor);
// Gui::DrawString(7.5, 1.5, 0.72f, Config::TxtColor, "\uE003");
Gui::spriteBlend(sprites_download_all_idx, 0, 0);
Gui::DrawArrow(0, 242, 270.0);
Gui::DrawStringCentered(-23, 3, 0.6f, Config::TxtColor, std::to_string(selection + 1) + " / " + maxScripts);
@@ -232,7 +232,7 @@ void ScriptBrowse::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
if (infoJson.size() != 0) {
std::string fileName = Lang::get("DOWNLOADING") + std::string(infoJson[screenPos + i]["title"]);
std::string titleFix = infoJson[screenPos + i]["title"];
for (int l = 0; i < (int)titleFix.size(); l++) {
for (int l = 0; l < (int)titleFix.size(); l++) {
if (titleFix[l] == '/') {
titleFix[l] = '-';
}
@@ -328,4 +328,23 @@ void ScriptBrowse::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
}
}
}
if (hDown & KEY_TOUCH && touching(touch, arrowPos[3])) {
if (infoJson.size() != 0) {
for (int i = 0; i < (int)infoJson.size(); i++) {
int current = i+1;
int total = infoJson.size();
std::string fileName = Lang::get("DOWNLOADING") + std::string(infoJson[i]["title"]);
std::string titleFix = infoJson[i]["title"];
for (int l = 0; l < (int)titleFix.size(); l++) {
if (titleFix[l] == '/') {
titleFix[l] = '-';
}
}
DisplayMsg(fileName + " " + std::to_string(current) + " / " + std::to_string(total));
downloadToFile(infoJson[i]["url"], Config::ScriptPath + titleFix + ".json");
infoJson[i]["curRevision"] = infoJson[i]["revision"];
}
}
}
}
+4 -4
View File
@@ -284,8 +284,8 @@ void ScriptList::DrawList(void) const {
Gui::DrawStringCentered(0, 120, 0.6f, Config::TxtColor, std::string(fileInfo[selection].shortDesc), 400);
Gui::DrawBottom();
Gui::DrawArrow(295, 0);
Gui::DrawArrow(315, 240, 180.0);
Gui::DrawArrow(295, -3);
Gui::DrawArrow(315, 242, 180.0);
Gui::DrawArrow(0, 242, 270.0);
if (Config::viewMode == 0) {
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)fileInfo.size();i++) {
@@ -339,8 +339,8 @@ void ScriptList::DrawSingleObject(void) const {
Gui::DrawStringCentered(0, 120-((lines.size()*20)/2)+i*20, 0.6f, TextColor, lines[i], 400);
}
Gui::DrawBottom();
Gui::DrawArrow(295, 0);
Gui::DrawArrow(315, 240, 180.0);
Gui::DrawArrow(295, -3);
Gui::DrawArrow(315, 242, 180.0);
Gui::DrawArrow(0, 242, 270.0);
if (Config::viewMode == 0) {
+4 -2
View File
@@ -105,8 +105,8 @@ void TinyDB::Draw(void) const {
Gui::sprite(sprites_bottom_screen_top_idx, 0, 0);
Gui::sprite(sprites_bottom_screen_bot_idx, 0, 215);
Gui::DrawArrow(295, 0);
Gui::DrawArrow(315, 240, 180.0);
Gui::DrawArrow(295, -3);
Gui::DrawArrow(315, 242, 180.0);
Gui::DrawArrow(0, 242, 270.0);
// Search Icon.
// Gui::sprite(sprites_search_idx, -3, 0);
@@ -127,6 +127,8 @@ void TinyDB::Draw(void) const {
info = tinyDBList[screenPosList + i];
if(screenPosList + i == selection) {
Gui::Draw_Rect(0, (i+1)*27, 320, 25, Config::SelectedColor);
} else {
Gui::Draw_Rect(0, (i+1)*27, 320, 25, Config::UnselectedColor);
}
Gui::DrawStringCentered(0, ((i+1)*27)+1, 0.7f, Config::TxtColor, info, 320);
}