2009-05-27 10:51:39 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* libwiigui
|
|
|
|
*
|
|
|
|
* gui_gamecarousel.cpp
|
|
|
|
*
|
|
|
|
* GUI class definitions
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#include "gui.h"
|
|
|
|
#include "../wpad.h"
|
|
|
|
|
|
|
|
#include <unistd.h>
|
|
|
|
#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
|
|
|
|
#define SHIFT_SPEED 100
|
2009-05-30 05:02:41 +02:00
|
|
|
#define SPEED_STEP 4
|
2009-06-01 10:45:51 +02:00
|
|
|
#define SAFETY 320
|
**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
|
|
|
/**
|
|
|
|
* Constructor for the GuiGameCarousel class.
|
|
|
|
*/
|
2009-06-01 10:45:51 +02:00
|
|
|
GuiGameCarousel::GuiGameCarousel(int w, int h, struct discHdr * l, int count, const char *themePath, const u8 *imagebg, int selected, int offset)
|
2009-05-27 10:51:39 +02:00
|
|
|
{
|
|
|
|
width = w;
|
|
|
|
height = h;
|
2009-06-01 10:45:51 +02:00
|
|
|
gameCnt = (count < SAFETY) ? count : SAFETY;
|
2009-05-27 10:51:39 +02:00
|
|
|
gameList = l;
|
**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
|
|
|
pagesize = (gameCnt < PAGESIZE) ? gameCnt : PAGESIZE;
|
2009-05-27 10:51:39 +02:00
|
|
|
listOffset = (offset == 0) ? this->FindMenuItem(-1, 1) : offset;
|
**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-05-27 10:51:39 +02:00
|
|
|
selectedItem = selected - offset;
|
|
|
|
focus = 1; // allow focus
|
|
|
|
firstPic = 0;
|
2009-05-30 05:02:41 +02:00
|
|
|
clickedItem = -1;
|
|
|
|
speed = SHIFT_SPEED;
|
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-06-06 19:26:52 +02:00
|
|
|
btnSoundClick = new GuiSound(button_click2_pcm, button_click2_pcm_size, SOUND_PCM, Settings.sfxvolume);
|
|
|
|
btnSoundOver = new GuiSound(button_over_pcm, button_over_pcm_size, SOUND_PCM, 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);
|
|
|
|
btnRight->SetEffectGrow();
|
|
|
|
|
|
|
|
gameIndex = new int[pagesize];
|
|
|
|
game = new GuiButton * [pagesize];
|
**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
|
|
|
bob = new int[pagesize];
|
2009-05-30 05:02:41 +02:00
|
|
|
coverImg = new GuiImage * [gameCnt];
|
2009-05-31 23:40:22 +02:00
|
|
|
cover = new GuiImageData * [gameCnt];
|
2009-05-28 03:46:05 +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
|
|
|
for(int i=0; i<pagesize; i++) {
|
2009-05-28 03:46:05 +02:00
|
|
|
bob[i]=i;
|
|
|
|
}
|
2009-05-27 10:51:39 +02:00
|
|
|
|
|
|
|
char ID[4];
|
|
|
|
char IDfull[7];
|
|
|
|
|
2009-05-30 05:02:41 +02:00
|
|
|
for(int i=0; i < gameCnt; i++) {
|
|
|
|
|
|
|
|
struct discHdr *header = &gameList[i];
|
2009-05-27 10:51:39 +02:00
|
|
|
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]);
|
|
|
|
|
2009-06-04 03:04:23 +02:00
|
|
|
snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.covers_path, IDfull); //Load full id image
|
2009-05-27 10:51:39 +02:00
|
|
|
cover[i] = new GuiImageData(imgPath,0);
|
|
|
|
if (!cover[i]->GetImage()) {
|
|
|
|
delete cover[i];
|
2009-06-04 03:04:23 +02:00
|
|
|
snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.covers_path, ID); //Load short id image
|
2009-05-27 10:51:39 +02:00
|
|
|
cover[i] = new GuiImageData(imgPath, 0);
|
|
|
|
if (!cover[i]->GetImage()) {
|
|
|
|
delete cover[i];
|
2009-06-04 03:04:23 +02:00
|
|
|
snprintf(imgPath, sizeof(imgPath), "%snoimage.png", Settings.covers_path); //Load no image
|
2009-05-27 10:51:39 +02:00
|
|
|
cover[i] = new GuiImageData(imgPath, nocover_png);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
coverImg[i] = new GuiImage(cover[i]);
|
**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
|
|
|
coverImg[i]->SetScale(SCALE);
|
2009-05-27 10:51:39 +02:00
|
|
|
coverImg[i]->SetWidescreen(CFG.widescreen);
|
2009-05-30 05:02:41 +02:00
|
|
|
}
|
2009-05-31 23:40:22 +02:00
|
|
|
|
2009-05-30 05:02:41 +02:00
|
|
|
for(int i=0; i < pagesize; i++) {
|
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-05-30 05:02:41 +02:00
|
|
|
game[i]->SetImage(coverImg[(listOffset+i) % gameCnt]);
|
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;
|
|
|
|
delete btnSoundOver;
|
2009-05-27 10:51:39 +02:00
|
|
|
|
|
|
|
for(int i=0; i<pagesize; i++) {
|
|
|
|
delete game[i];
|
2009-05-30 05:02:41 +02:00
|
|
|
}
|
|
|
|
for(int i=0; i<gameCnt; i++) {
|
2009-05-27 10:51:39 +02:00
|
|
|
delete coverImg[i];
|
|
|
|
delete cover[i];
|
|
|
|
}
|
2009-05-30 05:02:41 +02:00
|
|
|
|
2009-05-27 10:51:39 +02:00
|
|
|
delete [] gameIndex;
|
2009-05-28 03:46:05 +02:00
|
|
|
delete [] bob;
|
2009-05-27 10:51:39 +02:00
|
|
|
delete [] game;
|
2009-05-28 03:46:05 +02:00
|
|
|
delete [] coverImg;
|
|
|
|
delete [] cover;
|
2009-05-27 10:51:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GuiGameCarousel::SetFocus(int f)
|
|
|
|
{
|
|
|
|
LOCK(this);
|
|
|
|
focus = f;
|
|
|
|
|
|
|
|
for(int i=0; i<pagesize; i++)
|
|
|
|
game[i]->ResetState();
|
|
|
|
|
|
|
|
if(f == 1)
|
**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[bob[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()
|
|
|
|
{
|
**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()
|
|
|
|
{
|
|
|
|
int found = -1;
|
2009-06-08 18:26:04 +02:00
|
|
|
if (clickedItem>=0 && clickedItem<=pagesize){
|
|
|
|
if (game[bob[(clickedItem+1) % pagesize]]->GetState()==STATE_SELECTED){
|
|
|
|
found = (clickedItem+listOffset+1) % gameCnt;
|
|
|
|
game[bob[(clickedItem+1) % pagesize]]->SetState(STATE_SELECTED);
|
|
|
|
game[bob[clickedItem]]->SetState(STATE_SELECTED);
|
|
|
|
} else {
|
|
|
|
game[bob[clickedItem]]->SetState(STATE_SELECTED);
|
|
|
|
found= (clickedItem+listOffset) % gameCnt;}
|
|
|
|
clickedItem=-1;
|
2009-05-27 10:51:39 +02:00
|
|
|
}
|
|
|
|
return found;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int GuiGameCarousel::GetSelectedOption()
|
|
|
|
{
|
|
|
|
int found = -1;
|
2009-06-06 20:10:20 +02:00
|
|
|
for(int i=pagesize-1; i>-1; i--) {
|
**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
|
|
|
if(game[bob[i]]->GetState() == STATE_SELECTED) {
|
|
|
|
game[bob[i]]->SetState(STATE_SELECTED);
|
2009-05-30 05:02:41 +02:00
|
|
|
found = (listOffset+i) % gameCnt;
|
2009-05-27 10:51:39 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return found;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* FindMenuItem
|
|
|
|
*
|
|
|
|
* Help function to find the next visible menu item on the list
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
int GuiGameCarousel::FindMenuItem(int currentItem, int direction)
|
|
|
|
{
|
|
|
|
int nextItem = currentItem + direction;
|
|
|
|
|
|
|
|
if(nextItem < 0 || nextItem >= gameCnt)
|
**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
|
|
|
if(gameCnt <= pagesize)
|
|
|
|
return -1;
|
|
|
|
else
|
|
|
|
nextItem = (nextItem < 0) ? nextItem + gameCnt : nextItem - gameCnt;
|
2009-05-27 10:51:39 +02:00
|
|
|
|
|
|
|
if(strlen(get_title(&gameList[nextItem])) > 0)
|
|
|
|
return nextItem;
|
|
|
|
else
|
|
|
|
return FindMenuItem(nextItem, direction);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Draw the button on screen
|
|
|
|
*/
|
|
|
|
void GuiGameCarousel::Draw()
|
|
|
|
{
|
|
|
|
LOCK(this);
|
|
|
|
if(!this->IsVisible())
|
|
|
|
return;
|
|
|
|
|
|
|
|
int next = listOffset;
|
|
|
|
|
|
|
|
for(int i=0; i<pagesize; i++) {
|
|
|
|
if(next >= 0) {
|
2009-05-28 03:46:05 +02:00
|
|
|
game[bob[i]]->Draw();
|
2009-05-27 10:51:39 +02:00
|
|
|
next = this->FindMenuItem(next, 1);
|
|
|
|
} else break;
|
|
|
|
}
|
|
|
|
|
**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
|
|
|
if(gameCnt > pagesize) {
|
|
|
|
btnRight->Draw();
|
|
|
|
btnLeft->Draw();
|
|
|
|
}
|
|
|
|
|
2009-05-27 10:51:39 +02:00
|
|
|
this->UpdateEffects();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GuiGameCarousel::Update(GuiTrigger * t)
|
|
|
|
{
|
|
|
|
LOCK(this);
|
|
|
|
if(state == STATE_DISABLED || !t)
|
|
|
|
return;
|
|
|
|
|
**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
|
|
|
if(!(game[0]->GetEffect() || game[0]->GetEffectOnOver())) {
|
|
|
|
for(int i=0; i<pagesize; i++) {
|
2009-05-28 03:46:05 +02:00
|
|
|
game[i]->SetEffectGrow();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-05-27 10:51:39 +02:00
|
|
|
btnRight->Update(t);
|
|
|
|
btnLeft->Update(t);
|
|
|
|
|
|
|
|
int next = listOffset;
|
|
|
|
|
|
|
|
for(int i=0; i<pagesize; i++) {
|
|
|
|
if(next >= 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
|
|
|
if(game[bob[i]]->GetState() == STATE_DISABLED) {
|
|
|
|
game[bob[i]]->SetVisible(true);
|
|
|
|
game[bob[i]]->SetState(STATE_DEFAULT);
|
2009-05-27 10:51:39 +02:00
|
|
|
}
|
|
|
|
gameIndex[i] = next;
|
|
|
|
next = this->FindMenuItem(next, 1);
|
|
|
|
} else {
|
**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[bob[i]]->SetVisible(false);
|
|
|
|
game[bob[i]]->SetState(STATE_DISABLED);
|
2009-05-27 10:51:39 +02:00
|
|
|
}
|
|
|
|
|
2009-05-30 05:07:34 +02:00
|
|
|
if(focus) {
|
|
|
|
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);
|
|
|
|
}
|
**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[bob[i]]->Update(t);
|
2009-05-27 10:51:39 +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
|
|
|
if(game[bob[i]]->GetState() == STATE_SELECTED) {
|
2009-05-27 10:51:39 +02:00
|
|
|
selectedItem = i;
|
|
|
|
}
|
2009-05-30 05:02:41 +02:00
|
|
|
if(game[bob[i]]->GetState() == STATE_CLICKED) {
|
|
|
|
clickedItem = i;
|
|
|
|
}
|
2009-05-31 23:40:22 +02:00
|
|
|
|
2009-05-27 10:51:39 +02:00
|
|
|
}
|
|
|
|
|
2009-05-28 03:46:05 +02:00
|
|
|
// navigation
|
2009-05-30 05:02:41 +02:00
|
|
|
if(!focus || gameCnt <= pagesize || (game[bob[0]]->GetEffect() && game[bob[pagesize-1]]->GetEffect()))
|
2009-05-28 03:46:05 +02:00
|
|
|
return; // skip navigation
|
2009-05-27 10:51:39 +02:00
|
|
|
|
2009-07-11 07:55:29 +02:00
|
|
|
if (((btnLeft->GetState() == STATE_CLICKED) &&(Settings.xflip!=sysmenu)&&(Settings.xflip!=yes))
|
|
|
|
||((btnRight->GetState() == STATE_CLICKED) &&((Settings.xflip==sysmenu)||(Settings.xflip==yes)))){
|
2009-06-01 15:35:43 +02:00
|
|
|
|
|
|
|
u16 buttons = ButtonsHold();
|
2009-07-11 07:55:29 +02:00
|
|
|
if(!((buttons & WPAD_BUTTON_A) || (buttons & WPAD_BUTTON_MINUS) || t->Left() ||
|
|
|
|
(buttons & WPAD_BUTTON_PLUS) || t->Right())) {
|
**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->ResetState();
|
2009-07-11 07:55:29 +02:00
|
|
|
btnRight->ResetState();
|
2009-05-30 05:02:41 +02:00
|
|
|
speed = 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
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
for(int i=0; i<pagesize; i++) {
|
|
|
|
game[i]->StopEffect();
|
|
|
|
}
|
2009-05-30 05:02:41 +02:00
|
|
|
|
|
|
|
listOffset = (listOffset+1 < gameCnt) ? listOffset+1 : 0;
|
|
|
|
firstPic = (firstPic+1 < pagesize) ? firstPic+1 : 0;
|
2009-05-31 23:40:22 +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
|
|
|
for (int i=0; i<pagesize; i++) {
|
|
|
|
bob[i] = (firstPic+i)%pagesize;
|
2009-05-27 10:51:39 +02:00
|
|
|
}
|
|
|
|
|
2009-05-30 05:02:41 +02:00
|
|
|
game[bob[pagesize-1]]->SetImage(coverImg[(listOffset + pagesize-1) % gameCnt]);
|
**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[bob[pagesize-1]]->SetPosition(0, RADIUS);
|
2009-05-31 23:40:22 +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
|
|
|
|
|
|
|
for (int i=0; i<pagesize; i++) {
|
2009-05-30 05:02:41 +02:00
|
|
|
game[bob[i]]->SetEffect(EFFECT_GOROUND, -speed, DEG_OFFSET, RADIUS, 270-(pagesize-2*i-3)*DEG_OFFSET/2, 1, 0, RADIUS);
|
2009-05-31 23:40:22 +02:00
|
|
|
|
|
|
|
|
2009-05-28 03:46:05 +02:00
|
|
|
}
|
2009-05-30 05:02:41 +02:00
|
|
|
speed+=SPEED_STEP;
|
2009-05-28 03:46:05 +02:00
|
|
|
}
|
2009-05-27 10:51:39 +02:00
|
|
|
|
2009-07-11 07:55:29 +02:00
|
|
|
|
|
|
|
else if (((btnRight->GetState() == STATE_CLICKED) &&(Settings.xflip!=sysmenu)&&(Settings.xflip!=yes))
|
|
|
|
||((btnLeft->GetState() == STATE_CLICKED) &&((Settings.xflip==sysmenu)||(Settings.xflip==yes)))){
|
|
|
|
|
2009-06-01 15:35:43 +02:00
|
|
|
u16 buttons = ButtonsHold();
|
2009-07-11 07:55:29 +02:00
|
|
|
if(!((buttons & WPAD_BUTTON_A) || (buttons & WPAD_BUTTON_MINUS) || t->Left() ||
|
|
|
|
(buttons & WPAD_BUTTON_PLUS) || t->Right())) {
|
|
|
|
btnLeft->ResetState();
|
**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->ResetState();
|
2009-07-11 07:55:29 +02:00
|
|
|
speed = 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
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
for(int i=0; i<pagesize; i++) {
|
|
|
|
game[i]->StopEffect();
|
|
|
|
}
|
2009-05-31 23:40:22 +02:00
|
|
|
listOffset = (listOffset-1 < 0) ? gameCnt-1 : listOffset-1;
|
2009-05-30 05:02:41 +02:00
|
|
|
firstPic = (firstPic-1 < 0) ? pagesize-1 : firstPic-1;
|
2009-05-28 03:46:05 +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
|
|
|
for(int i=0; i<pagesize; i++) {
|
|
|
|
bob[i] = (firstPic+i)%pagesize;
|
2009-05-27 10:51:39 +02:00
|
|
|
}
|
|
|
|
|
2009-05-30 05:02:41 +02:00
|
|
|
game[bob[0]]->SetImage(coverImg[listOffset]);
|
**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[bob[0]]->SetPosition(0, RADIUS);
|
2009-05-27 10:51:39 +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
|
|
|
for(int i=0; i<pagesize; i++) {
|
2009-05-30 05:02:41 +02:00
|
|
|
game[bob[i]]->SetEffect(EFFECT_GOROUND, speed, DEG_OFFSET, RADIUS, 270-(pagesize-2*i+1)*DEG_OFFSET/2, 1, 0, RADIUS);
|
2009-05-27 10:51:39 +02:00
|
|
|
}
|
2009-05-30 05:02:41 +02:00
|
|
|
speed+=SPEED_STEP;
|
2009-05-27 10:51:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if(updateCB)
|
|
|
|
updateCB(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GuiGameCarousel::Reload(struct discHdr * l, int count)
|
|
|
|
{
|
2009-05-30 05:02:41 +02:00
|
|
|
for(int i=0; i<pagesize; i++) {
|
|
|
|
delete game[i];
|
|
|
|
}
|
|
|
|
for(int i=0; i<gameCnt; i++) {
|
|
|
|
delete coverImg[i];
|
|
|
|
delete cover[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
delete [] gameIndex;
|
|
|
|
delete [] bob;
|
|
|
|
delete [] game;
|
|
|
|
delete [] coverImg;
|
|
|
|
delete [] cover;
|
|
|
|
|
2009-05-27 10:51:39 +02:00
|
|
|
LOCK(this);
|
2009-05-30 05:02:41 +02:00
|
|
|
|
2009-06-01 10:45:51 +02:00
|
|
|
gameCnt = (count < SAFETY) ? count : SAFETY;
|
**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
|
|
|
gameList = l;
|
|
|
|
pagesize = (gameCnt < PAGESIZE) ? gameCnt : PAGESIZE;
|
|
|
|
listOffset = this->FindMenuItem(-1, 1);
|
2009-05-30 05:02:41 +02:00
|
|
|
selectedItem = listOffset;
|
**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
|
|
|
focus = 1;
|
2009-05-27 10:51:39 +02:00
|
|
|
firstPic = 0;
|
2009-05-30 05:02:41 +02:00
|
|
|
clickedItem = -1;
|
|
|
|
speed = SHIFT_SPEED;
|
|
|
|
|
|
|
|
gameIndex = new int[pagesize];
|
|
|
|
game = new GuiButton * [pagesize];
|
|
|
|
bob = new int[pagesize];
|
|
|
|
coverImg = new GuiImage * [gameCnt];
|
2009-05-31 23:40:22 +02:00
|
|
|
cover = new GuiImageData * [gameCnt];
|
2009-05-28 03:46:05 +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
|
|
|
for(int i=0; i<pagesize; i++) {
|
2009-05-28 03:46:05 +02:00
|
|
|
bob[i]=i;
|
|
|
|
}
|
|
|
|
|
|
|
|
char ID[4];
|
|
|
|
char IDfull[7];
|
2009-05-30 05:02:41 +02:00
|
|
|
char imgPath[100];
|
|
|
|
|
|
|
|
for(int i=0; i < gameCnt; i++) {
|
2009-05-28 03:46:05 +02:00
|
|
|
|
2009-05-30 05:02:41 +02:00
|
|
|
struct discHdr *header = &gameList[i];
|
2009-05-28 03:46:05 +02:00
|
|
|
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]);
|
|
|
|
|
2009-06-04 03:04:23 +02:00
|
|
|
snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.covers_path, IDfull); //Load full id image
|
2009-05-28 03:46:05 +02:00
|
|
|
cover[i] = new GuiImageData(imgPath,0);
|
|
|
|
if (!cover[i]->GetImage()) {
|
|
|
|
delete cover[i];
|
2009-06-04 03:04:23 +02:00
|
|
|
snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.covers_path, ID); //Load short id image
|
2009-05-28 03:46:05 +02:00
|
|
|
cover[i] = new GuiImageData(imgPath, 0);
|
|
|
|
if (!cover[i]->GetImage()) {
|
|
|
|
delete cover[i];
|
2009-06-04 03:04:23 +02:00
|
|
|
snprintf(imgPath, sizeof(imgPath), "%snoimage.png", Settings.covers_path); //Load no image
|
2009-05-28 03:46:05 +02:00
|
|
|
cover[i] = new GuiImageData(imgPath, nocover_png);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
coverImg[i] = new GuiImage(cover[i]);
|
**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
|
|
|
coverImg[i]->SetScale(SCALE);
|
2009-05-28 03:46:05 +02:00
|
|
|
coverImg[i]->SetWidescreen(CFG.widescreen);
|
2009-05-30 05:02:41 +02:00
|
|
|
}
|
2009-05-31 23:40:22 +02:00
|
|
|
|
2009-05-30 05:02:41 +02:00
|
|
|
for(int i=0; i < pagesize; i++) {
|
2009-05-28 03:46:05 +02:00
|
|
|
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);
|
2009-05-30 05:02:41 +02:00
|
|
|
game[i]->SetClickable(true);
|
|
|
|
game[i]->SetEffect(EFFECT_GOROUND, IN_SPEED, 90-(pagesize-2*i-1)*DEG_OFFSET/2, RADIUS, 180, 1, 0, RADIUS);
|
2009-05-28 03:46:05 +02:00
|
|
|
}
|
2009-05-27 10:51:39 +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
|
|
|
|