mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-19 17:59:16 +01:00
**Changes
*Modified EFFECT_GOROUND so that it takes a center of rotation, angles work properly, and things don't move back. *Updated the gui_gamecarousel files so that they are functional, shouldn't have any more code dumps, and use the EFFECT_GOROUND. *The carousel button doesn't do anything anymore (since GOROUND was changed so much) **Notes *The easiest way test the carousel is to change guiGameGrid to guiGameCarousel in source/menu.cpp. *If you compile with no modifications, the only noticeable difference is that the carousel button does nothing. **Known Bugs in gui_gamecarousel *The images dont line up horizontally (when shifting left they go too far left, and the same for shifting right). I think there is a rounding bug somewhere in GOROUND (I already fixed several). *Cant hold down left and right to scroll yet *Launching a game only works if the pointer is over two boxes *If an image is growing when the carousel is turned, that button disapears *If an image is grown when the carousel is turned, it wont shrink back
This commit is contained in:
parent
94a8ccc7c1
commit
aaa2a3f25f
@ -344,7 +344,9 @@ class GuiElement
|
|||||||
//!\param startdegree Degree where to start circling
|
//!\param startdegree Degree where to start circling
|
||||||
//!\param anglespeedset Set the speed of Angle rotating make 1 for same speed as Circlespeed
|
//!\param anglespeedset Set the speed of Angle rotating make 1 for same speed as Circlespeed
|
||||||
//! or 0.5 for half the speed of the circlingspeed. Turn Anglecircling off by 0 to this param.
|
//! or 0.5 for half the speed of the circlingspeed. Turn Anglecircling off by 0 to this param.
|
||||||
void SetEffect(int e, int speed, int circles, int r, int startdegree, f32 anglespeedset);
|
//!\param center_x x co-ordinate of the center of circle.
|
||||||
|
//!\param center_y y co-ordinate of the center of circle.
|
||||||
|
void SetEffect(int e, int speed, int circles, int r, int startdegree, f32 anglespeedset, int center_x, int center_y);
|
||||||
//!Sets an effect to be enabled on wiimote cursor over
|
//!Sets an effect to be enabled on wiimote cursor over
|
||||||
//!\param e Effect to enable
|
//!\param e Effect to enable
|
||||||
//!\param a Amount of the effect (usage varies on effect)
|
//!\param a Amount of the effect (usage varies on effect)
|
||||||
@ -420,6 +422,8 @@ class GuiElement
|
|||||||
int xmax; //!< Element's max X offset allowed
|
int xmax; //!< Element's max X offset allowed
|
||||||
int xoffsetDyn; //!< Element X offset, dynamic (added to xoffset value for animation effects)
|
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 yoffsetDyn; //!< Element Y offset, dynamic (added to yoffset value for animation effects)
|
||||||
|
int temp_xoffset; //!< Element Temp X offset
|
||||||
|
int temp_yoffset; //!< Element Temp Y offset
|
||||||
f32 degree; //!< Degree where to start for EFFECT_GOROUND enter it in ° like 60°
|
f32 degree; //!< Degree where to start for EFFECT_GOROUND enter it in ° like 60°
|
||||||
f32 frequency; //!< Speed for EFFECT_GOROUND || can also be negative for other direction
|
f32 frequency; //!< Speed for EFFECT_GOROUND || can also be negative for other direction
|
||||||
int Radius; //!< The radius in which the Element goes round for EFFECT_GOROUND
|
int Radius; //!< The radius in which the Element goes round for EFFECT_GOROUND
|
||||||
|
@ -431,16 +431,18 @@ int GuiElement::GetEffect()
|
|||||||
return effects;
|
return effects;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiElement::SetEffect(int eff, int speed, int circles, int r, int startdegree, f32 anglespeedset) {
|
void GuiElement::SetEffect(int eff, int speed, int circles, int r, int startdegree, f32 anglespeedset, int center_x, int center_y) {
|
||||||
|
|
||||||
if(eff & EFFECT_GOROUND) {
|
if(eff & EFFECT_GOROUND) {
|
||||||
xoffsetDyn = 0; //!position of circle in x
|
xoffsetDyn = 0; //!position of circle in x
|
||||||
yoffsetDyn = 0; //!position of circle in y
|
yoffsetDyn = 0; //!position of circle in y
|
||||||
Radius = r; //!Radius of the circle
|
Radius = r; //!Radius of the circle
|
||||||
degree = startdegree*PI/180;//!for example -90 (°) to start at top of circle
|
degree = startdegree*PI/180; //!for example -90 (°) to start at top of circle
|
||||||
circleamount = circles; //!circleamoutn in degrees for example 360 for 1 circle
|
circleamount = circles; //!circleamoutn in degrees for example 360 for 1 circle
|
||||||
angleDyn = 0.0; //!this is used by the code to calc the angle
|
angleDyn = 0.0f; //!this is used by the code to calc the angle
|
||||||
anglespeed = anglespeedset; //!This is anglespeed depending on circle speed 1 is same speed and 0.5 half speed
|
anglespeed = anglespeedset; //!This is anglespeed depending on circle speed 1 is same speed and 0.5 half speed
|
||||||
|
temp_xoffset = center_x; //!position of center in x
|
||||||
|
temp_yoffset = center_y; //!position of center in y
|
||||||
}
|
}
|
||||||
effects |= eff;
|
effects |= eff;
|
||||||
effectAmount = speed; //!Circlespeed
|
effectAmount = speed; //!Circlespeed
|
||||||
@ -596,41 +598,23 @@ void GuiElement::UpdateEffects()
|
|||||||
if(effects & EFFECT_GOROUND) {
|
if(effects & EFFECT_GOROUND) {
|
||||||
|
|
||||||
//!< check out gui.h for info
|
//!< check out gui.h for info
|
||||||
if(abs(frequency) < PI*circleamount/180) {
|
xoffset = temp_xoffset;
|
||||||
|
yoffset = temp_yoffset;
|
||||||
|
|
||||||
angleDyn = (frequency+degree) * 180/PI * anglespeed;
|
if(fabs(frequency) < PI*((f32) circleamount)/180.0f) {
|
||||||
frequency += effectAmount*0.001;
|
|
||||||
|
angleDyn = ((frequency+degree) * 180.0f/PI + 90.0f) * anglespeed;
|
||||||
|
frequency += effectAmount*0.001f;
|
||||||
|
|
||||||
xoffsetDyn = (int)(Radius*cos(frequency+degree));
|
xoffsetDyn = (int)(Radius*cos(frequency+degree));
|
||||||
yoffsetDyn = (int)(Radius*sin(frequency+degree));
|
yoffsetDyn = (int)(Radius*sin(frequency+degree));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
effects = 0;
|
||||||
//Angle go back to start value (has to be 0.0001 when near 0 but not 0 so that the if state goes through)
|
frequency = 0;
|
||||||
//value 0.0001 isnt noticeable that's why i chose it.
|
xoffset += xoffsetDyn;
|
||||||
angleDyn = degree* 180/PI * anglespeed +0.0001;
|
yoffset += yoffsetDyn;
|
||||||
//Reset Angle to 0
|
}
|
||||||
//angleDyn = 0.0001;
|
|
||||||
|
|
||||||
//fly back to the middle tolerance to 0 is +- 10pixel
|
|
||||||
if(xoffsetDyn < -10)
|
|
||||||
xoffsetDyn += abs(effectAmount)*0.1;
|
|
||||||
else if(xoffsetDyn > 10)
|
|
||||||
xoffsetDyn -= abs(effectAmount)*0.1;
|
|
||||||
else xoffsetDyn = 0;
|
|
||||||
|
|
||||||
if(yoffsetDyn < -10)
|
|
||||||
yoffsetDyn += abs(effectAmount)*0.1;
|
|
||||||
else if(yoffsetDyn > 10)
|
|
||||||
yoffsetDyn -= abs(effectAmount)*0.1;
|
|
||||||
else yoffsetDyn = 0;
|
|
||||||
|
|
||||||
if(xoffsetDyn == 0 && yoffsetDyn == 0) {
|
|
||||||
effects = 0;
|
|
||||||
frequency = 0;
|
|
||||||
Radius = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(effects & EFFECT_ROCK_VERTICLE) {
|
if(effects & EFFECT_ROCK_VERTICLE) {
|
||||||
|
@ -61,11 +61,10 @@ GuiGameCarousel::GuiGameCarousel(int w, int h, struct discHdr * l, int gameCnt,
|
|||||||
btnLeftImg = new GuiImage(imgLeft);
|
btnLeftImg = new GuiImage(imgLeft);
|
||||||
btnLeft = new GuiButton(imgLeft->GetWidth(), imgLeft->GetHeight());
|
btnLeft = new GuiButton(imgLeft->GetWidth(), imgLeft->GetHeight());
|
||||||
btnLeft->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
btnLeft->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||||
btnLeft->SetPosition(20, -30);
|
btnLeft->SetPosition(20, -100);
|
||||||
btnLeft->SetParent(this);
|
btnLeft->SetParent(this);
|
||||||
btnLeft->SetImage(btnLeftImg);
|
btnLeft->SetImage(btnLeftImg);
|
||||||
btnLeft->SetSoundOver(btnSoundOver);
|
btnLeft->SetSoundOver(btnSoundOver);
|
||||||
btnLeft->SetSoundClick(btnSoundClick);
|
|
||||||
btnLeft->SetTrigger(trigA);
|
btnLeft->SetTrigger(trigA);
|
||||||
btnLeft->SetTrigger(trigL);
|
btnLeft->SetTrigger(trigL);
|
||||||
btnLeft->SetTrigger(trigMinus);
|
btnLeft->SetTrigger(trigMinus);
|
||||||
@ -75,10 +74,9 @@ GuiGameCarousel::GuiGameCarousel(int w, int h, struct discHdr * l, int gameCnt,
|
|||||||
btnRight = new GuiButton(imgRight->GetWidth(), imgRight->GetHeight());
|
btnRight = new GuiButton(imgRight->GetWidth(), imgRight->GetHeight());
|
||||||
btnRight->SetParent(this);
|
btnRight->SetParent(this);
|
||||||
btnRight->SetAlignment(ALIGN_RIGHT, ALIGN_MIDDLE);
|
btnRight->SetAlignment(ALIGN_RIGHT, ALIGN_MIDDLE);
|
||||||
btnRight->SetPosition(-20, -30);
|
btnRight->SetPosition(-20, -100);
|
||||||
btnRight->SetImage(btnRightImg);
|
btnRight->SetImage(btnRightImg);
|
||||||
btnRight->SetSoundOver(btnSoundOver);
|
btnRight->SetSoundOver(btnSoundOver);
|
||||||
btnRight->SetSoundClick(btnSoundClick);
|
|
||||||
btnRight->SetTrigger(trigA);
|
btnRight->SetTrigger(trigA);
|
||||||
btnRight->SetTrigger(trigR);
|
btnRight->SetTrigger(trigR);
|
||||||
btnRight->SetTrigger(trigPlus);
|
btnRight->SetTrigger(trigPlus);
|
||||||
@ -88,6 +86,11 @@ GuiGameCarousel::GuiGameCarousel(int w, int h, struct discHdr * l, int gameCnt,
|
|||||||
game = new GuiButton * [pagesize];
|
game = new GuiButton * [pagesize];
|
||||||
coverImg = new GuiImage * [pagesize];
|
coverImg = new GuiImage * [pagesize];
|
||||||
cover = new GuiImageData * [pagesize];
|
cover = new GuiImageData * [pagesize];
|
||||||
|
bob = new int[7];
|
||||||
|
|
||||||
|
for(int i=0; i<7; i++) {
|
||||||
|
bob[i]=i;
|
||||||
|
}
|
||||||
|
|
||||||
char ID[4];
|
char ID[4];
|
||||||
char IDfull[7];
|
char IDfull[7];
|
||||||
@ -116,22 +119,15 @@ GuiGameCarousel::GuiGameCarousel(int w, int h, struct discHdr * l, int gameCnt,
|
|||||||
coverImg[i] = new GuiImage(cover[i]);
|
coverImg[i] = new GuiImage(cover[i]);
|
||||||
coverImg[i]->SetScale(0.8);
|
coverImg[i]->SetScale(0.8);
|
||||||
coverImg[i]->SetWidescreen(CFG.widescreen);
|
coverImg[i]->SetWidescreen(CFG.widescreen);
|
||||||
coverImg[i]->SetAngle(-30+(i*10));
|
|
||||||
coverImg[i]->SetPosition(-20,0);
|
|
||||||
game[i] = new GuiButton(122,244);
|
game[i] = new GuiButton(122,244);
|
||||||
|
game[i]->SetParent(this);
|
||||||
game[i]->SetAlignment(ALIGN_CENTRE,ALIGN_MIDDLE);
|
game[i]->SetAlignment(ALIGN_CENTRE,ALIGN_MIDDLE);
|
||||||
|
game[i]->SetPosition(0,740);
|
||||||
game[i]->SetImage(coverImg[i]);
|
game[i]->SetImage(coverImg[i]);
|
||||||
if (i==0)game[i]->SetPosition(-290,20);
|
|
||||||
if (i==1)game[i]->SetPosition(-200,-45);
|
|
||||||
if (i==2)game[i]->SetPosition(-100,-85);
|
|
||||||
if (i==3)game[i]->SetPosition(0,-100);
|
|
||||||
if (i==4)game[i]->SetPosition(100,-80);
|
|
||||||
if (i==5)game[i]->SetPosition(200,-40);
|
|
||||||
if (i==6)game[i]->SetPosition(290,20);
|
|
||||||
game[i]->SetRumble(false);
|
game[i]->SetRumble(false);
|
||||||
game[i]->SetTrigger(trigA);
|
game[i]->SetTrigger(trigA);
|
||||||
game[i]->SetSoundClick(btnSoundClick);
|
game[i]->SetSoundClick(btnSoundClick);
|
||||||
game[i]->SetEffectGrow();
|
game[i]->SetEffect(EFFECT_GOROUND, -50, 49, 780, 298+7*i, 1, 0, 740);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,7 +154,10 @@ GuiGameCarousel::~GuiGameCarousel()
|
|||||||
delete cover[i];
|
delete cover[i];
|
||||||
}
|
}
|
||||||
delete [] gameIndex;
|
delete [] gameIndex;
|
||||||
|
delete [] bob;
|
||||||
delete [] game;
|
delete [] game;
|
||||||
|
delete [] coverImg;
|
||||||
|
delete [] cover;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -256,7 +255,7 @@ void GuiGameCarousel::Draw()
|
|||||||
|
|
||||||
for(int i=0; i<pagesize; i++) {
|
for(int i=0; i<pagesize; i++) {
|
||||||
if(next >= 0) {
|
if(next >= 0) {
|
||||||
game[i]->Draw();
|
game[bob[i]]->Draw();
|
||||||
next = this->FindMenuItem(next, 1);
|
next = this->FindMenuItem(next, 1);
|
||||||
} else break;
|
} else break;
|
||||||
}
|
}
|
||||||
@ -273,6 +272,12 @@ void GuiGameCarousel::Update(GuiTrigger * t)
|
|||||||
if(state == STATE_DISABLED || !t)
|
if(state == STATE_DISABLED || !t)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if(game[0]->GetEffect() == 0) {
|
||||||
|
for(int i=0; i<7; i++) {
|
||||||
|
game[i]->SetEffectGrow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
btnRight->Update(t);
|
btnRight->Update(t);
|
||||||
btnLeft->Update(t);
|
btnLeft->Update(t);
|
||||||
|
|
||||||
@ -308,144 +313,91 @@ void GuiGameCarousel::Update(GuiTrigger * t)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// pad/joystick navigation
|
// navigation
|
||||||
if(!focus)
|
if(!focus)
|
||||||
return; // skip navigation
|
return; // skip navigation
|
||||||
|
|
||||||
if ((t->Right() || btnRight->GetState() == STATE_CLICKED)) {
|
if (t->Left() || btnLeft->GetState() == STATE_CLICKED) {
|
||||||
|
|
||||||
if (firstPic<0)
|
|
||||||
firstPic=6;
|
|
||||||
changed++;
|
changed++;
|
||||||
if (changed > (gameCnt-1))
|
if (changed > (gameCnt-1))
|
||||||
changed=0;
|
changed=0;
|
||||||
int bob[7];
|
firstPic++;
|
||||||
for(int i=0; i<7; i++) {
|
if (firstPic>6)
|
||||||
|
firstPic=0;
|
||||||
|
|
||||||
|
for (int i=0; i<7; i++) {
|
||||||
bob[i] = (firstPic+i < 7) ? firstPic+i : firstPic+i-7;
|
bob[i] = (firstPic+i < 7) ? firstPic+i : firstPic+i-7;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i=0; i<20; i++) {
|
int index = (changed+7 < gameCnt) ? changed+7 : changed+7-gameCnt;
|
||||||
|
struct discHdr *header = &gameList[index];
|
||||||
game[bob[1]]->SetPosition((-200-(4.5*i)),(-45+(3.25*i)));
|
snprintf (ID,sizeof(ID),"%c%c%c", header->id[0], header->id[1], header->id[2]);
|
||||||
coverImg[bob[1]]->SetAngle(-20-(i/2));
|
snprintf (IDfull,sizeof(IDfull),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]);
|
||||||
|
delete cover[bob[6]];
|
||||||
game[bob[2]]->SetPosition((-100-(5*i)),(-85+(2*i)));
|
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, IDfull); //Load full id image
|
||||||
coverImg[bob[2]]->SetAngle(-10-(i/2));
|
cover[bob[6]] = new GuiImageData(imgPath,0);
|
||||||
|
if (!cover[bob[6]]->GetImage()) {
|
||||||
game[bob[3]]->SetPosition((0-(5*i)),(-100+(0.75*i)));
|
delete cover[bob[6]];
|
||||||
coverImg[bob[3]]->SetAngle(0-(i/2));
|
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, ID); //Load short id image
|
||||||
|
cover[bob[6]] = new GuiImageData(imgPath, 0);
|
||||||
game[bob[4]]->SetPosition((100-(5*i)),(-80-(1*i)));
|
if (!cover[bob[6]]->GetImage()) {
|
||||||
coverImg[bob[4]]->SetAngle(10-(i/2));
|
delete cover[bob[6]];
|
||||||
|
snprintf(imgPath, sizeof(imgPath), "%snoimage.png", CFG.covers_path); //Load no image
|
||||||
game[bob[5]]->SetPosition((200-(4.5*i)),(-40-(2*i)));
|
cover[bob[6]] = new GuiImageData(imgPath, nocover_png);
|
||||||
coverImg[bob[5]]->SetAngle(20-(i/2));
|
|
||||||
|
|
||||||
game[bob[6]]->SetPosition((290-(4.5*i)),(20-(3*i)));
|
|
||||||
coverImg[bob[6]]->SetAngle(30-(i/2));
|
|
||||||
|
|
||||||
if (i==1) {
|
|
||||||
struct discHdr *header = &gameList[changed];
|
|
||||||
snprintf (ID,sizeof(ID),"%c%c%c", header->id[0], header->id[1], header->id[2]);
|
|
||||||
snprintf (IDfull,sizeof(IDfull),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]);
|
|
||||||
delete cover[bob[0]];
|
|
||||||
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, IDfull); //Load full id image
|
|
||||||
cover[bob[0]] = new GuiImageData(imgPath,0);
|
|
||||||
if (!cover[bob[0]]->GetImage()) {
|
|
||||||
delete cover[bob[0]];
|
|
||||||
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, ID); //Load short id image
|
|
||||||
cover[bob[0]] = new GuiImageData(imgPath, 0);
|
|
||||||
if (!cover[bob[0]]->GetImage()) {
|
|
||||||
delete cover[bob[0]];
|
|
||||||
snprintf(imgPath, sizeof(imgPath), "%snoimage.png", CFG.covers_path); //Load no image
|
|
||||||
cover[bob[0]] = new GuiImageData(imgPath, nocover_png);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
delete coverImg[bob[0]];
|
|
||||||
coverImg[bob[0]] = new GuiImage(cover[bob[0]]);
|
|
||||||
coverImg[bob[0]]->SetScale(0.8);
|
|
||||||
coverImg[bob[0]]->SetWidescreen(CFG.widescreen);
|
|
||||||
game[bob[0]]->SetImage(coverImg[bob[0]]);
|
|
||||||
}
|
|
||||||
|
|
||||||
game[bob[0]]->SetPosition((380-(4.5*i)),(80-(3*i)));
|
|
||||||
coverImg[bob[0]]->SetAngle(40-(i/2));
|
|
||||||
|
|
||||||
usleep(speed/25);
|
|
||||||
for(int j=0; j<pagesize; j++) {
|
|
||||||
game[bob[6-j]]->Draw();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
firstPic++;
|
delete coverImg[bob[6]];
|
||||||
btnRight->ResetState();
|
coverImg[bob[6]] = new GuiImage(cover[bob[6]]);
|
||||||
|
coverImg[bob[6]]->SetScale(0.8);
|
||||||
|
coverImg[bob[6]]->SetWidescreen(CFG.widescreen);
|
||||||
|
game[bob[6]]->SetImage(coverImg[bob[6]]);
|
||||||
|
|
||||||
|
for (int i=0; i<7; i++) {
|
||||||
|
game[bob[i]]->SetEffect(EFFECT_GOROUND, -50, 7, 780, 256+7*i, 1, 0, 740);
|
||||||
|
}
|
||||||
|
|
||||||
|
btnLeft->ResetState();
|
||||||
}
|
}
|
||||||
|
|
||||||
else if((t->Left() || btnLeft->GetState() == STATE_CLICKED)) {
|
else if(t->Right() || btnRight->GetState() == STATE_CLICKED) {
|
||||||
|
|
||||||
if (firstPic<0)
|
|
||||||
firstPic=6;
|
|
||||||
changed--;
|
changed--;
|
||||||
if (changed<0)
|
if (changed<0)
|
||||||
changed=(gameCnt-1);
|
changed=(gameCnt-1);
|
||||||
int bob[7];
|
firstPic--;
|
||||||
|
if (firstPic<0)
|
||||||
|
firstPic=6;
|
||||||
|
|
||||||
for(int i=0; i<7; i++) {
|
for(int i=0; i<7; i++) {
|
||||||
bob[i] = (firstPic+i < 7) ? firstPic+i : firstPic+i-7;
|
bob[i] = (firstPic+i < 7) ? firstPic+i : firstPic+i-7;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i=0; i<20; i++) {
|
struct discHdr *header = &gameList[changed];
|
||||||
|
snprintf (ID,sizeof(ID),"%c%c%c", header->id[0], header->id[1], header->id[2]);
|
||||||
game[bob[0]]->SetPosition((-290+(4.5*i)),(20-(3.25*i)));
|
snprintf (IDfull,sizeof(IDfull),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]);
|
||||||
coverImg[bob[0]]->SetAngle(-30+(i/2));
|
delete cover[bob[0]];
|
||||||
|
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, IDfull); //Load full id image
|
||||||
game[bob[1]]->SetPosition((-200+(5*i)),(-45-(2*i)));
|
cover[bob[0]] = new GuiImageData(imgPath,0);
|
||||||
coverImg[bob[1]]->SetAngle(-20+(i/2));
|
if (!cover[bob[0]]->GetImage()) {
|
||||||
|
delete cover[bob[0]];
|
||||||
game[bob[2]]->SetPosition((-100+(5*i)),(-85-(.75*i)));
|
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, ID); //Load short id image
|
||||||
coverImg[bob[2]]->SetAngle(-10+(i/2));
|
cover[bob[0]] = new GuiImageData(imgPath, 0);
|
||||||
|
if (!cover[bob[0]]->GetImage()) {
|
||||||
game[bob[3]]->SetPosition((0+(5*i)),(-100+(1*i)));
|
delete cover[bob[0]];
|
||||||
coverImg[bob[3]]->SetAngle(0+(i/2));
|
snprintf(imgPath, sizeof(imgPath), "%snoimage.png", CFG.covers_path); //Load no image
|
||||||
|
cover[bob[0]] = new GuiImageData(imgPath, nocover_png);
|
||||||
game[bob[4]]->SetPosition((100+(5*i)),(-80+(2*i)));
|
|
||||||
coverImg[bob[4]]->SetAngle(10+(i/2));
|
|
||||||
|
|
||||||
game[bob[5]]->SetPosition((200+(4.5*i)),(-40+(3*i)));
|
|
||||||
coverImg[bob[5]]->SetAngle(20+(i/2));
|
|
||||||
|
|
||||||
if (i==1) {
|
|
||||||
struct discHdr *header = &gameList[changed];
|
|
||||||
snprintf (ID,sizeof(ID),"%c%c%c", header->id[0], header->id[1], header->id[2]);
|
|
||||||
snprintf (IDfull,sizeof(IDfull),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]);
|
|
||||||
delete cover[bob[6]];
|
|
||||||
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, IDfull); //Load full id image
|
|
||||||
cover[bob[6]] = new GuiImageData(imgPath,0);
|
|
||||||
if (!cover[bob[6]]->GetImage()) {
|
|
||||||
delete cover[bob[6]];
|
|
||||||
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, ID); //Load short id image
|
|
||||||
cover[bob[6]] = new GuiImageData(imgPath, 0);
|
|
||||||
if (!cover[bob[6]]->GetImage()) {
|
|
||||||
delete cover[bob[6]];
|
|
||||||
snprintf(imgPath, sizeof(imgPath), "%snoimage.png", CFG.covers_path); //Load no image
|
|
||||||
cover[bob[6]] = new GuiImageData(imgPath, nocover_png);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
delete coverImg[bob[6]];
|
|
||||||
coverImg[bob[6]] = new GuiImage(cover[bob[6]]);
|
|
||||||
coverImg[bob[6]]->SetScale(0.8);
|
|
||||||
coverImg[bob[6]]->SetWidescreen(CFG.widescreen);
|
|
||||||
game[bob[6]]->SetImage(coverImg[bob[6]]);
|
|
||||||
}
|
|
||||||
|
|
||||||
game[bob[6]]->SetPosition((-380+(4.5*i)),(80-(3*i)));
|
|
||||||
coverImg[bob[6]]->SetAngle(-40+(i/2));
|
|
||||||
|
|
||||||
usleep(speed/25);
|
|
||||||
for(int j=0; j<pagesize; j++) {
|
|
||||||
game[bob[6-j]]->Draw();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
firstPic--;
|
delete coverImg[bob[0]];
|
||||||
btnLeft->ResetState();
|
coverImg[bob[0]] = new GuiImage(cover[bob[0]]);
|
||||||
|
coverImg[bob[0]]->SetScale(0.8);
|
||||||
|
coverImg[bob[0]]->SetWidescreen(CFG.widescreen);
|
||||||
|
game[bob[0]]->SetImage(coverImg[bob[0]]);
|
||||||
|
|
||||||
|
for(int i=0; i<7; i++) {
|
||||||
|
game[bob[i]]->SetEffect(EFFECT_GOROUND, 50, 7, 780, 242+7*i, 1, 0, 740);
|
||||||
|
}
|
||||||
|
|
||||||
|
btnRight->ResetState();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(updateCB)
|
if(updateCB)
|
||||||
@ -462,4 +414,47 @@ void GuiGameCarousel::Reload(struct discHdr * l, int count)
|
|||||||
selectedItem = 0;
|
selectedItem = 0;
|
||||||
listOffset = 0;
|
listOffset = 0;
|
||||||
firstPic = 0;
|
firstPic = 0;
|
||||||
|
|
||||||
|
for(int i=0; i<7; i++) {
|
||||||
|
bob[i]=i;
|
||||||
|
}
|
||||||
|
|
||||||
|
char ID[4];
|
||||||
|
char IDfull[7];
|
||||||
|
char imgPath[100];
|
||||||
|
for(int i=0; i < pagesize; i++) {
|
||||||
|
|
||||||
|
struct discHdr *header = &gameList[i];
|
||||||
|
snprintf (ID,sizeof(ID),"%c%c%c", header->id[0], header->id[1], header->id[2]);
|
||||||
|
snprintf (IDfull,sizeof(IDfull),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]);
|
||||||
|
|
||||||
|
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, IDfull);
|
||||||
|
//Load full id image
|
||||||
|
cover[i] = new GuiImageData(imgPath,0);
|
||||||
|
if (!cover[i]->GetImage()) {
|
||||||
|
delete cover[i];
|
||||||
|
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, ID);
|
||||||
|
//Load short id image
|
||||||
|
cover[i] = new GuiImageData(imgPath, 0);
|
||||||
|
if (!cover[i]->GetImage()) {
|
||||||
|
delete cover[i];
|
||||||
|
snprintf(imgPath, sizeof(imgPath), "%snoimage.png", CFG.covers_path);
|
||||||
|
//Load no image
|
||||||
|
cover[i] = new GuiImageData(imgPath, nocover_png);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
coverImg[i] = new GuiImage(cover[i]);
|
||||||
|
coverImg[i]->SetScale(0.8);
|
||||||
|
coverImg[i]->SetWidescreen(CFG.widescreen);
|
||||||
|
game[i] = new GuiButton(122,244);
|
||||||
|
game[i]->SetParent(this);
|
||||||
|
game[i]->SetAlignment(ALIGN_CENTRE,ALIGN_MIDDLE);
|
||||||
|
game[i]->SetPosition(0,740);
|
||||||
|
game[i]->SetImage(coverImg[i]);
|
||||||
|
game[i]->SetRumble(false);
|
||||||
|
game[i]->SetTrigger(trigA);
|
||||||
|
game[i]->SetSoundClick(btnSoundClick);
|
||||||
|
game[i]->SetEffect(EFFECT_GOROUND, -50, 49, 780, 305+7*i, 1, 0, 740);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,8 @@ class GuiGameCarousel : public GuiElement
|
|||||||
int gameCnt;
|
int gameCnt;
|
||||||
|
|
||||||
int * gameIndex;
|
int * gameIndex;
|
||||||
|
int * bob;
|
||||||
|
|
||||||
GuiButton ** game;
|
GuiButton ** game;
|
||||||
GuiText ** gameTxt;
|
GuiText ** gameTxt;
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include "libwbfs/libwbfs.h"
|
#include "libwbfs/libwbfs.h"
|
||||||
#include "sys.h"
|
#include "sys.h"
|
||||||
#include "libwiigui/gui_gamegrid.h"
|
#include "libwiigui/gui_gamegrid.h"
|
||||||
|
#include "libwiigui/gui_gamecarousel.h"
|
||||||
#include "patchcode.h"
|
#include "patchcode.h"
|
||||||
#include "wpad.h"
|
#include "wpad.h"
|
||||||
#include "cfg.h"
|
#include "cfg.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user