Changed the game grid just a little bit. Press up/down to change the number of rows. if you have less that 42 or 16 games it wont let you use 3 or 2 rows respectively. ( at least that was the plan. it may not work that way.)

also made functions to skew buttons and images used for this.
This commit is contained in:
giantpune 2009-06-10 10:05:43 +00:00
parent ad2eb5c182
commit ad05aa93c1
11 changed files with 1448 additions and 324 deletions

View File

@ -101,6 +101,9 @@ extern const u32 settings_background_png_size;
extern const u8 nocover_png[]; extern const u8 nocover_png[];
extern const u32 nocover_png_size; extern const u32 nocover_png_size;
extern const u8 nocoverFlat_png[];
extern const u32 nocoverFlat_png_size;
extern const u8 nodisc_png[]; extern const u8 nodisc_png[];
extern const u32 nodisc_png_size; extern const u32 nodisc_png_size;

View File

@ -716,7 +716,6 @@ debugTxt = new GuiText(linebuf, 18, (GXColor){0,0,0, 255});
if ((backBtn.GetState()==STATE_CLICKED)||(backBtn.GetState()==STATE_HELD)){ if ((backBtn.GetState()==STATE_CLICKED)||(backBtn.GetState()==STATE_HELD)){
choice=1; choice=1;
eatADick();
synopsisTxt = NULL; synopsisTxt = NULL;
break;} break;}
@ -757,6 +756,7 @@ debugTxt = new GuiText(linebuf, 18, (GXColor){0,0,0, 255});
HaltGui(); HaltGui();
mainWindow->Remove(&gameinfoWindow); mainWindow->Remove(&gameinfoWindow);
mainWindow->SetState(STATE_DEFAULT); mainWindow->SetState(STATE_DEFAULT);
eatADick();
ResumeGui();} ResumeGui();}
else { else {
gameinfoWindow2.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 50); gameinfoWindow2.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 50);

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

View File

@ -635,6 +635,24 @@ class GuiImage : public GuiElement
//!\param s Alpha amount to draw over the image //!\param s Alpha amount to draw over the image
void SetStripe(int s); void SetStripe(int s);
s32 z; s32 z;
void SetSkew(int XX1, int YY1,int XX2, int YY2,int XX3, int YY3,int XX4, int YY4);
int xx1;
int yy1;
int xx2;
int yy2;
int xx3;
int yy3;
int xx4;
int yy4;
int rxx1;
int ryy1;
int rxx2;
int ryy2;
int rxx3;
int ryy3;
int rxx4;
int ryy4;
protected: protected:
int imgType; //!< Type of image data (IMAGE_TEXTURE, IMAGE_COLOR, IMAGE_DATA) int imgType; //!< Type of image data (IMAGE_TEXTURE, IMAGE_COLOR, IMAGE_DATA)
u8 * image; //!< Poiner to image data. May be shared with GuiImageData data u8 * image; //!< Poiner to image data. May be shared with GuiImageData data
@ -843,6 +861,7 @@ class GuiButton : public GuiElement
void Update(GuiTrigger * t); void Update(GuiTrigger * t);
//!Deactivate/Activate pointing on Games while B scrolling //!Deactivate/Activate pointing on Games while B scrolling
void ScrollIsOn(int f); void ScrollIsOn(int f);
void SetSkew(int XX1, int YY1,int XX2, int YY2,int XX3, int YY3,int XX4, int YY4);
protected: protected:
GuiImage * image; //!< Button image (default) GuiImage * image; //!< Button image (default)
GuiImage * imageOver; //!< Button image for STATE_SELECTED GuiImage * imageOver; //!< Button image for STATE_SELECTED

View File

@ -255,6 +255,20 @@ void GuiButton::RemoveSoundClick()
LOCK(this); LOCK(this);
soundClick = NULL; soundClick = NULL;
} }
void GuiButton::SetSkew(int XX1, int YY1,int XX2, int YY2,int XX3, int YY3,int XX4, int YY4)
{
image->xx1 = XX1;
image->yy1 = YY1;
image->xx2 = XX2;
image->yy2 = YY2;
image->xx3 = XX3;
image->yy3 = YY3;
image->xx4 = XX4;
image->yy4 = YY4;
}
/** /**
* Draw the button on screen * Draw the button on screen
*/ */

