*Changed the EFFECT_GOROUND (press carousel button to test it)

This commit is contained in:
dimok321 2009-05-27 08:41:05 +00:00
parent cbaf4d6832
commit 73dada56a8
3 changed files with 71 additions and 17 deletions

View File

@ -333,6 +333,13 @@ class GuiElement
//!\param a Amount of the effect (usage varies on effect) //!\param a Amount of the effect (usage varies on effect)
//!\param t Target amount of the effect (usage varies on effect) //!\param t Target amount of the effect (usage varies on effect)
void SetEffect(int e, int a, int t=0); void SetEffect(int e, int a, int t=0);
//!This SetEffect is for EFFECT_GOROUND only
//!\param e Effect to enable
//!\param speed is for Circlespeed
//!\param circles Circleamount in degree ike 180 for 1/2 circle or 720 for 2 circles
//!\param r Circle Radius in pixel
//!\param startdegree Degree where to start circling
void SetEffect(int e, int speed, int circles, int r, int startdegree);
//!Sets an effect to be enabled on wiimote cursor over //!Sets an effect to be enabled on wiimote cursor over
//!\param e Effect to enable //!\param e Effect to enable
//!\param a Amount of the effect (usage varies on effect) //!\param a Amount of the effect (usage varies on effect)
@ -408,7 +415,10 @@ class GuiElement
int xmax; //!< Element's max X offset allowed int xmax; //!< Element's max X offset allowed
int xoffsetDyn; //!< Element X offset, dynamic (added to xoffset value for animation effects) int xoffsetDyn; //!< Element X offset, dynamic (added to xoffset value for animation effects)
int yoffsetDyn; //!< Element Y offset, dynamic (added to yoffset value for animation effects) int yoffsetDyn; //!< Element Y offset, dynamic (added to yoffset value for animation effects)
f32 degree; //!< Degree for flying stuff f32 degree; //!< Degree where to start for EFFECT_GOROUND enter it in ° like 60°
f32 frequency; //!< Speed for EFFECT_GOROUND || can also be negative for other direction
int Radius; //!< The radius in which the Element goes round for EFFECT_GOROUND
int circleamount; //!< Circleamount for the EFFECT_GOROUND effect
f32 yoffsetDynFloat; //!< Integer sucks float is need by some parts f32 yoffsetDynFloat; //!< Integer sucks float is need by some parts
int changervar; //!< Changervariable for some stuff int changervar; //!< Changervariable for some stuff
int alpha; //!< Element alpha value (0-255) int alpha; //!< Element alpha value (0-255)

View File

