mirror of
https://gitlab.com/Nanolx/homebrewfilter.git
synced 2024-11-24 10:09:21 +01:00
update libwiigui from ZERO
This commit is contained in:
parent
d1ade32268
commit
56192d0a98
Binary file not shown.
@ -55,22 +55,29 @@ void Category_rename_move(string button)
|
||||
|
||||
void Next_Category()
|
||||
{
|
||||
int prev_cat = Settings.current_category;
|
||||
|
||||
Settings.current_category++;
|
||||
if(Settings.current_category > (signed)AvailableCategory.categories.size() -1)
|
||||
Settings.current_category = 0;
|
||||
|
||||
// Kategorie Alle nur anzeigen, wenn aktiviert oder keine andere vorhanden ist
|
||||
if(!Options.show_all && Settings.current_category == 0 && AvailableCategory.categories.size() -1 > 0)
|
||||
Settings.current_category++;
|
||||
if(Settings.current_category != prev_cat)
|
||||
{
|
||||
|
||||
Settings.current_page = 1;
|
||||
Settings.unassigned = false;
|
||||
if(Settings.current_category > (signed)AvailableCategory.categories.size() -1)
|
||||
Settings.current_category = 0;
|
||||
|
||||
if(Settings.current_category != 0)
|
||||
copy_app_in_category();
|
||||
// Kategorie Alle nur anzeigen, wenn aktiviert oder keine andere vorhanden ist
|
||||
if(!Options.show_all && Settings.current_category == 0 && AvailableCategory.categories.size() -1 > 0)
|
||||
Settings.current_category++;
|
||||
|
||||
Settings.Apps_from = EFFECT_SLIDE_RIGHT;
|
||||
Settings.Apps_to = EFFECT_SLIDE_LEFT;
|
||||
Settings.current_page = 1;
|
||||
Settings.unassigned = false;
|
||||
|
||||
if(Settings.current_category != 0)
|
||||
copy_app_in_category();
|
||||
|
||||
Settings.Apps_from = EFFECT_SLIDE_RIGHT;
|
||||
Settings.Apps_to = EFFECT_SLIDE_LEFT;
|
||||
}
|
||||
}
|
||||
|
||||
void Previous_Category()
|
||||
|
@ -6,29 +6,31 @@ void copy_app_in_unassigned()
|
||||
{
|
||||
vector<string> apps;
|
||||
vechomebrew_list_unassigned.clear();
|
||||
|
||||
|
||||
for(int a = 1; a < (signed)AvailableCategory.categories.size(); a++)
|
||||
for(int b = 0; b < (signed)AvailableCategory.apps[a].size(); b++)
|
||||
apps.push_back(AvailableCategory.apps[a][b]);
|
||||
|
||||
|
||||
for(int i = 0; i < (signed)vechomebrew_list_category[0].size(); i++)
|
||||
{
|
||||
bool present = true;
|
||||
|
||||
|
||||
int anzahl_device = 0, anzahl_ordner = 0;
|
||||
|
||||
|
||||
// Geräte SD, USB
|
||||
if(Settings.device == "sd1" || Settings.device == "usb1")
|
||||
anzahl_device = 1;
|
||||
else if(Settings.device == "sd_usb")
|
||||
anzahl_device = 2;
|
||||
|
||||
else if(Settings.device == "all")
|
||||
anzahl_device = 3;
|
||||
|
||||
// Ordner APPS, GC_APPS
|
||||
if(Settings.system == 1 || Settings.system == 0)
|
||||
anzahl_ordner = 1;
|
||||
else if(Settings.system == 2)
|
||||
anzahl_ordner = 2;
|
||||
|
||||
|
||||
for(int x = 0; x < anzahl_device; x++)
|
||||
{
|
||||
for(int y = 0; y < anzahl_ordner; y++)
|
||||
@ -44,7 +46,7 @@ void copy_app_in_unassigned()
|
||||
ordner = ":/apps/";
|
||||
else if(Settings.system == 2 && y == 1)
|
||||
ordner = ":/gc_apps/";
|
||||
|
||||
|
||||
if(anzahl_device == 1)
|
||||
foldername = Settings.device + ordner + apps[a] + "/";
|
||||
else
|
||||
@ -53,8 +55,10 @@ void copy_app_in_unassigned()
|
||||
foldername = "sd1" + ordner + apps[a] + "/";
|
||||
else if(x == 1)
|
||||
foldername = "usb1" + ordner + apps[a] + "/";
|
||||
else if(x == 2)
|
||||
foldername = "dvd" + ordner + apps[a] + "/";
|
||||
}
|
||||
|
||||
|
||||
if(
|
||||
strcasecmp(vechomebrew_list_category[0][i].foldername.c_str(), foldername.c_str()) == 0 ||
|
||||
strcasecmp(vechomebrew_list_category[0][i].foldername.c_str(), "the homebrew channel") == 0
|
||||
@ -63,7 +67,7 @@ void copy_app_in_unassigned()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(present)
|
||||
{
|
||||
vechomebrew_list_unassigned.push_back(homebrew_list(
|
||||
@ -82,25 +86,27 @@ void copy_app_in_category(int category) //Apps im Kategorie kopieren
|
||||
{
|
||||
copy_app_in_unassigned();
|
||||
vechomebrew_list_category[category].clear();
|
||||
|
||||
|
||||
for(int a = 0; a < (signed)AvailableCategory.apps[category].size(); a++)
|
||||
{
|
||||
{
|
||||
for(int i = 0; i < (signed)vechomebrew_list_category[0].size(); i++)
|
||||
{
|
||||
int anzahl_device = 0, anzahl_ordner = 0;
|
||||
|
||||
|
||||
// Geräte SD, USB
|
||||
if(Settings.device == "sd1" || Settings.device == "usb1")
|
||||
anzahl_device = 1;
|
||||
else if(Settings.device == "sd_usb")
|
||||
anzahl_device = 2;
|
||||
|
||||
else if(Settings.device == "all")
|
||||
anzahl_device = 3;
|
||||
|
||||
// Ordner APPS, GC_APPS
|
||||
if(Settings.system == 1 || Settings.system == 0)
|
||||
anzahl_ordner = 1;
|
||||
else if(Settings.system == 2)
|
||||
anzahl_ordner = 2;
|
||||
|
||||
|
||||
for(int x = 0; x < anzahl_device; x++ )
|
||||
{
|
||||
for(int y = 0; y < anzahl_ordner; y++ )
|
||||
@ -114,7 +120,7 @@ void copy_app_in_category(int category) //Apps im Kategorie kopieren
|
||||
ordner = ":/apps/";
|
||||
else if(Settings.system == 2 && y == 1)
|
||||
ordner = ":/gc_apps/";
|
||||
|
||||
|
||||
if(anzahl_device == 1)
|
||||
foldername = Settings.device + ordner + AvailableCategory.apps[category][a] + "/";
|
||||
else
|
||||
@ -123,14 +129,16 @@ void copy_app_in_category(int category) //Apps im Kategorie kopieren
|
||||
foldername = "sd1" + ordner + AvailableCategory.apps[category][a] + "/";
|
||||
else if(x == 1)
|
||||
foldername = "usb1" + ordner + AvailableCategory.apps[category][a] + "/";
|
||||
else if(x == 2)
|
||||
foldername = "dvd" + ordner + AvailableCategory.apps[category][a] + "/";
|
||||
}
|
||||
|
||||
|
||||
if(
|
||||
strcasecmp(vechomebrew_list_category[0][i].foldername.c_str(), foldername.c_str()) == 0 ||
|
||||
strcasecmp(AvailableCategory.apps[category][a].c_str(), "the homebrew channel") == 0
|
||||
)
|
||||
{
|
||||
|
||||
|
||||
vechomebrew_list_category[category].push_back(homebrew_list(
|
||||
vechomebrew_list_category[0][i].name,
|
||||
vechomebrew_list_category[0][i].info,
|
||||
@ -139,7 +147,7 @@ void copy_app_in_category(int category) //Apps im Kategorie kopieren
|
||||
vechomebrew_list_category[0][i].pathboot,
|
||||
vechomebrew_list_category[0][i].arg
|
||||
));
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +100,8 @@ enum
|
||||
TRIGGER_SIMPLE,
|
||||
TRIGGER_HELD,
|
||||
TRIGGER_BUTTON_ONLY,
|
||||
TRIGGER_BUTTON_ONLY_IN_FOCUS
|
||||
TRIGGER_BUTTON_ONLY_IN_FOCUS,
|
||||
TRIGGER_BUTTON_ONLY_HELD
|
||||
};
|
||||
|
||||
enum
|
||||
@ -123,6 +124,11 @@ typedef struct _paddata {
|
||||
u8 triggerR;
|
||||
} PADData;
|
||||
|
||||
typedef struct _POINT {
|
||||
s32 x;
|
||||
s32 y;
|
||||
} POINT;
|
||||
|
||||
#define EFFECT_SLIDE_TOP 1
|
||||
#define EFFECT_SLIDE_BOTTOM 2
|
||||
#define EFFECT_SLIDE_RIGHT 4
|
||||
@ -193,6 +199,7 @@ class GuiTrigger
|
||||
//!\param wiibtns Wii controller trigger button(s) - classic controller buttons are considered separately
|
||||
//!\param gcbtns GameCube controller trigger button(s)
|
||||
void SetButtonOnlyTrigger(s32 ch, u32 wiibtns, u16 gcbtns);
|
||||
void SetButtonOnlyHeldTrigger(s32 ch, u32 wiibtns, u16 gcbtns);
|
||||
//!Sets a button-only trigger. Requires: trigger button is pressed and parent window of element is in focus
|
||||
//!\param ch Controller channel number
|
||||
//!\param wiibtns Wii controller trigger button(s) - classic controller buttons are considered separately
|
||||
@ -225,6 +232,15 @@ class GuiTrigger
|
||||
|
||||
extern GuiTrigger userInput[4];
|
||||
|
||||
class SimpleGuiTrigger : public GuiTrigger
|
||||
{
|
||||
public:
|
||||
SimpleGuiTrigger(s32 ch, u32 wiibtns, u16 gcbtns)
|
||||
{
|
||||
SetSimpleTrigger(ch, wiibtns, gcbtns);
|
||||
}
|
||||
};
|
||||
|
||||
//!Primary GUI class. Most other classes inherit from this class.
|
||||
class GuiElement
|
||||
{
|
||||
@ -321,9 +337,27 @@ class GuiElement
|
||||
//!Sets the element's scale
|
||||
//!\param s scale (1 is 100%)
|
||||
void SetScale(float s);
|
||||
//!Sets the element's scale
|
||||
//!\param s scale (1 is 100%)
|
||||
void SetScaleX(float s);
|
||||
//!Sets the element's scale
|
||||
//!\param s scale (1 is 100%)
|
||||
void SetScaleY(float s);
|
||||
//!Sets the element's scale
|
||||
//!\param s scale (in px)
|
||||
void SetScaleXpx(int s);
|
||||
//!Sets the element's scale
|
||||
//!\param s scale (in px)
|
||||
void SetScaleYpx(int s);
|
||||
//!Gets the element's current scale
|
||||
//!Considers scale, scaleDyn, and the parent element's GetScale() value
|
||||
float GetScale();
|
||||
//!Gets the element's current scale
|
||||
//!Considers scale, scaleDyn, and the parent element's GetScale() value
|
||||
float GetScaleX();
|
||||
//!Gets the element's current scale
|
||||
//!Considers scale, scaleDyn, and the parent element's GetScale() value
|
||||
float GetScaleY();
|
||||
//!Set a new GuiTrigger for the element
|
||||
//!\param t Pointer to GuiTrigger
|
||||
void SetTrigger(GuiTrigger * t);
|
||||
@ -409,7 +443,8 @@ class GuiElement
|
||||
int xoffsetDyn; //!< Element X offset, dynamic (added to xoffset value for animation effects)
|
||||
int yoffsetDyn; //!< Element Y offset, dynamic (added to yoffset value for animation effects)
|
||||
int alpha; //!< Element alpha value (0-255)
|
||||
f32 scale; //!< Element scale (1 = 100%)
|
||||
f32 scaleX; //!< Element scale (1 = 100%)
|
||||
f32 scaleY; //!< Element scale (1 = 100%)
|
||||
int alphaDyn; //!< Element alpha, dynamic (multiplied by alpha value for blending/fading effects)
|
||||
f32 scaleDyn; //!< Element scale, dynamic (multiplied by alpha value for blending/fading effects)
|
||||
bool rumble; //!< Wiimote rumble (on/off) - set to on when this element requests a rumble event
|
||||
@ -562,6 +597,12 @@ class GuiImage : public GuiElement
|
||||
//!Sets the number of times to draw the image horizontally
|
||||
//!\param t Number of times to draw the image
|
||||
void SetTile(int t);
|
||||
//!Sets the number of times to draw the image horizontally
|
||||
//!\param t Number of times to draw the image
|
||||
void SetTileHorizontal(int t);
|
||||
//!Sets the number of times to draw the image vertically
|
||||
//!\param t Number of times to draw the image
|
||||
void SetTileVertical(int t);
|
||||
//!Constantly called to draw the image
|
||||
void Draw();
|
||||
//!Gets the image data
|
||||
@ -595,6 +636,8 @@ class GuiImage : public GuiElement
|
||||
//!\param s Alpha amount to draw over the image
|
||||
void SetStripe(int s);
|
||||
protected:
|
||||
int tileHorizontal; //!< Number of times to draw (tile) the image horizontally
|
||||
int tileVertical; //!< Number of times to draw (tile) the image vertically
|
||||
int imgType; //!< Type of image data (IMAGE_TEXTURE, IMAGE_COLOR, IMAGE_DATA)
|
||||
u8 * image; //!< Poiner to image data. May be shared with GuiImageData data
|
||||
f32 imageangle; //!< Angle to draw the image
|
||||
|
@ -25,7 +25,8 @@ GuiElement::GuiElement()
|
||||
width = 0;
|
||||
height = 0;
|
||||
alpha = 255;
|
||||
scale = 1;
|
||||
scaleX = 1.0f;
|
||||
scaleY = 1.0f;
|
||||
state = STATE_DEFAULT;
|
||||
stateChan = -1;
|
||||
trigger[0] = NULL;
|
||||
@ -210,7 +211,6 @@ int GuiElement::GetHeight()
|
||||
*/
|
||||
void GuiElement::SetSize(int w, int h)
|
||||
{
|
||||
|
||||
width = w;
|
||||
height = h;
|
||||
}
|
||||
@ -257,12 +257,33 @@ int GuiElement::GetAlpha()
|
||||
|
||||
void GuiElement::SetScale(float s)
|
||||
{
|
||||
scale = s;
|
||||
scaleX = s;
|
||||
scaleY = s;
|
||||
}
|
||||
|
||||
void GuiElement::SetScaleX(float s)
|
||||
{
|
||||
scaleX = s;
|
||||
}
|
||||
|
||||
void GuiElement::SetScaleY(float s)
|
||||
{
|
||||
scaleY = s;
|
||||
}
|
||||
|
||||
void GuiElement::SetScaleXpx(int s)
|
||||
{
|
||||
scaleX = (float)s / width;
|
||||
}
|
||||
|
||||
void GuiElement::SetScaleYpx(int s)
|
||||
{
|
||||
scaleY = (float)s / height;
|
||||
}
|
||||
|
||||
float GuiElement::GetScale()
|
||||
{
|
||||
float s = scale * scaleDyn;
|
||||
float s = (scaleX+scaleY)/2 * scaleDyn;
|
||||
|
||||
if(parentElement)
|
||||
s *= parentElement->GetScale();
|
||||
@ -270,6 +291,26 @@ float GuiElement::GetScale()
|
||||
return s;
|
||||
}
|
||||
|
||||
float GuiElement::GetScaleX()
|
||||
{
|
||||
float s = scaleX * scaleDyn;
|
||||
|
||||
if(parentElement)
|
||||
s *= parentElement->GetScaleX();
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
float GuiElement::GetScaleY()
|
||||
{
|
||||
float s = scaleY * scaleDyn;
|
||||
|
||||
if(parentElement)
|
||||
s *= parentElement->GetScaleY();
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
int GuiElement::GetState()
|
||||
{
|
||||
return state;
|
||||
|
@ -21,6 +21,8 @@ GuiImage::GuiImage()
|
||||
tile = -1;
|
||||
stripe = 0;
|
||||
imgType = IMAGE_DATA;
|
||||
tileHorizontal = -1;
|
||||
tileVertical = -1;
|
||||
}
|
||||
|
||||
GuiImage::GuiImage(GuiImageData * img)
|
||||
@ -158,6 +160,16 @@ void GuiImage::SetTile(int t)
|
||||
tile = t;
|
||||
}
|
||||
|
||||
void GuiImage::SetTileHorizontal(int t)
|
||||
{
|
||||
tileHorizontal = t;
|
||||
}
|
||||
|
||||
void GuiImage::SetTileVertical(int t)
|
||||
{
|
||||
tileVertical = t;
|
||||
}
|
||||
|
||||
GXColor GuiImage::GetPixel(int x, int y)
|
||||
{
|
||||
if(!image || this->GetWidth() <= 0 || x < 0 || y < 0)
|
||||
@ -281,14 +293,13 @@ void GuiImage::Draw()
|
||||
if(!image || !this->IsVisible() || tile == 0)
|
||||
return;
|
||||
|
||||
float currScale = this->GetScale();
|
||||
int currLeft = this->GetLeft();
|
||||
int currTop = this->GetTop();
|
||||
|
||||
if(tile > 0)
|
||||
{
|
||||
for(int i=0; i<tile; i++)
|
||||
Menu_DrawImg(currLeft+width*i, currTop, width, height, image, imageangle, currScale, currScale, this->GetAlpha());
|
||||
Menu_DrawImg(currLeft+width*i, currTop, width, height, image, imageangle, this->GetScaleX(), this->GetScaleY(), this->GetAlpha());
|
||||
}
|
||||
else if(imgType == IMAGE_COLOR)
|
||||
{
|
||||
@ -301,10 +312,10 @@ void GuiImage::Draw()
|
||||
else if(image)
|
||||
{
|
||||
// temporary (maybe), used to correct offset for scaled images
|
||||
if(scale != 1)
|
||||
currLeft = currLeft - width/2 + (width*scale)/2;
|
||||
if(scaleX != 1)
|
||||
currLeft = currLeft - width/2 + (width*scaleX)/2;
|
||||
|
||||
Menu_DrawImg(currLeft, currTop, width, height, image, imageangle, currScale, currScale, this->GetAlpha());
|
||||
Menu_DrawImg(currLeft, currTop, width, height, image, imageangle, this->GetScaleX(), this->GetScaleY(), this->GetAlpha());
|
||||
}
|
||||
|
||||
if(stripe > 0)
|
||||
|
@ -56,6 +56,19 @@ void GuiTrigger::SetHeldTrigger(s32 ch, u32 wiibtns, u16 gcbtns)
|
||||
pad.btns_h = gcbtns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a simple held trigger.
|
||||
*/
|
||||
void GuiTrigger::SetButtonOnlyHeldTrigger(s32 ch, u32 wiibtns, u16 gcbtns)
|
||||
{
|
||||
type = TRIGGER_BUTTON_ONLY_HELD;
|
||||
chan = ch;
|
||||
wpaddata.btns_d = wiibtns;
|
||||
wpaddata.btns_h = wiibtns;
|
||||
pad.btns_d = gcbtns;
|
||||
pad.btns_h = gcbtns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a button trigger. Requires:
|
||||
* - Trigger button is pressed
|
||||
|
Loading…
Reference in New Issue
Block a user