File diff suppressed because it is too large Load Diff

View File

@ -18,25 +18,34 @@ class GuiGameGrid : public GuiElement
void Update(GuiTrigger * t); void Update(GuiTrigger * t);
int GetOffset(); int GetOffset();
void Reload(struct discHdr * l, int count); void Reload(struct discHdr * l, int count);
//GuiText * optionVal[PAGESIZE]; void ChangeRows(int n);
protected: protected:
int selectedItem; int selectedItem;
int listOffset; int listOffset;
int scrollbaron; int scrollbaron;
int pagesize; int pagesize;
int changed; int firstPic;
int speed;
int clickedItem;
int rows;
struct discHdr * gameList; struct discHdr * gameList;
int gameCnt; int gameCnt;
int * gameIndex; int * gameIndex;
int * bob;
GuiButton ** game; GuiButton ** game;
GuiImage ** coverImg; GuiImage ** coverImg;
GuiImageData ** cover; GuiImageData ** cover;
GuiText * debugTxt;
GuiButton * btnRight; GuiButton * btnRight;
GuiButton * btnLeft; GuiButton * btnLeft;
GuiButton * btnRowUp;
GuiButton * btnRowDown;
GuiImage * btnLeftImg; GuiImage * btnLeftImg;
GuiImage * btnRightImg; GuiImage * btnRightImg;
@ -46,12 +55,12 @@ class GuiGameGrid : public GuiElement
GuiSound * btnSoundOver; GuiSound * btnSoundOver;
GuiSound * btnSoundClick; GuiSound * btnSoundClick;
GuiTrigger * trigA; GuiTrigger * trigA;
GuiTrigger * trigL; GuiTrigger * trigL;
GuiTrigger * trigR; GuiTrigger * trigR;
GuiTrigger * trigPlus; GuiTrigger * trigPlus;
GuiTrigger * trigMinus; GuiTrigger * trigMinus;
GuiTrigger * trigHeldA; GuiTrigger * trig1;
GuiTrigger * trig2;
}; };
#endif #endif

View File