@ -53,8 +53,11 @@ GuiElement::GuiElement()
effectsOver = 0; effectsOver = 0;
effectAmountOver = 0; effectAmountOver = 0;
effectTargetOver = 0; effectTargetOver = 0;
degree = 0; frequency = 0;
changervar = 0; changervar = 0;
degree = -90*PI/180;
circleamount = 360;
Radius = 150;
// default alignment - align to top left // default alignment - align to top left
alignmentVert = ALIGN_TOP; alignmentVert = ALIGN_TOP;
@ -412,6 +415,19 @@ int GuiElement::GetEffect()
return effects; return effects;
} }
void GuiElement::SetEffect(int eff, int speed, int circles, int r, int startdegree) {
if(eff & EFFECT_GOROUND) {
xoffsetDyn = 0; //!position of circle in x
yoffsetDyn = 0; //!position of circle in y
Radius = r; //!Radius of the circle
degree = startdegree*PI/180;//!for example -90 (°) to start at top of circle
circleamount = circles; //!circleamoutn in degrees for example 360 for 1 circle
}
effects |= eff;
effectAmount = speed; //!Circlespeed
}
void GuiElement::SetEffect(int eff, int amount, int target) void GuiElement::SetEffect(int eff, int amount, int target)
{ {
LOCK(this); LOCK(this);
@ -436,9 +452,6 @@ void GuiElement::SetEffect(int eff, int amount, int target)
{ {
alphaDyn = alpha; alphaDyn = alpha;
} else if(eff & EFFECT_GOROUND) {
xoffsetDyn = 0;
yoffsetDyn = -200;
} else if(eff & EFFECT_ROCK_VERTICLE) { } else if(eff & EFFECT_ROCK_VERTICLE) {
changervar = 0; changervar = 0;
yoffsetDyn = 0; yoffsetDyn = 0;
@ -474,7 +487,7 @@ void GuiElement::StopEffect()
effectTarget = 0; effectTarget = 0;
effectTargetOver = 0; effectTargetOver = 0;
scaleDyn = 1; scaleDyn = 1;
degree = 0; frequency = 0;
changervar = 0; changervar = 0;
} }
@ -562,19 +575,33 @@ void GuiElement::UpdateEffects()
if(effects & EFFECT_GOROUND) { if(effects & EFFECT_GOROUND) {
if(degree < 2*PI) { //here we can let it cicle less/more than 2*PI which is 360° //!< check out gui.h for info
int Radius = 200; //this needs to be moved to a global variable if(abs(frequency) < PI*circleamount/180) {
degree += 0.08; //this defines the flying speed
xoffsetDyn = (int)(Radius*cos(degree-PI/2)); //here we can make the startdegree different frequency += effectAmount*0.001;
yoffsetDyn = (int)(Radius*sin(degree-PI/2)); //(by changing the radian degree of cos/sin xoffsetDyn = (int)(Radius*cos(frequency+degree));
yoffsetDyn = (int)(Radius*sin(frequency+degree));
} else { } else {
xoffsetDyn = 0; //fly back to the middle
yoffsetDyn += 0.08*100; if(xoffsetDyn < 0)
if(yoffsetDyn >= 0) { xoffsetDyn += frequency*100;
effects = 0; else xoffsetDyn = 0;
degree = 0; if(xoffsetDyn > 0)
xoffsetDyn -= frequency*100;
else xoffsetDyn = 0;
if(yoffsetDyn < 0)
yoffsetDyn += frequency*100;
else yoffsetDyn = 0;
if(yoffsetDyn > 0)
yoffsetDyn -= frequency*100;
else yoffsetDyn = 0;
if(xoffsetDyn == 0 && yoffsetDyn == 0) {
effects = 0;
frequency = 0;
Radius = 0;
} }
} }
} }

View File

@ -3151,6 +3151,23 @@ static int MenuDiscList()
VIDEO_WaitVSync (); VIDEO_WaitVSync ();
if(carosselleBtn.GetState() == STATE_CLICKED) {
carosselleBtn.SetEffect(EFFECT_GOROUND, 80, 180, 50, -45);
countBtn.SetEffect(EFFECT_GOROUND, -80, 180, 50, -45);
abcBtn.SetEffect(EFFECT_GOROUND, 80, 180, 50, -45);
favoriteBtn.SetEffect(EFFECT_GOROUND, -80, 360, 50, -45);
wiiBtn.SetEffect(EFFECT_GOROUND, 80, 180, 150, 180);
poweroffBtn.SetEffect(EFFECT_GOROUND, -80, 360, 150, 50);
sdcardBtn.SetEffect(EFFECT_GOROUND, 80, 360, 150, 80);
poweroffBtn.SetEffect(EFFECT_GOROUND, -80, 360, 60, 180);
settingsBtn.SetEffect(EFFECT_GOROUND, 80, 360, 200, 180);
homeBtn.SetEffect(EFFECT_GOROUND, 80, 360, 200, 180);
installBtn.SetEffect(EFFECT_GOROUND, -80, 360, 60, -90);
gridBtn.SetEffect(EFFECT_GOROUND, -80, 360, 50, 0);
DownloadBtn.SetEffect(EFFECT_GOROUND, 160, 720, 300, 0);
carosselleBtn.ResetState();
}
//CLOCK //CLOCK
time_t rawtime = time(0); //this fixes code dump caused by the clock time_t rawtime = time(0); //this fixes code dump caused by the clock
if (((Settings.hddinfo == hr12)||(Settings.hddinfo == hr24)) && rawtime != lastrawtime) { if (((Settings.hddinfo == hr12)||(Settings.hddinfo == hr24)) && rawtime != lastrawtime) {