2009-05-27 10:51:39 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* libwiigui
|
|
|
|
*
|
|
|
|
* gui_gamecarousel.cpp
|
|
|
|
*
|
|
|
|
* GUI class definitions
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#include "gui.h"
|
|
|
|
#include "../wpad.h"
|
2009-09-27 20:19:53 +02:00
|
|
|
#include "../menu.h"
|
2009-05-27 10:51:39 +02:00
|
|
|
|
|
|
|
#include <unistd.h>
|
2009-09-27 20:19:53 +02:00
|
|
|
#include "gui_image_async.h"
|
2009-05-27 10:51:39 +02:00
|
|
|
#include "gui_gamecarousel.h"
|
2009-06-13 02:24:36 +02:00
|
|
|
#include "../settings/cfg.h"
|
2009-06-01 14:15:27 +02:00
|
|
|
#include "../main.h"
|
2009-05-27 10:51:39 +02:00
|
|
|
|
|
|
|
#include <string.h>
|
**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.
2009-05-29 07:27:29 +02:00
|
|
|
#include <math.h>
|
2009-05-27 10:51:39 +02:00
|
|
|
#include <sstream>
|
|
|
|
|
**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.
2009-05-29 07:27:29 +02:00
|
|
|
#define SCALE 0.8f
|
|
|
|
#define DEG_OFFSET 7
|
|
|
|
#define RADIUS 780
|
|
|
|
#define IN_SPEED 175
|
2009-07-12 16:02:48 +02:00
|
|
|
#define SHIFT_SPEED 75
|
|
|
|
#define SPEED_STEP 4
|
|
|
|
#define SPEED_LIMIT 250
|
**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.
2009-05-29 07:27:29 +02:00
|
|
|
|
2009-09-27 20:19:53 +02:00
|
|
|
static inline int OFFSETLIMIT(int Offset, int gameCnt)
|
|
|
|
{
|
|
|
|
while(Offset < 0) Offset+=gameCnt;
|
|
|
|
return Offset%gameCnt;
|
|
|
|
}
|
|
|
|
#define GetGameIndex(pageEntry, listOffset, gameCnt) OFFSETLIMIT(listOffset+pageEntry, gameCnt)
|
|
|
|
static GuiImageData *GameCarouselLoadCoverImage(void * Arg)
|
|
|
|
{
|
|
|
|
return LoadCoverImage((struct discHdr *)Arg, true, false);
|
|
|
|
}
|
2009-05-27 10:51:39 +02:00
|
|
|
/**
|
|
|
|
* Constructor for the GuiGameCarousel class.
|
|
|
|
*/
|
2009-09-27 20:19:53 +02:00
|
|
|
GuiGameCarousel::GuiGameCarousel(int w, int h, struct discHdr * l, int count, const char *themePath, const u8 *imagebg, int selected, int offset) :
|
|
|
|
noCover(nocover_png)
|
2009-05-27 10:51:39 +02:00
|
|
|
{
|
|
|
|
width = w;
|
|
|
|
height = h;
|
2009-07-12 16:02:48 +02:00
|
|
|
gameCnt = count;
|
2009-05-27 10:51:39 +02:00
|
|
|
gameList = l;
|
2009-09-27 20:19:53 +02:00
|
|
|
pagesize = (gameCnt < 11) ? gameCnt : 11;
|
2009-08-01 16:42:12 +02:00
|
|
|
listOffset = 0;
|
**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.
2009-05-29 07:27:29 +02:00
|
|
|
selectable = true;
|
2009-09-27 20:19:53 +02:00
|
|
|
selectedItem = -1;
|
2009-05-27 10:51:39 +02:00
|
|
|
focus = 1; // allow focus
|
2009-05-30 05:02:41 +02:00
|
|
|
clickedItem = -1;
|
2009-09-27 20:19:53 +02:00
|
|
|
|
|
|
|
speed = 0;
|
2009-05-27 10:51:39 +02:00
|
|
|
char imgPath[100];
|
|
|
|
|
|
|
|
trigA = new GuiTrigger;
|
|
|
|
trigA->SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
trigL = new GuiTrigger;
|
|
|
|
trigL->SetButtonOnlyTrigger(-1, WPAD_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_LEFT, PAD_BUTTON_LEFT);
|
|
|
|
trigR = new GuiTrigger;
|
|
|
|
trigR->SetButtonOnlyTrigger(-1, WPAD_BUTTON_RIGHT | WPAD_CLASSIC_BUTTON_RIGHT, PAD_BUTTON_RIGHT);
|
|
|
|
trigPlus = new GuiTrigger;
|
|
|
|
trigPlus->SetButtonOnlyTrigger(-1, WPAD_BUTTON_PLUS | WPAD_CLASSIC_BUTTON_PLUS, 0);
|
|
|
|
trigMinus = new GuiTrigger;
|
|
|
|
trigMinus->SetButtonOnlyTrigger(-1, WPAD_BUTTON_MINUS | WPAD_CLASSIC_BUTTON_MINUS, 0);
|
|
|
|
|
2009-11-10 00:03:13 +01:00
|
|
|
btnSoundClick = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
|
|
|
|
btnSoundOver = new GuiSound(button_over_pcm, button_over_pcm_size, Settings.sfxvolume);
|
2009-05-27 10:51:39 +02:00
|
|
|
|
|
|
|
snprintf(imgPath, sizeof(imgPath), "%sstartgame_arrow_left.png", CFG.theme_path);
|
|
|
|
imgLeft = new GuiImageData(imgPath, startgame_arrow_left_png);
|
|
|
|
snprintf(imgPath, sizeof(imgPath), "%sstartgame_arrow_right.png", CFG.theme_path);
|
|
|
|
imgRight = new GuiImageData(imgPath, startgame_arrow_right_png);
|
|
|
|
|
**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.
2009-05-29 07:27:29 +02:00
|
|
|
int btnHeight = (int) lround(sqrt(RADIUS*RADIUS - 90000)-RADIUS-50);
|
|
|
|
|
2009-05-27 10:51:39 +02:00
|
|
|
btnLeftImg = new GuiImage(imgLeft);
|
2009-06-01 14:15:27 +02:00
|
|
|
if (Settings.wsprompt == yes)
|
|
|
|
btnLeftImg->SetWidescreen(CFG.widescreen);
|
2009-05-27 10:51:39 +02:00
|
|
|
btnLeft = new GuiButton(imgLeft->GetWidth(), imgLeft->GetHeight());
|
|
|
|
btnLeft->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
**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.
2009-05-29 07:27:29 +02:00
|
|
|
btnLeft->SetPosition(20, btnHeight);
|
2009-05-27 10:51:39 +02:00
|
|
|
btnLeft->SetParent(this);
|
|
|
|
btnLeft->SetImage(btnLeftImg);
|
|
|
|
btnLeft->SetSoundOver(btnSoundOver);
|
|
|
|
btnLeft->SetTrigger(trigA);
|
|
|
|
btnLeft->SetTrigger(trigL);
|
|
|
|
btnLeft->SetTrigger(trigMinus);
|
|
|
|
btnLeft->SetEffectGrow();
|
|
|
|
|
|
|
|
btnRightImg = new GuiImage(imgRight);
|
2009-06-01 14:15:27 +02:00
|
|
|
if (Settings.wsprompt == yes)
|
|
|
|
btnRightImg->SetWidescreen(CFG.widescreen);
|
2009-05-27 10:51:39 +02:00
|
|
|
btnRight = new GuiButton(imgRight->GetWidth(), imgRight->GetHeight());
|
|
|
|
btnRight->SetParent(this);
|
|
|
|
btnRight->SetAlignment(ALIGN_RIGHT, ALIGN_MIDDLE);
|
**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.
2009-05-29 07:27:29 +02:00
|
|
|
btnRight->SetPosition(-20, btnHeight);
|
2009-05-27 10:51:39 +02:00
|
|
|
btnRight->SetImage(btnRightImg);
|
|
|
|
btnRight->SetSoundOver(btnSoundOver);
|
|
|
|
btnRight->SetTrigger(trigA);
|
|
|
|
btnRight->SetTrigger(trigR);
|
|
|
|
btnRight->SetTrigger(trigPlus);
|
2009-07-12 16:02:48 +02:00
|
|
|
btnRight->SetEffectGrow();
|
|
|
|
|
2009-09-27 20:19:53 +02:00
|
|
|
gamename = new GuiText(" ", 18, THEME.info);
|
2009-08-01 16:42:12 +02:00
|
|
|
gamename->SetParent(this);
|
|
|
|
gamename->SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
|
|
gamename->SetPosition(0, 330);
|
2009-10-19 22:34:54 +02:00
|
|
|
gamename->SetMaxWidth(280, GuiText::DOTTED);
|
2009-05-27 10:51:39 +02:00
|
|
|
|
2009-09-27 20:19:53 +02:00
|
|
|
gameIndex = new int[pagesize];
|
|
|
|
game = new GuiButton * [pagesize];
|
|
|
|
coverImg = new GuiImageAsync * [pagesize];
|
|
|
|
|
|
|
|
for(int i=0; i < pagesize; i++)
|
|
|
|
{
|
|
|
|
//------------------------
|
|
|
|
// Index
|
|
|
|
//------------------------
|
|
|
|
gameIndex[i] = GetGameIndex(i, listOffset, gameCnt);
|
|
|
|
|
|
|
|
//------------------------
|
|
|
|
// Image
|
|
|
|
//------------------------
|
|
|
|
coverImg[i] = new(std::nothrow) GuiImageAsync(GameCarouselLoadCoverImage, &gameList[gameIndex[i]], sizeof(struct discHdr), &noCover);
|
|
|
|
if(coverImg[i])
|
|
|
|
coverImg[i]->SetWidescreen(CFG.widescreen);
|
|
|
|
|
|
|
|
//------------------------
|
|
|
|
// GameButton
|
|
|
|
//------------------------
|
2009-05-31 23:40:22 +02:00
|
|
|
|
2009-05-27 10:51:39 +02:00
|
|
|
game[i] = new GuiButton(122,244);
|
2009-05-28 03:46:05 +02:00
|
|
|
game[i]->SetParent(this);
|
2009-05-27 10:51:39 +02:00
|
|
|
game[i]->SetAlignment(ALIGN_CENTRE,ALIGN_MIDDLE);
|
2009-05-28 03:46:05 +02:00
|
|
|
game[i]->SetPosition(0,740);
|
2009-09-27 20:19:53 +02:00
|
|
|
game[i]->SetImage(coverImg[i]);
|
2009-07-12 16:02:48 +02:00
|
|
|
game[i]->SetScale(SCALE);
|
2009-05-27 10:51:39 +02:00
|
|
|
game[i]->SetRumble(false);
|
|
|
|
game[i]->SetTrigger(trigA);
|
|
|
|
game[i]->SetSoundClick(btnSoundClick);
|
2009-05-30 05:02:41 +02:00
|
|
|
game[i]->SetClickable(true);
|
**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.
2009-05-29 07:27:29 +02:00
|
|
|
game[i]->SetEffect(EFFECT_GOROUND, IN_SPEED, 90-(pagesize-2*i-1)*DEG_OFFSET/2, RADIUS, 180, 1, 0, RADIUS);
|
2009-05-27 10:51:39 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Destructor for the GuiGameCarousel class.
|
|
|
|
*/
|
|
|
|
GuiGameCarousel::~GuiGameCarousel()
|
|
|
|
{
|
|
|
|
delete imgRight;
|
|
|
|
delete imgLeft;
|
|
|
|
delete btnLeftImg;
|
|
|
|
delete btnRightImg;
|
|
|
|
delete btnRight;
|
|
|
|
delete btnLeft;
|
|
|
|
|
2009-06-01 00:44:40 +02:00
|
|
|
delete trigA;
|
|
|
|
delete trigL;
|
|
|
|
delete trigR;
|
|
|
|
delete trigPlus;
|
|
|
|
delete trigMinus;
|
|
|
|
delete btnSoundClick;
|
2009-08-01 16:42:12 +02:00
|
|
|
delete btnSoundOver;
|
|
|
|
delete gamename;
|
2009-05-27 10:51:39 +02:00
|
|
|
|
|
|
|
for(int i=0; i<pagesize; i++) {
|
2009-09-27 20:19:53 +02:00
|
|
|
delete coverImg[i];
|
2009-05-27 10:51:39 +02:00
|
|
|
delete game[i];
|
2009-05-30 05:02:41 +02:00
|
|
|
}
|
2009-05-27 10:51:39 +02:00
|
|
|
delete [] gameIndex;
|
2009-09-27 20:19:53 +02:00
|
|
|
delete [] coverImg;
|
2009-05-27 10:51:39 +02:00
|
|
|
delete [] game;
|
2009-09-27 20:19:53 +02:00
|
|
|
|
|
|
|
|
2009-05-27 10:51:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GuiGameCarousel::SetFocus(int f)
|
|
|
|
{
|
2009-08-01 16:42:12 +02:00
|
|
|
LOCK(this);
|
|
|
|
if(!gameCnt) return;
|
|
|
|
|
2009-05-27 10:51:39 +02:00
|
|
|
focus = f;
|
|
|
|
|
|
|
|
for(int i=0; i<pagesize; i++)
|
|
|
|
game[i]->ResetState();
|
|
|
|
|
2009-09-27 20:19:53 +02:00
|
|
|
if(f == 1 && selectedItem>=0)
|
2009-07-12 16:02:48 +02:00
|
|
|
game[selectedItem]->SetState(STATE_SELECTED);
|
2009-05-27 10:51:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GuiGameCarousel::ResetState()
|
|
|
|
{
|
|
|
|
LOCK(this);
|
|
|
|
if(state != STATE_DISABLED) {
|
|
|
|
state = STATE_DEFAULT;
|
|
|
|
stateChan = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
for(int i=0; i<pagesize; i++) {
|
|
|
|
game[i]->ResetState();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int GuiGameCarousel::GetOffset()
|
|
|
|
{
|
2009-09-27 20:19:53 +02:00
|
|
|
LOCK(this);
|
**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.
2009-05-29 07:27:29 +02:00
|
|
|
return listOffset;
|
2009-05-27 10:51:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int GuiGameCarousel::GetClickedOption()
|
|
|
|
{
|
2009-09-27 20:19:53 +02:00
|
|
|
LOCK(this);
|
2009-05-27 10:51:39 +02:00
|
|
|
int found = -1;
|
2009-09-27 20:19:53 +02:00
|
|
|
if (clickedItem>=0)
|
|
|
|
{
|
|
|
|
game[clickedItem]->SetState(STATE_SELECTED);
|
|
|
|
found = gameIndex[clickedItem];
|
|
|
|
clickedItem=-1;
|
2009-05-27 10:51:39 +02:00
|
|
|
}
|
|
|
|
return found;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int GuiGameCarousel::GetSelectedOption()
|
|
|
|
{
|
2009-09-27 20:19:53 +02:00
|
|
|
LOCK(this);
|
2009-05-27 10:51:39 +02:00
|
|
|
int found = -1;
|
2009-09-27 20:19:53 +02:00
|
|
|
for(int i=0; i<pagesize; i++)
|
|
|
|
{
|
|
|
|
if(game[i]->GetState() == STATE_SELECTED)
|
|
|
|
{
|
2009-07-12 16:02:48 +02:00
|
|
|
game[i]->SetState(STATE_SELECTED);
|
2009-09-27 20:19:53 +02:00
|
|
|
found = gameIndex[i];
|
2009-05-27 10:51:39 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return found;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Draw the button on screen
|
|
|
|
*/
|
|
|
|
void GuiGameCarousel::Draw()
|
|
|
|
{
|
|
|
|
LOCK(this);
|
2009-08-01 16:42:12 +02:00
|
|
|
if(!this->IsVisible() || !gameCnt)
|
2009-05-27 10:51:39 +02:00
|
|
|
return;
|
|
|
|
|
2009-09-27 20:19:53 +02:00
|
|
|
for(int i=0; i<pagesize; i++)
|
|
|
|
game[i]->Draw();
|
2009-08-01 16:42:12 +02:00
|
|
|
|
|
|
|
|
|
|
|
gamename->Draw();
|
2009-05-27 10:51:39 +02:00
|
|
|
|
2009-09-27 20:19:53 +02:00
|
|
|
if(gameCnt > 6)
|
|
|
|
{
|
**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.
2009-05-29 07:27:29 +02:00
|
|
|
btnRight->Draw();
|
|
|
|
btnLeft->Draw();
|
2009-09-27 20:19:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//!Draw tooltip after the Images to have it on top
|
|
|
|
if (focus && Settings.tooltips == TooltipsOn)
|
|
|
|
for(int i=0; i<pagesize; i++)
|
|
|
|
game[i]->DrawTooltip();
|
**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.
2009-05-29 07:27:29 +02:00
|
|
|
|
2009-05-27 10:51:39 +02:00
|
|
|
this->UpdateEffects();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GuiGameCarousel::Update(GuiTrigger * t)
|
|
|
|
{
|
|
|
|
LOCK(this);
|
2009-08-01 16:42:12 +02:00
|
|
|
if(state == STATE_DISABLED || !t || !gameCnt)
|
2009-05-27 10:51:39 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
btnRight->Update(t);
|
|
|
|
btnLeft->Update(t);
|
2009-09-27 20:19:53 +02:00
|
|
|
|
|
|
|
if(game[0]->GetEffect() & EFFECT_GOROUND || game[pagesize-1]->GetEffect() & EFFECT_GOROUND)
|
|
|
|
{
|
|
|
|
return; // skip when rotate
|
|
|
|
}
|
2009-07-12 16:02:48 +02:00
|
|
|
|
2009-09-27 20:19:53 +02:00
|
|
|
// find selected + clicked
|
|
|
|
int selectedItem_old = selectedItem;
|
|
|
|
selectedItem = -1;
|
|
|
|
clickedItem = -1;
|
|
|
|
for(int i=pagesize-1; i>=0; i--)
|
|
|
|
{
|
2009-07-12 16:02:48 +02:00
|
|
|
game[i]->Update(t);
|
2009-09-27 20:19:53 +02:00
|
|
|
if(game[i]->GetState() == STATE_SELECTED)
|
|
|
|
{
|
2009-05-27 10:51:39 +02:00
|
|
|
selectedItem = i;
|
|
|
|
}
|
2009-09-27 20:19:53 +02:00
|
|
|
if(game[i]->GetState() == STATE_CLICKED)
|
|
|
|
{
|
2009-05-30 05:02:41 +02:00
|
|
|
clickedItem = i;
|
|
|
|
}
|
2009-05-27 10:51:39 +02:00
|
|
|
|
2009-09-27 20:19:53 +02: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.
2009-05-29 07:27:29 +02:00
|
|
|
|
2009-09-27 20:19:53 +02:00
|
|
|
/// OnOver-Effect + GameText + Tooltop
|
|
|
|
if(selectedItem_old != selectedItem)
|
|
|
|
{
|
|
|
|
if(selectedItem>=0)
|
|
|
|
{
|
|
|
|
game[selectedItem]->SetEffect(EFFECT_SCALE, 1, 130);
|
|
|
|
char *gameTitle = get_title(&gameList[gameIndex[selectedItem]]);
|
|
|
|
gamename->SetText(gameTitle);
|
**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.
2009-05-29 07:27:29 +02:00
|
|
|
}
|
2009-09-27 20:19:53 +02:00
|
|
|
else
|
|
|
|
gamename->SetText((char*)NULL);
|
|
|
|
if(selectedItem_old>=0)
|
|
|
|
game[selectedItem_old]->SetEffect(EFFECT_SCALE, -1, 100);
|
2009-05-28 03:46:05 +02:00
|
|
|
}
|
2009-09-27 20:19:53 +02:00
|
|
|
// navigation
|
|
|
|
if(focus && gameCnt>6)
|
|
|
|
{
|
|
|
|
|
|
|
|
int newspeed = 0;
|
|
|
|
// Left/Right Navigation
|
|
|
|
if (btnLeft->GetState() == STATE_CLICKED)
|
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Settings.xflip==sysmenu || Settings.xflip==yes || Settings.xflip==disk3d)
|
|
|
|
newspeed = SHIFT_SPEED;
|
|
|
|
else
|
|
|
|
newspeed = -SHIFT_SPEED;
|
**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.
2009-05-29 07:27:29 +02:00
|
|
|
}
|
2009-09-27 20:19:53 +02:00
|
|
|
else if(btnRight->GetState() == STATE_CLICKED)
|
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
if (Settings.xflip==sysmenu ||Settings.xflip==yes || Settings.xflip==disk3d)
|
|
|
|
newspeed = -SHIFT_SPEED;
|
|
|
|
else
|
|
|
|
newspeed = SHIFT_SPEED;
|
**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.
2009-05-29 07:27:29 +02:00
|
|
|
}
|
2009-09-27 20:19:53 +02:00
|
|
|
if(newspeed)
|
|
|
|
{
|
|
|
|
if(speed==0)
|
|
|
|
speed = newspeed;
|
|
|
|
else if(speed>0)
|
|
|
|
{
|
|
|
|
if((speed+=SPEED_STEP) > SPEED_LIMIT)
|
|
|
|
speed = SPEED_LIMIT;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if((speed-=SPEED_STEP) < -SPEED_LIMIT)
|
|
|
|
speed = -SPEED_LIMIT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
speed = 0;
|
|
|
|
|
|
|
|
|
|
|
|
if(speed > 0) // rotate right
|
|
|
|
{
|
|
|
|
GuiButton *tmpButton;
|
|
|
|
listOffset = OFFSETLIMIT(listOffset - 1, gameCnt); // set the new listOffset
|
|
|
|
// Save right Button + TollTip and destroy right Image + Image-Data
|
|
|
|
delete coverImg[pagesize-1]; coverImg[pagesize-1] = NULL;game[pagesize-1]->SetImage(NULL);
|
|
|
|
tmpButton = game[pagesize-1];
|
|
|
|
|
|
|
|
// Move all Page-Entries one step right
|
|
|
|
for (int i=pagesize-1; i>=1; i--)
|
|
|
|
{
|
|
|
|
coverImg[i] = coverImg[i-1];
|
|
|
|
game[i] = game[i-1];
|
|
|
|
gameIndex[i] = gameIndex[i-1];
|
|
|
|
}
|
|
|
|
// set saved Button & gameIndex to right
|
|
|
|
gameIndex[0] = listOffset;
|
|
|
|
coverImg[0] = new GuiImageAsync(GameCarouselLoadCoverImage, &gameList[gameIndex[0]], sizeof(struct discHdr), &noCover);
|
|
|
|
coverImg[0] ->SetWidescreen(CFG.widescreen);
|
|
|
|
|
|
|
|
game[0] = tmpButton;
|
|
|
|
game[0] ->SetImage(coverImg[0]);
|
|
|
|
|
|
|
|
|
|
|
|
for(int i=0; i<pagesize; i++)
|
|
|
|
{
|
|
|
|
game[i]->StopEffect();
|
|
|
|
game[i]->ResetState();
|
|
|
|
game[i]->SetEffect(EFFECT_GOROUND, speed, DEG_OFFSET, RADIUS, 270-(pagesize-2*i+1)*DEG_OFFSET/2, 1, 0, RADIUS);
|
|
|
|
game[i]->UpdateEffects(); // rotate one step for liquid scrolling
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(speed < 0) // rotate left
|
|
|
|
{
|
|
|
|
GuiButton *tmpButton;
|
|
|
|
listOffset = OFFSETLIMIT(listOffset + 1, gameCnt); // set the new listOffset
|
|
|
|
// Save left Button + TollTip and destroy left Image + Image-Data
|
|
|
|
delete coverImg[0]; coverImg[0] = NULL;game[0]->SetImage(NULL);
|
|
|
|
tmpButton = game[0];
|
|
|
|
|
|
|
|
// Move all Page-Entries one step left
|
|
|
|
for (int i=0; i<(pagesize-1); i++)
|
|
|
|
{
|
|
|
|
coverImg[i] = coverImg[i+1];
|
|
|
|
game[i] = game[i+1];
|
|
|
|
gameIndex[i] = gameIndex[i+1];
|
|
|
|
}
|
|
|
|
// set saved Button & gameIndex to right
|
|
|
|
int ii = pagesize-1;
|
|
|
|
gameIndex[ii] = OFFSETLIMIT(listOffset + ii, gameCnt);
|
|
|
|
coverImg[ii] = new GuiImageAsync(GameCarouselLoadCoverImage, &gameList[gameIndex[ii]], sizeof(struct discHdr), &noCover);
|
|
|
|
coverImg[ii] ->SetWidescreen(CFG.widescreen);
|
|
|
|
|
|
|
|
game[ii] = tmpButton;
|
|
|
|
game[ii] ->SetImage(coverImg[ii]);
|
|
|
|
|
|
|
|
|
|
|
|
for(int i=0; i<pagesize; i++)
|
|
|
|
{
|
|
|
|
game[i]->StopEffect();
|
|
|
|
game[i]->ResetState();
|
|
|
|
game[i]->SetEffect(EFFECT_GOROUND, speed, DEG_OFFSET, RADIUS, 270-(pagesize-2*i-3)*DEG_OFFSET/2, 1, 0, RADIUS);
|
|
|
|
game[i]->UpdateEffects(); // rotate one step for liquid scrolling
|
|
|
|
}
|
2009-05-27 10:51:39 +02:00
|
|
|
}
|
|
|
|
|
2009-09-27 20:19:53 +02:00
|
|
|
}
|
2009-05-27 10:51:39 +02:00
|
|
|
if(updateCB)
|
|
|
|
updateCB(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
|