@ -21,6 +21,14 @@ GuiImage::GuiImage()
tile = -1; tile = -1;
stripe = 0; stripe = 0;
widescreen = 0; widescreen = 0;
xx1 = 0;
yy1 = 0;
xx2 = 0;
yy2 = 0;
xx3 = 0;
yy3 = 0;
xx4 = 0;
yy4 = 0;
imgType = IMAGE_DATA; imgType = IMAGE_DATA;
} }
@ -33,6 +41,14 @@ GuiImage::GuiImage(GuiImageData * img)
tile = -1; tile = -1;
stripe = 0; stripe = 0;
widescreen = 0; widescreen = 0;
xx1 = 0;
yy1 = 0;
xx2 = 0;
yy2 = 0;
xx3 = 0;
yy3 = 0;
xx4 = 0;
yy4 = 0;
imgType = IMAGE_DATA; imgType = IMAGE_DATA;
} }
@ -45,6 +61,14 @@ GuiImage::GuiImage(u8 * img, int w, int h)
tile = -1; tile = -1;
stripe = 0; stripe = 0;
widescreen = 0; widescreen = 0;
xx1 = 0;
yy1 = 0;
xx2 = 0;
yy2 = 0;
xx3 = 0;
yy3 = 0;
xx4 = 0;
yy4 = 0;
imgType = IMAGE_TEXTURE; imgType = IMAGE_TEXTURE;
} }
@ -57,6 +81,14 @@ GuiImage::GuiImage(int w, int h, GXColor c)
tile = -1; tile = -1;
stripe = 0; stripe = 0;
widescreen = 0; widescreen = 0;
xx1 = 0;
yy1 = 0;
xx2 = 0;
yy2 = 0;
xx3 = 0;
yy3 = 0;
xx4 = 0;
yy4 = 0;
imgType = IMAGE_COLOR; imgType = IMAGE_COLOR;
if(!image) if(!image)
@ -167,6 +199,21 @@ void GuiImage::SetStripe(int s)
stripe = s; stripe = s;
} }
void GuiImage::SetSkew(int XX1, int YY1,int XX2, int YY2,int XX3, int YY3,int XX4, int YY4)
{
xx1 = XX1;
yy1 = YY1;
xx2 = XX2;
yy2 = YY2;
xx3 = XX3;
yy3 = YY3;
xx4 = XX4;
yy4 = YY4;
}
void GuiImage::ColorStripe(int shift) void GuiImage::ColorStripe(int shift)
{ {
LOCK(this); LOCK(this);
@ -225,6 +272,7 @@ void GuiImage::ColorStripe(int shift)
/** /**
* Draw the button on screen * Draw the button on screen
*/ */
void GuiImage::Draw() void GuiImage::Draw()
{ {
LOCK(this); LOCK(this);
@ -239,23 +287,28 @@ void GuiImage::Draw()
if(currAngleDyn) if(currAngleDyn)
imageangle = currAngleDyn; imageangle = currAngleDyn;
if(tile > 0) if(tile > 0)
{ {
for(int i=0; i<tile; i++) for(int i=0; i<tile; i++)
Menu_DrawImg(currLeft+width*i, this->GetTop(), 0, width, height, image, imageangle, widescreen ? currScale*0.80 : currScale, currScale, this->GetAlpha()); Menu_DrawImg(currLeft+width*i, this->GetTop(), 0, width, height, image, imageangle, widescreen ? currScale*0.80 : currScale, currScale, this->GetAlpha(), xx1,yy1,xx2,yy2,xx3,yy3,xx4,yy4);
} }
else else
{ {
// temporary (maybe), used to correct offset for scaled images // temporary (maybe), used to correct offset for scaled images
if(scale != 1) if(scale != 1)
currLeft = currLeft - width/2 + (width*scale)/2; currLeft = currLeft - width/2 + (width*scale)/2;
Menu_DrawImg(currLeft, this->GetTop(), 0, width, height, image, imageangle, widescreen ? currScale*0.80 : currScale, currScale, this->GetAlpha()); Menu_DrawImg(currLeft, this->GetTop(), 0, width, height, image, imageangle, widescreen ? currScale*0.80 : currScale, currScale, this->GetAlpha(), xx1,yy1,xx2,yy2,xx3,yy3,xx4,yy4);
} }
if(stripe > 0) if(stripe > 0)
for(int y=0; y < this->GetHeight(); y+=6) for(int y=0; y < this->GetHeight(); y+=6)
Menu_DrawRectangle(currLeft,this->GetTop()+y,this->GetWidth(),3,(GXColor){0, 0, 0, stripe},1); Menu_DrawRectangle(currLeft,this->GetTop()+y,this->GetWidth(),3,(GXColor){0, 0, 0, stripe},1);
this->UpdateEffects(); this->UpdateEffects();
} }

View File

@ -124,7 +124,7 @@ UpdateGUI (void *arg)
{ {
if(userInput[i].wpad.ir.valid) if(userInput[i].wpad.ir.valid)
Menu_DrawImg(userInput[i].wpad.ir.x-48, userInput[i].wpad.ir.y-48, 200.0, Menu_DrawImg(userInput[i].wpad.ir.x-48, userInput[i].wpad.ir.y-48, 200.0,
96, 96, pointer[i]->GetImage(), userInput[i].wpad.ir.angle, CFG.widescreen? 0.8 : 1, 1, 255); 96, 96, pointer[i]->GetImage(), userInput[i].wpad.ir.angle, CFG.widescreen? 0.8 : 1, 1, 255,0,0,0,0,0,0,0,0);
if(Settings.rumble == RumbleOn) if(Settings.rumble == RumbleOn)
{ {
DoRumble(i); DoRumble(i);

View File

@ -242,8 +242,8 @@ void Menu_Render()
* *
* Draws the specified image on screen using GX * Draws the specified image on screen using GX
***************************************************************************/ ***************************************************************************/
void Menu_DrawImg(f32 xpos, f32 ypos, f32 zpos, u16 width, u16 height, u8 data[], void Menu_DrawImg(f32 xpos, f32 ypos, f32 zpos, f32 width, f32 height, u8 data[],
f32 degrees, f32 scaleX, f32 scaleY, u8 alpha) f32 degrees, f32 scaleX, f32 scaleY, u8 alpha, int XX1, int YY1,int XX2, int YY2,int XX3, int YY3,int XX4, int YY4)
{ {
if(data == NULL) if(data == NULL)
return; return;
@ -270,23 +270,27 @@ void Menu_DrawImg(f32 xpos, f32 ypos, f32 zpos, u16 width, u16 height, u8 data[]
guMtxTransApply(m,m, xpos+width+0.5,ypos+height+0.5,zpos); guMtxTransApply(m,m, xpos+width+0.5,ypos+height+0.5,zpos);
guMtxConcat (GXmodelView2D, m, mv); guMtxConcat (GXmodelView2D, m, mv);
GX_LoadPosMtxImm (mv, GX_PNMTX0); GX_LoadPosMtxImm (mv, GX_PNMTX0);
//
GX_Begin(GX_QUADS, GX_VTXFMT0,4); GX_Begin(GX_QUADS, GX_VTXFMT0,4);
GX_Position3f32(-width, -height, 0); GX_Position3f32(-width+XX1 , -height+YY1, 0);
GX_Color4u8(0xFF,0xFF,0xFF,alpha); GX_Color4u8(0xFF,0xFF,0xFF,alpha);
GX_TexCoord2f32(0, 0); GX_TexCoord2f32(0, 0);
GX_Position3f32(width, -height, 0); GX_Position3f32(width+XX2, -height+YY2, 0);
GX_Color4u8(0xFF,0xFF,0xFF,alpha); GX_Color4u8(0xFF,0xFF,0xFF,alpha);
GX_TexCoord2f32(1, 0); GX_TexCoord2f32(1, 0);
GX_Position3f32(width, height, 0); GX_Position3f32(width+XX3, height+YY3, 0);
GX_Color4u8(0xFF,0xFF,0xFF,alpha); GX_Color4u8(0xFF,0xFF,0xFF,alpha);
GX_TexCoord2f32(1, 1); GX_TexCoord2f32(1, 1);
GX_Position3f32(-width, height, 0); GX_Position3f32(-width+XX4, height+YY4, 0);
GX_Color4u8(0xFF,0xFF,0xFF,alpha); GX_Color4u8(0xFF,0xFF,0xFF,alpha);
GX_TexCoord2f32(0, 1); GX_TexCoord2f32(0, 1);
//
GX_End(); GX_End();
GX_LoadPosMtxImm (GXmodelView2D, GX_PNMTX0); GX_LoadPosMtxImm (GXmodelView2D, GX_PNMTX0);

View File

@ -15,7 +15,7 @@ void InitVideo ();
void StopGX(); void StopGX();
void ResetVideo_Menu(); void ResetVideo_Menu();
void Menu_Render(); void Menu_Render();
void Menu_DrawImg(f32 xpos, f32 ypos, f32 zpos, u16 width, u16 height, u8 data[], f32 degrees, f32 scaleX, f32 scaleY, u8 alphaF ); void Menu_DrawImg(f32 xpos, f32 ypos, f32 zpos, f32 width, f32 height, u8 data[], f32 degrees, f32 scaleX, f32 scaleY, u8 alphaF ,int XX1, int YY1,int XX2, int YY2,int XX3, int YY3,int XX4, int YY4);
void Menu_DrawRectangle(f32 x, f32 y, f32 width, f32 height, GXColor color, u8 filled); void Menu_DrawRectangle(f32 x, f32 y, f32 width, f32 height, GXColor color, u8 filled);
extern int screenheight; extern int screenheight;