mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-12-23 10:21:55 +01:00
**Changes
*Fixed effect GOROUND so that it doesn't cause alignment issues anymore (the format for this effect is very different than it originally was, if you plan on using it for something, look at the documentation in gui.h. *Major revamp of gui_gamecarousel (everything is awesome and perfect, except it still can't launch games, and thus it is still not in the gui). **gui_gamecarousel Notes: *You can use the same technique as last time to test the carousel (except I recommend adding startat and offset to the line since I added support for it). *I realized not everyone will agree for my choice of curvature and spacing for the games on the carousel, so I made them variable. At the top of gui_gamecarousel.cpp are a bunch of definitions that set up these values. *SCALE determines the size of the game boxes. *DEG_OFFSET is the number of degrees between the boxes (remember, changing the RADIUS will affect the linear distance each degree represents). *RADIUS determines the curvature of the arc (higher radius makes it less curved). *IN_SPEED determines the speed at which the boxes come in (higher number makes it faster). *SHFIT_SPEED determines the speed at which the boxes move when you turn the carousel. *PAGESIZE determines how many boxes are drawn (remember, the number of visible boxes is determined by DEG_OFFSET and RADIUS, with the default values you can see 7). *Everything eles (the animations, position of the movement buttons, etc.) is automatically determined from these values (my 8th grade math teacher was right, trig isn't totally worthless), so you shouldn't need to change anything at all, except the aforementioned values (or the b0rken game launching code). *If you find a set of values you think looks better than mine, post a picture and the list of values in an issue or on IRC. *These will probably become theamable at some point, but I figure we should get this added to the gui first (I was hoping to do it tonight, but some stuff came up, and I need to go to bed). Wow I write really long commit notes.
This commit is contained in:
parent
0c2898ac21
commit
cf1a8fb5a0
@ -346,7 +346,7 @@ class GuiElement
|
||||
//! or 0.5 for half the speed of the circlingspeed. Turn Anglecircling off by 0 to this param.
|
||||
//!\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);
|
||||
void SetEffect(int e, int speed, f32 circles, int r, f32 startdegree, f32 anglespeedset, int center_x, int center_y);
|
||||
//!Sets an effect to be enabled on wiimote cursor over
|
||||
//!\param e Effect to enable
|
||||
//!\param a Amount of the effect (usage varies on effect)
|
||||
@ -358,7 +358,10 @@ class GuiElement
|
||||
void StopEffect();
|
||||
//!Gets the current element effects
|
||||
//!\return element effects
|
||||
int GetEffect();
|
||||
int GetEffect();
|
||||
//!Gets the current element on over effects
|
||||
//!\return element on over effects
|
||||
int GetEffectOnOver();
|
||||
//!Checks whether the specified coordinates are within the element's boundaries
|
||||
//!\param x X coordinate
|
||||
//!\param y Y coordinate
|
||||
@ -427,7 +430,8 @@ class GuiElement
|
||||
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
|
||||
int Radius; //!< The radius in which the Element goes round for EFFECT_GOROUND
|
||||
int circleamount; //!< Circleamount for the EFFECT_GOROUND effect
|
||||
f32 circleamount; //!< Circleamount for the EFFECT_GOROUND effect
|
||||
f32 xoffsetDynFloat; //!< Integer sucks float is need by some parts
|
||||
f32 yoffsetDynFloat; //!< Integer sucks float is need by some parts
|
||||
int changervar; //!< Changervariable for some stuff
|
||||
int alpha; //!< Element alpha value (0-255)
|
||||
|
@ -53,13 +53,13 @@ GuiElement::GuiElement()
|
||||
effectsOver = 0;
|
||||
effectAmountOver = 0;
|
||||
effectTargetOver = 0;
|
||||
frequency = 0.0;
|
||||
frequency = 0.0f;
|
||||
changervar = 0;
|
||||
degree = -90*PI/180;
|
||||
circleamount = 360;
|
||||
Radius = 150;
|
||||
angleDyn = 0.0;
|
||||
anglespeed = 0.0;
|
||||
degree = -90.0f;
|
||||
circleamount = 360.0f;
|
||||
Radius = 150;
|
||||
angleDyn = 0.0f;
|
||||
anglespeed = 0.0f;
|
||||
|
||||
// default alignment - align to top left
|
||||
alignmentVert = ALIGN_TOP;
|
||||
@ -429,20 +429,26 @@ int GuiElement::GetEffect()
|
||||
{
|
||||
LOCK(this);
|
||||
return effects;
|
||||
}
|
||||
|
||||
int GuiElement::GetEffectOnOver()
|
||||
{
|
||||
LOCK(this);
|
||||
return effectsOver;
|
||||
}
|
||||
|
||||
void GuiElement::SetEffect(int eff, int speed, int circles, int r, int startdegree, f32 anglespeedset, int center_x, int center_y) {
|
||||
void GuiElement::SetEffect(int eff, int speed, f32 circles, int r, f32 startdegree, f32 anglespeedset, int center_x, int center_y) {
|
||||
|
||||
if(eff & EFFECT_GOROUND) {
|
||||
xoffsetDyn = 0; //!position of circle in x
|
||||
yoffsetDyn = 0; //!position of circle in y
|
||||
Radius = r; //!Radius of the 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
|
||||
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
|
||||
temp_xoffset = center_x; //!position of center in x
|
||||
temp_yoffset = center_y; //!position of center in y
|
||||
xoffsetDyn = 0; //!position of circle in x
|
||||
yoffsetDyn = 0; //!position of circle in y
|
||||
Radius = r; //!radius of the circle
|
||||
degree = startdegree; //!for example -90 (°) to start at top of circle
|
||||
circleamount = circles; //!circleamoutn in degrees for example 360 for 1 circle
|
||||
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
|
||||
temp_xoffset = center_x; //!position of center in x
|
||||
temp_yoffset = center_y; //!position of center in y
|
||||
}
|
||||
effects |= eff;
|
||||
effectAmount = speed; //!Circlespeed
|
||||
@ -498,7 +504,7 @@ void GuiElement::SetEffectGrow()
|
||||
|
||||
void GuiElement::StopEffect()
|
||||
{
|
||||
xoffsetDyn = 0;
|
||||
xoffsetDyn = 0;
|
||||
yoffsetDyn = 0;
|
||||
effects = 0;
|
||||
effectsOver = 0;
|
||||
@ -507,10 +513,10 @@ void GuiElement::StopEffect()
|
||||
effectTarget = 0;
|
||||
effectTargetOver = 0;
|
||||
scaleDyn = 1;
|
||||
frequency = 0;
|
||||
frequency = 0.0f;
|
||||
changervar = 0;
|
||||
angleDyn = 0;
|
||||
anglespeed = 0.0;
|
||||
//angleDyn = 0.0f;
|
||||
anglespeed = 0.0f;
|
||||
}
|
||||
|
||||
void GuiElement::UpdateEffects()
|
||||
@ -596,24 +602,23 @@ void GuiElement::UpdateEffects()
|
||||
}
|
||||
|
||||
if(effects & EFFECT_GOROUND) {
|
||||
|
||||
//!< check out gui.h for info
|
||||
xoffset = temp_xoffset;
|
||||
yoffset = temp_yoffset;
|
||||
|
||||
if(fabs(frequency) < PI*((f32) circleamount)/180.0f) {
|
||||
|
||||
angleDyn = ((frequency+degree) * 180.0f/PI + 90.0f) * anglespeed;
|
||||
frequency += effectAmount*0.001f;
|
||||
|
||||
xoffsetDyn = (int)(Radius*cos(frequency+degree));
|
||||
yoffsetDyn = (int)(Radius*sin(frequency+degree));
|
||||
|
||||
yoffset = temp_yoffset;
|
||||
if(fabs(frequency) < circleamount) {
|
||||
angleDyn = (frequency+degree+90.0f) * anglespeed;
|
||||
xoffsetDyn = (int) lround(((f32) Radius)*cos((frequency+degree)*PI/180.0f));
|
||||
yoffsetDyn = (int) lround(((f32) Radius)*sin((frequency+degree)*PI/180.0f));
|
||||
frequency += ((f32) effectAmount)*0.01f;
|
||||
} else {
|
||||
effects = 0;
|
||||
frequency = 0;
|
||||
f32 temp_frequency = ((effectAmount<0)?-1.0f:1.0f)*circleamount;
|
||||
angleDyn = (temp_frequency+degree+90.0f) * anglespeed;
|
||||
xoffsetDyn = (int) lround(((f32) Radius)*cos((temp_frequency+degree)*PI/180.0f));
|
||||
yoffsetDyn = (int) lround(((f32) Radius)*sin((temp_frequency+degree)*PI/180.0f));
|
||||
xoffset += xoffsetDyn;
|
||||
yoffset += yoffsetDyn;
|
||||
effects ^= EFFECT_GOROUND;
|
||||
frequency = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,9 +14,16 @@
|
||||
#include "../cfg.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <sstream>
|
||||
|
||||
#define GAMESELECTSIZE 30
|
||||
#define SCALE 0.8f
|
||||
#define DEG_OFFSET 7
|
||||
#define RADIUS 780
|
||||
#define IN_SPEED 175
|
||||
#define SHIFT_SPEED 100
|
||||
#define PAGESIZE 9
|
||||
|
||||
extern const int vol;
|
||||
|
||||
/**
|
||||
@ -28,14 +35,12 @@ GuiGameCarousel::GuiGameCarousel(int w, int h, struct discHdr * l, int gameCnt,
|
||||
height = h;
|
||||
this->gameCnt = gameCnt;
|
||||
gameList = l;
|
||||
pagesize = 7;
|
||||
changed = 0;
|
||||
selectable = true;
|
||||
pagesize = (gameCnt < PAGESIZE) ? gameCnt : PAGESIZE;
|
||||
listOffset = (offset == 0) ? this->FindMenuItem(-1, 1) : offset;
|
||||
selectable = true;
|
||||
selectedItem = selected - offset;
|
||||
focus = 1; // allow focus
|
||||
firstPic = 0;
|
||||
speed = 50000;
|
||||
char imgPath[100];
|
||||
|
||||
trigA = new GuiTrigger;
|
||||
@ -58,10 +63,12 @@ GuiGameCarousel::GuiGameCarousel(int w, int h, struct discHdr * l, int gameCnt,
|
||||
snprintf(imgPath, sizeof(imgPath), "%sstartgame_arrow_right.png", CFG.theme_path);
|
||||
imgRight = new GuiImageData(imgPath, startgame_arrow_right_png);
|
||||
|
||||
int btnHeight = (int) lround(sqrt(RADIUS*RADIUS - 90000)-RADIUS-50);
|
||||
|
||||
btnLeftImg = new GuiImage(imgLeft);
|
||||
btnLeft = new GuiButton(imgLeft->GetWidth(), imgLeft->GetHeight());
|
||||
btnLeft->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||
btnLeft->SetPosition(20, -100);
|
||||
btnLeft->SetPosition(20, btnHeight);
|
||||
btnLeft->SetParent(this);
|
||||
btnLeft->SetImage(btnLeftImg);
|
||||
btnLeft->SetSoundOver(btnSoundOver);
|
||||
@ -74,7 +81,7 @@ GuiGameCarousel::GuiGameCarousel(int w, int h, struct discHdr * l, int gameCnt,
|
||||
btnRight = new GuiButton(imgRight->GetWidth(), imgRight->GetHeight());
|
||||
btnRight->SetParent(this);
|
||||
btnRight->SetAlignment(ALIGN_RIGHT, ALIGN_MIDDLE);
|
||||
btnRight->SetPosition(-20, -100);
|
||||
btnRight->SetPosition(-20, btnHeight);
|
||||
btnRight->SetImage(btnRightImg);
|
||||
btnRight->SetSoundOver(btnSoundOver);
|
||||
btnRight->SetTrigger(trigA);
|
||||
@ -86,9 +93,9 @@ GuiGameCarousel::GuiGameCarousel(int w, int h, struct discHdr * l, int gameCnt,
|
||||
game = new GuiButton * [pagesize];
|
||||
coverImg = new GuiImage * [pagesize];
|
||||
cover = new GuiImageData * [pagesize];
|
||||
bob = new int[7];
|
||||
bob = new int[pagesize];
|
||||
|
||||
for(int i=0; i<7; i++) {
|
||||
for(int i=0; i<pagesize; i++) {
|
||||
bob[i]=i;
|
||||
}
|
||||
|
||||
@ -96,7 +103,7 @@ GuiGameCarousel::GuiGameCarousel(int w, int h, struct discHdr * l, int gameCnt,
|
||||
char IDfull[7];
|
||||
for(int i=0; i < pagesize; i++) {
|
||||
|
||||
struct discHdr *header = &gameList[i];
|
||||
struct discHdr *header = &gameList[(listOffset+i)%gameCnt];
|
||||
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]);
|
||||
|
||||
@ -117,7 +124,7 @@ GuiGameCarousel::GuiGameCarousel(int w, int h, struct discHdr * l, int gameCnt,
|
||||
}
|
||||
|
||||
coverImg[i] = new GuiImage(cover[i]);
|
||||
coverImg[i]->SetScale(0.8);
|
||||
coverImg[i]->SetScale(SCALE);
|
||||
coverImg[i]->SetWidescreen(CFG.widescreen);
|
||||
game[i] = new GuiButton(122,244);
|
||||
game[i]->SetParent(this);
|
||||
@ -127,7 +134,7 @@ GuiGameCarousel::GuiGameCarousel(int w, int h, struct discHdr * l, int gameCnt,
|
||||
game[i]->SetRumble(false);
|
||||
game[i]->SetTrigger(trigA);
|
||||
game[i]->SetSoundClick(btnSoundClick);
|
||||
game[i]->SetEffect(EFFECT_GOROUND, -50, 49, 780, 298+7*i, 1, 0, 740);
|
||||
game[i]->SetEffect(EFFECT_GOROUND, IN_SPEED, 90-(pagesize-2*i-1)*DEG_OFFSET/2, RADIUS, 180, 1, 0, RADIUS);
|
||||
}
|
||||
}
|
||||
|
||||
@ -170,7 +177,7 @@ void GuiGameCarousel::SetFocus(int f)
|
||||
game[i]->ResetState();
|
||||
|
||||
if(f == 1)
|
||||
game[selectedItem]->SetState(STATE_SELECTED);
|
||||
game[bob[selectedItem]]->SetState(STATE_SELECTED);
|
||||
}
|
||||
|
||||
|
||||
@ -190,7 +197,7 @@ void GuiGameCarousel::ResetState()
|
||||
|
||||
int GuiGameCarousel::GetOffset()
|
||||
{
|
||||
return changed;
|
||||
return listOffset;
|
||||
}
|
||||
|
||||
|
||||
@ -198,9 +205,9 @@ int GuiGameCarousel::GetClickedOption()
|
||||
{
|
||||
int found = -1;
|
||||
for(int i=0; i<pagesize; i++) {
|
||||
if(game[i]->GetState() == STATE_CLICKED) {
|
||||
game[i]->SetState(STATE_SELECTED);
|
||||
found = changed+i;
|
||||
if(game[bob[i]]->GetState() == STATE_CLICKED) {
|
||||
game[bob[i]]->SetState(STATE_SELECTED);
|
||||
found = listOffset+i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -212,9 +219,9 @@ int GuiGameCarousel::GetSelectedOption()
|
||||
{
|
||||
int found = -1;
|
||||
for(int i=0; i<pagesize; i++) {
|
||||
if(game[i]->GetState() == STATE_SELECTED) {
|
||||
game[i]->SetState(STATE_SELECTED);
|
||||
found = changed+i;
|
||||
if(game[bob[i]]->GetState() == STATE_SELECTED) {
|
||||
game[bob[i]]->SetState(STATE_SELECTED);
|
||||
found = listOffset+i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -233,7 +240,10 @@ int GuiGameCarousel::FindMenuItem(int currentItem, int direction)
|
||||
int nextItem = currentItem + direction;
|
||||
|
||||
if(nextItem < 0 || nextItem >= gameCnt)
|
||||
return -1;
|
||||
if(gameCnt <= pagesize)
|
||||
return -1;
|
||||
else
|
||||
nextItem = (nextItem < 0) ? nextItem + gameCnt : nextItem - gameCnt;
|
||||
|
||||
if(strlen(get_title(&gameList[nextItem])) > 0)
|
||||
return nextItem;
|
||||
@ -260,8 +270,11 @@ void GuiGameCarousel::Draw()
|
||||
} else break;
|
||||
}
|
||||
|
||||
btnRight->Draw();
|
||||
btnLeft->Draw();
|
||||
if(gameCnt > pagesize) {
|
||||
btnRight->Draw();
|
||||
btnLeft->Draw();
|
||||
}
|
||||
|
||||
this->UpdateEffects();
|
||||
}
|
||||
|
||||
@ -272,8 +285,8 @@ void GuiGameCarousel::Update(GuiTrigger * t)
|
||||
if(state == STATE_DISABLED || !t)
|
||||
return;
|
||||
|
||||
if(game[0]->GetEffect() == 0) {
|
||||
for(int i=0; i<7; i++) {
|
||||
if(!(game[0]->GetEffect() || game[0]->GetEffectOnOver())) {
|
||||
for(int i=0; i<pagesize; i++) {
|
||||
game[i]->SetEffectGrow();
|
||||
}
|
||||
}
|
||||
@ -289,89 +302,112 @@ void GuiGameCarousel::Update(GuiTrigger * t)
|
||||
|
||||
for(int i=0; i<pagesize; i++) {
|
||||
if(next >= 0) {
|
||||
if(game[i]->GetState() == STATE_DISABLED) {
|
||||
game[i]->SetVisible(true);
|
||||
game[i]->SetState(STATE_DEFAULT);
|
||||
if(game[bob[i]]->GetState() == STATE_DISABLED) {
|
||||
game[bob[i]]->SetVisible(true);
|
||||
game[bob[i]]->SetState(STATE_DEFAULT);
|
||||
}
|
||||
gameIndex[i] = next;
|
||||
next = this->FindMenuItem(next, 1);
|
||||
} else {
|
||||
game[i]->SetVisible(false);
|
||||
game[i]->SetState(STATE_DISABLED);
|
||||
game[bob[i]]->SetVisible(false);
|
||||
game[bob[i]]->SetState(STATE_DISABLED);
|
||||
}
|
||||
|
||||
if(focus) {
|
||||
if(i != selectedItem && game[i]->GetState() == STATE_SELECTED)
|
||||
game[i]->ResetState();
|
||||
else if(i == selectedItem && game[i]->GetState() == STATE_DEFAULT);
|
||||
game[selectedItem]->SetState(STATE_SELECTED, t->chan);
|
||||
if(i != selectedItem && game[bob[i]]->GetState() == STATE_SELECTED)
|
||||
game[bob[i]]->ResetState();
|
||||
else if(i == selectedItem && game[bob[i]]->GetState() == STATE_DEFAULT);
|
||||
game[bob[selectedItem]]->SetState(STATE_SELECTED, t->chan);
|
||||
}
|
||||
game[i]->Update(t);
|
||||
game[bob[i]]->Update(t);
|
||||
|
||||
if(game[i]->GetState() == STATE_SELECTED) {
|
||||
if(game[bob[i]]->GetState() == STATE_SELECTED) {
|
||||
selectedItem = i;
|
||||
}
|
||||
}
|
||||
|
||||
// navigation
|
||||
if(!focus)
|
||||
if(!focus || game[0]->GetEffect() || gameCnt <= pagesize)
|
||||
return; // skip navigation
|
||||
|
||||
if (t->Left() || btnLeft->GetState() == STATE_CLICKED) {
|
||||
changed++;
|
||||
if (changed > (gameCnt-1))
|
||||
changed=0;
|
||||
WPAD_ScanPads();
|
||||
u16 buttons = 0;
|
||||
for(int i=0; i<4; i++)
|
||||
buttons |= WPAD_ButtonsHeld(i);
|
||||
if(!((buttons & WPAD_BUTTON_A) || (buttons & WPAD_BUTTON_MINUS) || t->Left())) {
|
||||
btnLeft->ResetState();
|
||||
return;
|
||||
}
|
||||
|
||||
for(int i=0; i<pagesize; i++) {
|
||||
game[i]->StopEffect();
|
||||
}
|
||||
listOffset++;
|
||||
if (listOffset > (gameCnt-1))
|
||||
listOffset=0;
|
||||
firstPic++;
|
||||
if (firstPic>6)
|
||||
if (firstPic > (pagesize-1))
|
||||
firstPic=0;
|
||||
|
||||
for (int i=0; i<7; i++) {
|
||||
bob[i] = (firstPic+i < 7) ? firstPic+i : firstPic+i-7;
|
||||
for (int i=0; i<pagesize; i++) {
|
||||
bob[i] = (firstPic+i)%pagesize;
|
||||
}
|
||||
|
||||
int index = (changed+7 < gameCnt) ? changed+7 : changed+7-gameCnt;
|
||||
struct discHdr *header = &gameList[index];
|
||||
struct discHdr *header = &gameList[(listOffset + pagesize-1) % gameCnt];
|
||||
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]];
|
||||
delete cover[bob[pagesize-1]];
|
||||
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]];
|
||||
cover[bob[pagesize-1]] = new GuiImageData(imgPath,0);
|
||||
if (!cover[bob[pagesize-1]]->GetImage()) {
|
||||
delete cover[bob[pagesize-1]];
|
||||
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]];
|
||||
cover[bob[pagesize-1]] = new GuiImageData(imgPath, 0);
|
||||
if (!cover[bob[pagesize-1]]->GetImage()) {
|
||||
delete cover[bob[pagesize-1]];
|
||||
snprintf(imgPath, sizeof(imgPath), "%snoimage.png", CFG.covers_path); //Load no image
|
||||
cover[bob[6]] = new GuiImageData(imgPath, nocover_png);
|
||||
cover[bob[pagesize-1]] = 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]]);
|
||||
delete coverImg[bob[pagesize-1]];
|
||||
coverImg[bob[pagesize-1]] = new GuiImage(cover[bob[pagesize-1]]);
|
||||
coverImg[bob[pagesize-1]]->SetScale(SCALE);
|
||||
coverImg[bob[pagesize-1]]->SetWidescreen(CFG.widescreen);
|
||||
game[bob[pagesize-1]]->SetImage(coverImg[bob[pagesize-1]]);
|
||||
game[bob[pagesize-1]]->SetPosition(0, RADIUS);
|
||||
|
||||
for (int i=0; i<7; i++) {
|
||||
game[bob[i]]->SetEffect(EFFECT_GOROUND, -50, 7, 780, 256+7*i, 1, 0, 740);
|
||||
for (int i=0; i<pagesize; i++) {
|
||||
//game[bob[i]]->SetEffect(EFFECT_GOROUND, -125, 7, 780, 256+7*i, 1, 0, 740);
|
||||
game[bob[i]]->SetEffect(EFFECT_GOROUND, -SHIFT_SPEED, DEG_OFFSET, RADIUS, 270-(pagesize-2*i-3)*DEG_OFFSET/2, 1, 0, RADIUS);
|
||||
}
|
||||
|
||||
btnLeft->ResetState();
|
||||
}
|
||||
|
||||
else if(t->Right() || btnRight->GetState() == STATE_CLICKED) {
|
||||
changed--;
|
||||
if (changed<0)
|
||||
changed=(gameCnt-1);
|
||||
firstPic--;
|
||||
if (firstPic<0)
|
||||
firstPic=6;
|
||||
|
||||
for(int i=0; i<7; i++) {
|
||||
bob[i] = (firstPic+i < 7) ? firstPic+i : firstPic+i-7;
|
||||
WPAD_ScanPads();
|
||||
u16 buttons = 0;
|
||||
for(int i=0; i<4; i++)
|
||||
buttons |= WPAD_ButtonsHeld(i);
|
||||
if(!((buttons & WPAD_BUTTON_A) || (buttons & WPAD_BUTTON_PLUS) || t->Right())) {
|
||||
btnRight->ResetState();
|
||||
return;
|
||||
}
|
||||
|
||||
struct discHdr *header = &gameList[changed];
|
||||
for(int i=0; i<pagesize; i++) {
|
||||
game[i]->StopEffect();
|
||||
}
|
||||
listOffset--;
|
||||
if (listOffset<0)
|
||||
listOffset=(gameCnt-1);
|
||||
firstPic--;
|
||||
if (firstPic<0)
|
||||
firstPic=(pagesize-1);
|
||||
|
||||
for(int i=0; i<pagesize; i++) {
|
||||
bob[i] = (firstPic+i)%pagesize;
|
||||
}
|
||||
|
||||
struct discHdr *header = &gameList[listOffset];
|
||||
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]];
|
||||
@ -389,15 +425,15 @@ void GuiGameCarousel::Update(GuiTrigger * t)
|
||||
}
|
||||
delete coverImg[bob[0]];
|
||||
coverImg[bob[0]] = new GuiImage(cover[bob[0]]);
|
||||
coverImg[bob[0]]->SetScale(0.8);
|
||||
coverImg[bob[0]]->SetScale(SCALE);
|
||||
coverImg[bob[0]]->SetWidescreen(CFG.widescreen);
|
||||
game[bob[0]]->SetImage(coverImg[bob[0]]);
|
||||
game[bob[0]]->SetPosition(0, RADIUS);
|
||||
|
||||
for(int i=0; i<7; i++) {
|
||||
game[bob[i]]->SetEffect(EFFECT_GOROUND, 50, 7, 780, 242+7*i, 1, 0, 740);
|
||||
for(int i=0; i<pagesize; i++) {
|
||||
//game[bob[i]]->SetEffect(EFFECT_GOROUND, 125, 7, 780, 242+7*i, 1, 0, 740);
|
||||
game[bob[i]]->SetEffect(EFFECT_GOROUND, SHIFT_SPEED, DEG_OFFSET, RADIUS, 270-(pagesize-2*i+1)*DEG_OFFSET/2, 1, 0, RADIUS);
|
||||
}
|
||||
|
||||
btnRight->ResetState();
|
||||
}
|
||||
|
||||
if(updateCB)
|
||||
@ -408,23 +444,24 @@ void GuiGameCarousel::Update(GuiTrigger * t)
|
||||
void GuiGameCarousel::Reload(struct discHdr * l, int count)
|
||||
{
|
||||
LOCK(this);
|
||||
gameList = l;
|
||||
gameCnt = count;
|
||||
changed=0;
|
||||
selectedItem = 0;
|
||||
listOffset = 0;
|
||||
gameList = l;
|
||||
pagesize = (gameCnt < PAGESIZE) ? gameCnt : PAGESIZE;
|
||||
listOffset = this->FindMenuItem(-1, 1);
|
||||
selectedItem = 0 + listOffset;
|
||||
focus = 1;
|
||||
firstPic = 0;
|
||||
char imgPath[100];
|
||||
|
||||
for(int i=0; i<7; i++) {
|
||||
for(int i=0; i<pagesize; 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];
|
||||
struct discHdr *header = &gameList[(listOffset+i)%gameCnt];
|
||||
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]);
|
||||
|
||||
@ -445,7 +482,7 @@ void GuiGameCarousel::Reload(struct discHdr * l, int count)
|
||||
}
|
||||
|
||||
coverImg[i] = new GuiImage(cover[i]);
|
||||
coverImg[i]->SetScale(0.8);
|
||||
coverImg[i]->SetScale(SCALE);
|
||||
coverImg[i]->SetWidescreen(CFG.widescreen);
|
||||
game[i] = new GuiButton(122,244);
|
||||
game[i]->SetParent(this);
|
||||
@ -455,6 +492,7 @@ void GuiGameCarousel::Reload(struct discHdr * l, int count)
|
||||
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);
|
||||
game[i]->SetEffect(EFFECT_GOROUND, IN_SPEED, 180-(pagesize-2*i-1)*DEG_OFFSET/2, RADIUS, 180, 1, 0, RADIUS);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,8 +23,7 @@ class GuiGameCarousel : public GuiElement
|
||||
int selectedItem;
|
||||
int listOffset;
|
||||
int scrollbaron;
|
||||
int pagesize;
|
||||
int changed;
|
||||
int pagesize;
|
||||
int firstPic;
|
||||
int speed;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user