mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-12-22 09:51:55 +01:00
*Added simultanious angle change to EFFECT_GOROUND (to test click on carousellbtn)
This commit is contained in:
parent
b2e780567e
commit
94a8ccc7c1
source
@ -306,6 +306,9 @@ class GuiElement
|
||||
//!Considers alpha, alphaDyn, and the parent element's GetAlpha() value
|
||||
//!\return alpha
|
||||
int GetAlpha();
|
||||
//!Gets the element's AngleDyn value
|
||||
//!\return alpha
|
||||
float GetAngleDyn();
|
||||
//!Sets the element's scale
|
||||
//!\param s scale (1 is 100%)
|
||||
void SetScale(float s);
|
||||
@ -339,7 +342,9 @@ class GuiElement
|
||||
//!\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);
|
||||
//!\param anglespeedset Set the speed of Angle rotating make 1 for same speed as Circlespeed
|
||||
//! or 0.5 for half the speed of the circlingspeed. Turn Anglecircling off by 0 to this param.
|
||||
void SetEffect(int e, int speed, int circles, int r, int startdegree, f32 anglespeedset);
|
||||
//!Sets an effect to be enabled on wiimote cursor over
|
||||
//!\param e Effect to enable
|
||||
//!\param a Amount of the effect (usage varies on effect)
|
||||
@ -423,6 +428,8 @@ class GuiElement
|
||||
int changervar; //!< Changervariable for some stuff
|
||||
int alpha; //!< Element alpha value (0-255)
|
||||
f32 scale; //!< Element scale (1 = 100%)
|
||||
f32 angleDyn; //!< AngleDyn for EFFECT_GOROUND
|
||||
f32 anglespeed; //!<Anglespeedvariable for EFFECT_GOROUND
|
||||
int alphaDyn; //!< Element alpha, dynamic (multiplied by alpha value for blending/fading effects)
|
||||
f32 scaleDyn; //!< Element scale, dynamic (multiplied by alpha value for blending/fading effects)
|
||||
bool rumble; //!< Wiimote rumble (on/off) - set to on when this element requests a rumble event
|
||||
|
@ -53,11 +53,13 @@ GuiElement::GuiElement()
|
||||
effectsOver = 0;
|
||||
effectAmountOver = 0;
|
||||
effectTargetOver = 0;
|
||||
frequency = 0;
|
||||
frequency = 0.0;
|
||||
changervar = 0;
|
||||
degree = -90*PI/180;
|
||||
circleamount = 360;
|
||||
Radius = 150;
|
||||
angleDyn = 0.0;
|
||||
anglespeed = 0.0;
|
||||
|
||||
// default alignment - align to top left
|
||||
alignmentVert = ALIGN_TOP;
|
||||
@ -133,6 +135,7 @@ int GuiElement::GetTop()
|
||||
if(effects & (EFFECT_SLIDE_IN | EFFECT_SLIDE_OUT | EFFECT_GOROUND | EFFECT_ROCK_VERTICLE))
|
||||
pTop += yoffsetDyn;
|
||||
|
||||
|
||||
switch(alignmentVert)
|
||||
{
|
||||
case ALIGN_TOP:
|
||||
@ -269,6 +272,19 @@ int GuiElement::GetAlpha()
|
||||
return a;
|
||||
}
|
||||
|
||||
float GuiElement::GetAngleDyn()
|
||||
{
|
||||
float a = 0.0;
|
||||
|
||||
if(angleDyn)
|
||||
a = angleDyn;
|
||||
|
||||
if(parentElement && !angleDyn)
|
||||
a = parentElement->GetAngleDyn();
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
void GuiElement::SetScale(float s)
|
||||
{
|
||||
LOCK(this);
|
||||
@ -415,7 +431,7 @@ int GuiElement::GetEffect()
|
||||
return effects;
|
||||
}
|
||||
|
||||
void GuiElement::SetEffect(int eff, int speed, int circles, int r, int startdegree) {
|
||||
void GuiElement::SetEffect(int eff, int speed, int circles, int r, int startdegree, f32 anglespeedset) {
|
||||
|
||||
if(eff & EFFECT_GOROUND) {
|
||||
xoffsetDyn = 0; //!position of circle in x
|
||||
@ -423,6 +439,8 @@ void GuiElement::SetEffect(int eff, int speed, int circles, int r, int startdegr
|
||||
Radius = r; //!Radius of the circle
|
||||
degree = startdegree*PI/180;//!for example -90 (°) to start at top of circle
|
||||
circleamount = circles; //!circleamoutn in degrees for example 360 for 1 circle
|
||||
angleDyn = 0.0; //!this is used by the code to calc the angle
|
||||
anglespeed = anglespeedset; //!This is anglespeed depending on circle speed 1 is same speed and 0.5 half speed
|
||||
}
|
||||
effects |= eff;
|
||||
effectAmount = speed; //!Circlespeed
|
||||
@ -489,6 +507,8 @@ void GuiElement::StopEffect()
|
||||
scaleDyn = 1;
|
||||
frequency = 0;
|
||||
changervar = 0;
|
||||
angleDyn = 0;
|
||||
anglespeed = 0.0;
|
||||
}
|
||||
|
||||
void GuiElement::UpdateEffects()
|
||||
@ -578,24 +598,31 @@ void GuiElement::UpdateEffects()
|
||||
//!< check out gui.h for info
|
||||
if(abs(frequency) < PI*circleamount/180) {
|
||||
|
||||
angleDyn = (frequency+degree) * 180/PI * anglespeed;
|
||||
frequency += effectAmount*0.001;
|
||||
|
||||
xoffsetDyn = (int)(Radius*cos(frequency+degree));
|
||||
yoffsetDyn = (int)(Radius*sin(frequency+degree));
|
||||
|
||||
} else {
|
||||
//fly back to the middle
|
||||
if(xoffsetDyn < 0)
|
||||
xoffsetDyn += frequency*100;
|
||||
else xoffsetDyn = 0;
|
||||
if(xoffsetDyn > 0)
|
||||
xoffsetDyn -= frequency*100;
|
||||
|
||||
//Angle go back to start value (has to be 0.0001 when near 0 but not 0 so that the if state goes through)
|
||||
//value 0.0001 isnt noticeable that's why i chose it.
|
||||
angleDyn = degree* 180/PI * anglespeed +0.0001;
|
||||
//Reset Angle to 0
|
||||
//angleDyn = 0.0001;
|
||||
|
||||
//fly back to the middle tolerance to 0 is +- 10pixel
|
||||
if(xoffsetDyn < -10)
|
||||
xoffsetDyn += abs(effectAmount)*0.1;
|
||||
else if(xoffsetDyn > 10)
|
||||
xoffsetDyn -= abs(effectAmount)*0.1;
|
||||
else xoffsetDyn = 0;
|
||||
|
||||
if(yoffsetDyn < 0)
|
||||
yoffsetDyn += frequency*100;
|
||||
else yoffsetDyn = 0;
|
||||
if(yoffsetDyn > 0)
|
||||
yoffsetDyn -= frequency*100;
|
||||
if(yoffsetDyn < -10)
|
||||
yoffsetDyn += abs(effectAmount)*0.1;
|
||||
else if(yoffsetDyn > 10)
|
||||
yoffsetDyn -= abs(effectAmount)*0.1;
|
||||
else yoffsetDyn = 0;
|
||||
|
||||
if(xoffsetDyn == 0 && yoffsetDyn == 0) {
|
||||
|
@ -234,6 +234,11 @@ void GuiImage::Draw()
|
||||
float currScale = this->GetScale();
|
||||
int currLeft = this->GetLeft();
|
||||
|
||||
float currAngleDyn = this->GetAngleDyn();
|
||||
|
||||
if(currAngleDyn)
|
||||
imageangle = currAngleDyn;
|
||||
|
||||
if(tile > 0)
|
||||
{
|
||||
for(int i=0; i<tile; i++)
|
||||
|
@ -3152,19 +3152,19 @@ static int MenuDiscList()
|
||||
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.SetEffect(EFFECT_GOROUND, 80, 180, 50, -45, 1);
|
||||
countBtn.SetEffect(EFFECT_GOROUND, -80, 180, 50, -45, 1);
|
||||
abcBtn.SetEffect(EFFECT_GOROUND, 80, 180, 50, -45, 1);
|
||||
favoriteBtn.SetEffect(EFFECT_GOROUND, -80, 360, 50, -45, 1);
|
||||
wiiBtn.SetEffect(EFFECT_GOROUND, 80, 180, 150, 180, 1);
|
||||
poweroffBtn.SetEffect(EFFECT_GOROUND, -80, 360, 150, 50, 1);
|
||||
sdcardBtn.SetEffect(EFFECT_GOROUND, 80, 360, 150, 80, 1);
|
||||
poweroffBtn.SetEffect(EFFECT_GOROUND, -80, 360, 60, 180, 1);
|
||||
settingsBtn.SetEffect(EFFECT_GOROUND, 80, 360, 200, 180, 1);
|
||||
homeBtn.SetEffect(EFFECT_GOROUND, 80, 360, 200, 180, 1);
|
||||
installBtn.SetEffect(EFFECT_GOROUND, -80, 360, 60, -90, 1);
|
||||
gridBtn.SetEffect(EFFECT_GOROUND, -80, 360, 50, 0, 1);
|
||||
DownloadBtn.SetEffect(EFFECT_GOROUND, 100, 720, 300, 0, 1);
|
||||
carosselleBtn.ResetState();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user