begin updating ui with freebird assets
|
|
@ -15,9 +15,6 @@ enum menuTouch
|
|||
|
||||
namespace ui
|
||||
{
|
||||
void menuPrepGfx();
|
||||
void menuDestGfx();
|
||||
|
||||
class menu
|
||||
{
|
||||
public:
|
||||
|
|
|
|||
11
inc/ui.h
|
|
@ -34,6 +34,9 @@ namespace ui
|
|||
//Current menu/ui state
|
||||
extern int mstate, prevState;
|
||||
|
||||
//Holds theme set id
|
||||
extern ColorSetId thmID;
|
||||
|
||||
//Both UI modes need access to this
|
||||
extern std::string folderMenuInfo;
|
||||
|
||||
|
|
@ -45,8 +48,9 @@ namespace ui
|
|||
extern tex *buttonA, *buttonB, *buttonX, *buttonY, *buttonMin;
|
||||
//Textbox graphics
|
||||
extern tex *cornerTopLeft, *cornerTopRight, *cornerBottomLeft, *cornerBottomRight;
|
||||
//Selection box
|
||||
extern tex *selBox;
|
||||
|
||||
//Side bar from Freebird. RIP
|
||||
extern tex *sideBar;
|
||||
|
||||
//Shared font
|
||||
extern font *shared;
|
||||
|
|
@ -68,6 +72,9 @@ namespace ui
|
|||
//Clears and draws general stuff used by multiple screens
|
||||
void drawUI();
|
||||
|
||||
//Draws selection box
|
||||
void drawBoundBox(int x, int y, int w, int h, int clrSh);
|
||||
|
||||
//switch case so we don't have problems with multiple main loops like 3DS
|
||||
void runApp(const uint64_t& down, const uint64_t& held, const touchPosition& p);
|
||||
}
|
||||
|
|
|
|||
BIN
romfs/img/fb/lDark.png
Normal file
|
After Width: | Height: | Size: 158 KiB |
BIN
romfs/img/fb/lLight.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
romfs/img/fb/menuBotLeft.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
romfs/img/fb/menuBotRight.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
romfs/img/fb/menuTopLeft.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
romfs/img/fb/menuTopRight.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 2.4 KiB |
76
src/ui.cpp
|
|
@ -27,6 +27,9 @@ namespace ui
|
|||
//Current menu state
|
||||
int mstate = USR_SEL, prevState = USR_SEL;
|
||||
|
||||
//Theme id
|
||||
ColorSetId thmID;
|
||||
|
||||
//Info printed on folder menu
|
||||
std::string folderMenuInfo;
|
||||
|
||||
|
|
@ -39,12 +42,14 @@ namespace ui
|
|||
//textbox pieces
|
||||
//I was going to flip them when I draw them, but then laziness kicked in.
|
||||
tex *cornerTopLeft, *cornerTopRight, *cornerBottomLeft, *cornerBottomRight;
|
||||
//Menu box pieces
|
||||
tex *mnuTopLeft, *mnuTopRight, *mnuBotLeft, *mnuBotRight;
|
||||
|
||||
//Button GFX
|
||||
tex *buttonA, *buttonB, *buttonX, *buttonY, *buttonMin;
|
||||
|
||||
//Select box + top left icon
|
||||
tex *selBox, *icn;
|
||||
tex *icn, *sideBar;
|
||||
|
||||
//Shared font
|
||||
font *shared;
|
||||
|
|
@ -53,10 +58,9 @@ namespace ui
|
|||
{
|
||||
shared = fontLoadSharedFonts();
|
||||
|
||||
ColorSetId gthm;
|
||||
setsysGetColorSetId(>hm);
|
||||
setsysGetColorSetId(&thmID);
|
||||
|
||||
switch(gthm)
|
||||
switch(thmID)
|
||||
{
|
||||
case ColorSetId_Light:
|
||||
//Dark corners
|
||||
|
|
@ -73,6 +77,7 @@ namespace ui
|
|||
buttonMin = texLoadPNGFile("romfs:/img/button/buttonMin_drk.png");
|
||||
|
||||
icn = texLoadPNGFile("romfs:/img/icn/icnDrk.png");
|
||||
sideBar = texLoadPNGFile("romfs:/img/fb/lLight.png");
|
||||
|
||||
clearClr = clrCreateU32(0xFFEBEBEB);
|
||||
mnuTxt = clrCreateU32(0xFF000000);
|
||||
|
|
@ -98,7 +103,9 @@ namespace ui
|
|||
buttonX = texLoadPNGFile("romfs:/img/button/buttonX_lght.png");
|
||||
buttonY = texLoadPNGFile("romfs:/img/button/buttonY_lght.png");
|
||||
buttonMin = texLoadPNGFile("romfs:/img/button/buttonMin_lght.png");
|
||||
|
||||
icn = texLoadPNGFile("romfs:/img/icn/icnLght.png");
|
||||
sideBar = texLoadPNGFile("romfs:/img/fb/lDark.png");
|
||||
|
||||
clearClr = clrCreateU32(0xFF2D2D2D);
|
||||
mnuTxt = clrCreateU32(0xFFFFFFFF);
|
||||
|
|
@ -127,9 +134,10 @@ namespace ui
|
|||
setupSelButtons();
|
||||
setupNavButtons();
|
||||
|
||||
selBox = texLoadPNGFile("romfs:/img/icn/icnSelBox.png");
|
||||
|
||||
menuPrepGfx();
|
||||
mnuTopLeft = texLoadPNGFile("romfs:/img/fb/menuTopLeft.png");
|
||||
mnuTopRight = texLoadPNGFile("romfs:/img/fb/menuTopRight.png");
|
||||
mnuBotLeft = texLoadPNGFile("romfs:/img/fb/menuBotLeft.png");
|
||||
mnuBotRight = texLoadPNGFile("romfs:/img/fb/menuBotRight.png");
|
||||
|
||||
//Setup top and bottom gfx
|
||||
texClearColor(top, clearClr);
|
||||
|
|
@ -154,16 +162,17 @@ namespace ui
|
|||
texDestroy(cornerBottomLeft);
|
||||
texDestroy(cornerBottomRight);
|
||||
|
||||
texDestroy(mnuTopLeft);
|
||||
texDestroy(mnuTopRight);
|
||||
texDestroy(mnuBotLeft);
|
||||
texDestroy(mnuBotRight);
|
||||
|
||||
texDestroy(buttonA);
|
||||
texDestroy(buttonB);
|
||||
texDestroy(buttonX);
|
||||
texDestroy(buttonY);
|
||||
texDestroy(buttonMin);
|
||||
|
||||
texDestroy(selBox);
|
||||
|
||||
menuDestGfx();
|
||||
|
||||
fontDestroy(shared);
|
||||
}
|
||||
|
||||
|
|
@ -227,7 +236,7 @@ namespace ui
|
|||
switch(mstate)
|
||||
{
|
||||
case FLD_SEL:
|
||||
drawRect(frameBuffer, 30, 88, 320, 560, sideRect);
|
||||
texDrawNoAlpha(sideBar, frameBuffer, 0, 88);
|
||||
break;
|
||||
|
||||
case ADV_MDE:
|
||||
|
|
@ -238,7 +247,7 @@ namespace ui
|
|||
case CLS_USR:
|
||||
case CLS_FLD:
|
||||
case EX_MNU:
|
||||
drawRect(frameBuffer, 30, 88, 448, 560, sideRect);
|
||||
texDrawNoAlpha(sideBar, frameBuffer, 0, 88);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -298,6 +307,47 @@ namespace ui
|
|||
}
|
||||
}
|
||||
|
||||
void drawBoundBox(int x, int y, int w, int h, int clrSh)
|
||||
{
|
||||
clr rectClr = clrCreateRGBA(0x00, 0x88 + clrSh, 0xC5, 0xFF);
|
||||
|
||||
texSwapColors(mnuTopLeft, clrCreateRGBA(0x00, 0x88, 0xC5, 0xFF), rectClr);
|
||||
texSwapColors(mnuTopRight, clrCreateRGBA(0x00, 0x88, 0xC5, 0xFF), rectClr);
|
||||
texSwapColors(mnuBotLeft, clrCreateRGBA(0x00, 0x88, 0xC5, 0xFF), rectClr);
|
||||
texSwapColors(mnuBotRight, clrCreateRGBA(0x00, 0x88, 0xC5, 0xFF), rectClr);
|
||||
|
||||
switch(ui::thmID)
|
||||
{
|
||||
case ColorSetId_Light:
|
||||
drawRect(frameBuffer, x + 4, y + 4, w - 8, h - 8, clrCreateU32(0xFFFDFDFD));
|
||||
break;
|
||||
|
||||
default:
|
||||
case ColorSetId_Dark:
|
||||
drawRect(frameBuffer, x + 4, y + 4, w - 8, h - 8, clrCreateU32(0xFF272221));
|
||||
break;
|
||||
}
|
||||
|
||||
//top
|
||||
texDraw(mnuTopLeft, frameBuffer, x, y);
|
||||
drawRect(frameBuffer, x + 4, y, w - 8, 4, rectClr);
|
||||
texDraw(mnuTopRight, frameBuffer, (x + w) - 4, y);
|
||||
|
||||
//mid
|
||||
drawRect(frameBuffer, x, y + 4, 4, h - 8, rectClr);
|
||||
drawRect(frameBuffer, (x + w) - 4, y + 4, 4, h - 8, rectClr);
|
||||
|
||||
//bottom
|
||||
texDraw(mnuBotLeft, frameBuffer, x, (y + h) - 4);
|
||||
drawRect(frameBuffer, x + 4, (y + h) - 4, w - 8, 4, rectClr);
|
||||
texDraw(mnuBotRight, frameBuffer, (x + w) - 4, (y + h) - 4);
|
||||
|
||||
texSwapColors(mnuTopLeft, rectClr, clrCreateRGBA(0x00, 0x88, 0xC5, 0xFF));
|
||||
texSwapColors(mnuTopRight, rectClr, clrCreateRGBA(0x00, 0x88, 0xC5, 0xFF));
|
||||
texSwapColors(mnuBotLeft, rectClr, clrCreateRGBA(0x00, 0x88, 0xC5, 0xFF));
|
||||
texSwapColors(mnuBotRight, rectClr, clrCreateRGBA(0x00, 0x88, 0xC5, 0xFF));
|
||||
}
|
||||
|
||||
void runApp(const uint64_t& down, const uint64_t& held, const touchPosition& p)
|
||||
{
|
||||
//Draw first. Shouldn't, but it simplifies the showX functions
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ namespace ui
|
|||
{
|
||||
userMenu.reset();
|
||||
|
||||
userMenu.setParams(42, 98, 424);
|
||||
userMenu.setParams(76, 98, 310);
|
||||
|
||||
for(unsigned i = 0; i < data::users.size(); i++)
|
||||
userMenu.addOpt(data::users[i].getUsername());
|
||||
|
|
@ -30,7 +30,7 @@ namespace ui
|
|||
void clsTitlePrep(data::user& u)
|
||||
{
|
||||
titleMenu.reset();
|
||||
titleMenu.setParams(42, 98, 424);
|
||||
titleMenu.setParams(76, 98, 310);
|
||||
|
||||
for(unsigned i = 0; i < u.titles.size(); i++)
|
||||
titleMenu.addOpt(u.titles[i].getTitle());
|
||||
|
|
@ -38,7 +38,7 @@ namespace ui
|
|||
|
||||
void clsFolderPrep(data::user& usr, data::titledata& dat)
|
||||
{
|
||||
folderMenu.setParams(488, 98, 762);
|
||||
folderMenu.setParams(466, 98, 730);
|
||||
folderMenu.reset();
|
||||
|
||||
util::makeTitleDir(usr, dat);
|
||||
|
|
@ -243,7 +243,7 @@ namespace ui
|
|||
void exMenuPrep()
|
||||
{
|
||||
devMenu.reset();
|
||||
devMenu.setParams(42, 98, 424);
|
||||
devMenu.setParams(76, 98, 310);
|
||||
devMenu.addOpt("SD to SD Browser");
|
||||
devMenu.addOpt("Bis: PRODINFOF");
|
||||
devMenu.addOpt("Bis: SAFE");
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ namespace ui
|
|||
{
|
||||
void folderMenuPrepare(data::user& usr, data::titledata& dat)
|
||||
{
|
||||
folderMenu.setParams(356, 98, 894);
|
||||
folderMenu.setParams(466, 98, 730);
|
||||
folderMenu.reset();
|
||||
|
||||
util::makeTitleDir(usr, dat);
|
||||
|
|
@ -39,8 +39,8 @@ namespace ui
|
|||
//Draw folder menu
|
||||
folderMenu.draw(mnuTxt);
|
||||
|
||||
data::curData.icon.draw(62, 98);
|
||||
drawTextWrap(folderMenuInfo.c_str(), frameBuffer, ui::shared, 46, 370, 18, ui::mnuTxt, 224);
|
||||
data::curData.icon.draw(96, 98);
|
||||
drawTextWrap(folderMenuInfo.c_str(), frameBuffer, ui::shared, 64, 370, 18, ui::mnuTxt, 224);
|
||||
|
||||
if(down & KEY_A || fldNav[0].getEvent() == BUTTON_RELEASED || folderMenu.getTouchEvent() == MENU_DOUBLE_REL)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,57 +6,8 @@
|
|||
#include "ui.h"
|
||||
#include "miscui.h"
|
||||
|
||||
static tex *mnuTopLeft, *mnuTopRight, *mnuBotLeft, *mnuBotRight;
|
||||
|
||||
static void drawBoundBox(int x, int y, int w, int h, int clrSh)
|
||||
{
|
||||
clr rectClr = clrCreateRGBA(0x00, 0x60 + clrSh, 0xBB + clrSh, 0xFF);
|
||||
|
||||
texSwapColors(mnuTopLeft, clrCreateRGBA(0x00, 0x60, 0xBB, 0xFF), rectClr);
|
||||
texSwapColors(mnuTopRight, clrCreateRGBA(0x00, 0x60, 0xBB, 0xFF), rectClr);
|
||||
texSwapColors(mnuBotLeft, clrCreateRGBA(0x00, 0x60, 0xBB, 0xFF), rectClr);
|
||||
texSwapColors(mnuBotRight, clrCreateRGBA(0x00, 0x60, 0xBB, 0xFF), rectClr);
|
||||
|
||||
//top
|
||||
texDraw(mnuTopLeft, frameBuffer, x, y);
|
||||
drawRect(frameBuffer, x + 8, y, w - 16, 2, rectClr);
|
||||
texDraw(mnuTopRight, frameBuffer, (x + w) - 8, y);
|
||||
|
||||
//mid
|
||||
drawRect(frameBuffer, x, y + 8, 2, h - 16, rectClr);
|
||||
drawRect(frameBuffer, (x + w) - 2, y + 8, 2, h - 16, rectClr);
|
||||
|
||||
//bottom
|
||||
texDraw(mnuBotLeft, frameBuffer, x, (y + h) - 8);
|
||||
drawRect(frameBuffer, x + 8, (y + h) - 2, w - 16, 2, rectClr);
|
||||
texDraw(mnuBotRight, frameBuffer, (x + w) - 8, (y + h) - 8);
|
||||
|
||||
texSwapColors(mnuTopLeft, rectClr, clrCreateRGBA(0x00, 0x60, 0xBB, 0xFF));
|
||||
texSwapColors(mnuTopRight, rectClr, clrCreateRGBA(0x00, 0x60, 0xBB, 0xFF));
|
||||
texSwapColors(mnuBotLeft, rectClr, clrCreateRGBA(0x00, 0x60, 0xBB, 0xFF));
|
||||
texSwapColors(mnuBotRight, rectClr, clrCreateRGBA(0x00, 0x60, 0xBB, 0xFF));
|
||||
}
|
||||
|
||||
namespace ui
|
||||
{
|
||||
void menuPrepGfx()
|
||||
{
|
||||
tex *temp = texLoadPNGFile("romfs:/img/mnu/msel.png");
|
||||
mnuTopLeft = texCreateFromPart(temp, 0, 0, 8, 8);
|
||||
mnuTopRight = texCreateFromPart(temp, 8, 0, 8, 8);
|
||||
mnuBotLeft = texCreateFromPart(temp, 0, 8, 8, 8);
|
||||
mnuBotRight = texCreateFromPart(temp, 8, 8, 8, 8);
|
||||
texDestroy(temp);
|
||||
}
|
||||
|
||||
void menuDestGfx()
|
||||
{
|
||||
texDestroy(mnuTopLeft);
|
||||
texDestroy(mnuTopRight);
|
||||
texDestroy(mnuBotLeft);
|
||||
texDestroy(mnuBotRight);
|
||||
}
|
||||
|
||||
void menu::setParams(const unsigned& _x, const unsigned& _y, const unsigned& _rW)
|
||||
{
|
||||
x = _x;
|
||||
|
|
@ -196,14 +147,14 @@ namespace ui
|
|||
{
|
||||
if(clrAdd)
|
||||
{
|
||||
clrSh += 4;
|
||||
if(clrSh > 63)
|
||||
clrSh += 6;
|
||||
if(clrSh >= 0x72)
|
||||
clrAdd = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
clrSh--;
|
||||
if(clrSh == 0)
|
||||
clrSh -= 3;
|
||||
if(clrSh <= 0x00)
|
||||
clrAdd = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,31 +25,23 @@ namespace ui
|
|||
static bool clrAdd = true;
|
||||
|
||||
//Selected rectangle X and Y.
|
||||
static unsigned selRectX = 64, selRectY = 92;
|
||||
static unsigned selRectX = 66, selRectY = 94;
|
||||
|
||||
static ui::touchTrack track;
|
||||
|
||||
//Color swapping
|
||||
clr clrPrev = clrCreateRGBA(0x00, 0x60 + clrShft, 0xBB + clrShft, 0xFF);
|
||||
|
||||
if(clrAdd)
|
||||
{
|
||||
clrShft += 6;
|
||||
if(clrShft > 63)
|
||||
if(clrShft >= 0x72)
|
||||
clrAdd = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
clrShft--;
|
||||
if(clrShft == 0)
|
||||
clrShft -= 3;
|
||||
if(clrShft <= 0)
|
||||
clrAdd = true;
|
||||
}
|
||||
|
||||
//Updated sel
|
||||
clr clrUpdt = clrCreateRGBA(0x00, 0x60 + clrShft, 0xBB + clrShft, 0xFF);
|
||||
|
||||
texSwapColors(ui::selBox, clrPrev, clrUpdt);
|
||||
|
||||
unsigned x = 70, y = 98;
|
||||
|
||||
unsigned endTitle = start + 32;
|
||||
|
|
@ -57,7 +49,7 @@ namespace ui
|
|||
endTitle = data::curUser.titles.size();
|
||||
|
||||
//draw Rect so it's always behind icons
|
||||
texDraw(ui::selBox, frameBuffer, selRectX, selRectY);
|
||||
drawBoundBox(selRectX, selRectY, 140, 140, clrShft);
|
||||
|
||||
for(unsigned i = start; i < endTitle; y += 136)
|
||||
{
|
||||
|
|
@ -69,11 +61,8 @@ namespace ui
|
|||
|
||||
if((int)i == selected)
|
||||
{
|
||||
if(selRectX != tX - 6 || selRectY != y - 6)
|
||||
{
|
||||
selRectX = tX - 6;
|
||||
selRectY = y - 6;
|
||||
}
|
||||
selRectX = tX - 6;
|
||||
selRectY = y - 6;
|
||||
|
||||
std::string title = data::curUser.titles[selected].getTitle();
|
||||
unsigned titleWidth = textGetWidth(title.c_str(), ui::shared, 16);
|
||||
|
|
|
|||
|
|
@ -19,36 +19,29 @@ namespace ui
|
|||
static uint8_t clrShft = 0;
|
||||
static bool clrAdd = true;
|
||||
|
||||
static unsigned selRectX = 64, selRectY = 92;
|
||||
static unsigned selRectX = 66, selRectY = 94;
|
||||
|
||||
static ui::touchTrack track;
|
||||
|
||||
//Color swapping selBox
|
||||
clr clrPrev = clrCreateRGBA(0x00, 0x60 + clrShft, 0xBB + clrShft, 0xFF);
|
||||
|
||||
if(clrAdd)
|
||||
{
|
||||
clrShft += 6;
|
||||
if(clrShft > 63)
|
||||
if(clrShft >= 0x72)
|
||||
clrAdd = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
clrShft--;
|
||||
if(clrShft == 0)
|
||||
clrShft -= 3;
|
||||
if(clrShft <= 0)
|
||||
clrAdd = true;
|
||||
}
|
||||
|
||||
//Update selBox color
|
||||
clr clrUpdt = clrCreateRGBA(0x00, 0x60 + clrShft, 0xBB + clrShft, 0xFF);
|
||||
|
||||
unsigned x = 70, y = 98;
|
||||
unsigned endUser = start + 32;
|
||||
if(start + 32 > (int)data::users.size())
|
||||
endUser = data::users.size();
|
||||
|
||||
texSwapColors(ui::selBox, clrPrev, clrUpdt);
|
||||
texDraw(ui::selBox, frameBuffer, selRectX, selRectY);
|
||||
drawBoundBox(selRectX, selRectY, 140, 140, clrShft);
|
||||
|
||||
for(unsigned i = start; i < endUser; y += 136)
|
||||
{
|
||||
|
|
@ -60,11 +53,8 @@ namespace ui
|
|||
|
||||
if((int)i == selected)
|
||||
{
|
||||
if(selRectX != tX - 6 || selRectY != y - 6)
|
||||
{
|
||||
selRectX = tX - 6;
|
||||
selRectY = y - 6;
|
||||
}
|
||||
selRectX = tX - 6;
|
||||
selRectY = y - 6;
|
||||
|
||||
std::string username = data::users[selected].getUsername();
|
||||
unsigned userWidth = textGetWidth(username.c_str(), ui::shared, 16);
|
||||
|
|
|
|||