2009-05-03 20:53:31 +02:00
|
|
|
|
/****************************************************************************
|
|
|
|
|
* libwiigui
|
|
|
|
|
*
|
|
|
|
|
* Tantric 2009
|
|
|
|
|
*
|
|
|
|
|
* gui_element.cpp
|
|
|
|
|
*
|
|
|
|
|
* GUI class definitions
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "gui.h"
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructor for the Object class.
|
|
|
|
|
*/
|
2009-05-11 20:45:33 +02:00
|
|
|
|
mutex_t GuiElement::mutex = 0;
|
2009-05-03 20:53:31 +02:00
|
|
|
|
GuiElement::GuiElement()
|
|
|
|
|
{
|
|
|
|
|
xoffset = 0;
|
|
|
|
|
yoffset = 0;
|
|
|
|
|
xmin = 0;
|
|
|
|
|
xmax = 0;
|
|
|
|
|
ymin = 0;
|
|
|
|
|
ymax = 0;
|
|
|
|
|
width = 0;
|
|
|
|
|
height = 0;
|
|
|
|
|
alpha = 255;
|
|
|
|
|
scale = 1;
|
|
|
|
|
state = STATE_DEFAULT;
|
|
|
|
|
stateChan = -1;
|
|
|
|
|
trigger[0] = NULL;
|
|
|
|
|
trigger[1] = NULL;
|
|
|
|
|
trigger[2] = NULL;
|
|
|
|
|
trigger[3] = NULL;
|
|
|
|
|
trigger[4] = NULL;
|
|
|
|
|
trigger[6] = NULL;
|
|
|
|
|
parentElement = NULL;
|
|
|
|
|
rumble = true;
|
|
|
|
|
selectable = false;
|
|
|
|
|
clickable = false;
|
|
|
|
|
holdable = false;
|
|
|
|
|
visible = true;
|
|
|
|
|
focus = -1; // cannot be focused
|
|
|
|
|
updateCB = NULL;
|
|
|
|
|
yoffsetDyn = 0;
|
|
|
|
|
xoffsetDyn = 0;
|
2009-05-27 00:48:20 +02:00
|
|
|
|
yoffsetDynFloat = 0;
|
2009-05-03 20:53:31 +02:00
|
|
|
|
alphaDyn = -1;
|
|
|
|
|
scaleDyn = 1;
|
|
|
|
|
effects = 0;
|
|
|
|
|
effectAmount = 0;
|
|
|
|
|
effectTarget = 0;
|
|
|
|
|
effectsOver = 0;
|
|
|
|
|
effectAmountOver = 0;
|
|
|
|
|
effectTargetOver = 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
|
|
|
|
frequency = 0.0f;
|
2009-05-27 00:48:20 +02:00
|
|
|
|
changervar = 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
|
|
|
|
degree = -90.0f;
|
|
|
|
|
circleamount = 360.0f;
|
|
|
|
|
Radius = 150;
|
|
|
|
|
angleDyn = 0.0f;
|
|
|
|
|
anglespeed = 0.0f;
|
2009-05-03 20:53:31 +02:00
|
|
|
|
|
|
|
|
|
// default alignment - align to top left
|
|
|
|
|
alignmentVert = ALIGN_TOP;
|
|
|
|
|
alignmentHor = ALIGN_LEFT;
|
2009-05-11 20:45:33 +02:00
|
|
|
|
if(mutex == 0) LWP_MutexInit(&mutex, true);
|
2009-05-03 20:53:31 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Destructor for the GuiElement class.
|
|
|
|
|
*/
|
|
|
|
|
GuiElement::~GuiElement()
|
|
|
|
|
{
|
2009-05-11 20:45:33 +02:00
|
|
|
|
// LWP_MutexDestroy(mutex);
|
2009-05-03 20:53:31 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GuiElement::SetParent(GuiElement * e)
|
|
|
|
|
{
|
2009-05-07 00:36:28 +02:00
|
|
|
|
LOCK(this);
|
2009-05-03 20:53:31 +02:00
|
|
|
|
parentElement = e;
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* Get the left position of the GuiElement.
|
|
|
|
|
* @see SetLeft()
|
|
|
|
|
* @return Left position in pixel.
|
|
|
|
|
*/
|
|
|
|
|
int GuiElement::GetLeft()
|
|
|
|
|
{
|
|
|
|
|
int x = 0;
|
|
|
|
|
int pWidth = 0;
|
|
|
|
|
int pLeft = 0;
|
|
|
|
|
|
|
|
|
|
if(parentElement)
|
|
|
|
|
{
|
|
|
|
|
pWidth = parentElement->GetWidth();
|
|
|
|
|
pLeft = parentElement->GetLeft();
|
|
|
|
|
}
|
|
|
|
|
|
2009-05-27 00:48:20 +02:00
|
|
|
|
if(effects & (EFFECT_SLIDE_IN | EFFECT_SLIDE_OUT | EFFECT_GOROUND | EFFECT_ROCK_VERTICLE))
|
2009-05-03 20:53:31 +02:00
|
|
|
|
pLeft += xoffsetDyn;
|
|
|
|
|
|
|
|
|
|
switch(alignmentHor)
|
|
|
|
|
{
|
|
|
|
|
case ALIGN_LEFT:
|
|
|
|
|
x = pLeft;
|
|
|
|
|
break;
|
|
|
|
|
case ALIGN_CENTRE:
|
|
|
|
|
x = pLeft + (pWidth/2) - (width/2);
|
|
|
|
|
break;
|
|
|
|
|
case ALIGN_RIGHT:
|
|
|
|
|
x = pLeft + pWidth - width;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return x + xoffset;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the top position of the GuiElement.
|
|
|
|
|
* @see SetTop()
|
|
|
|
|
* @return Top position in pixel.
|
|
|
|
|
*/
|
|
|
|
|
int GuiElement::GetTop()
|
|
|
|
|
{
|
|
|
|
|
int y = 0;
|
|
|
|
|
int pHeight = 0;
|
|
|
|
|
int pTop = 0;
|
|
|
|
|
|
|
|
|
|
if(parentElement)
|
|
|
|
|
{
|
|
|
|
|
pHeight = parentElement->GetHeight();
|
|
|
|
|
pTop = parentElement->GetTop();
|
|
|
|
|
}
|
|
|
|
|
|
2009-05-27 00:48:20 +02:00
|
|
|
|
if(effects & (EFFECT_SLIDE_IN | EFFECT_SLIDE_OUT | EFFECT_GOROUND | EFFECT_ROCK_VERTICLE))
|
2009-05-03 20:53:31 +02:00
|
|
|
|
pTop += yoffsetDyn;
|
|
|
|
|
|
2009-05-27 19:16:36 +02:00
|
|
|
|
|
2009-05-03 20:53:31 +02:00
|
|
|
|
switch(alignmentVert)
|
|
|
|
|
{
|
|
|
|
|
case ALIGN_TOP:
|
|
|
|
|
y = pTop;
|
|
|
|
|
break;
|
|
|
|
|
case ALIGN_MIDDLE:
|
|
|
|
|
y = pTop + (pHeight/2) - (height/2);
|
|
|
|
|
break;
|
|
|
|
|
case ALIGN_BOTTOM:
|
|
|
|
|
y = pTop + pHeight - height;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return y + yoffset;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GuiElement::SetMinX(int x)
|
|
|
|
|
{
|
2009-05-07 00:36:28 +02:00
|
|
|
|
LOCK(this);
|
2009-05-03 20:53:31 +02:00
|
|
|
|
xmin = x;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int GuiElement::GetMinX()
|
|
|
|
|
{
|
|
|
|
|
return xmin;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GuiElement::SetMaxX(int x)
|
|
|
|
|
{
|
2009-05-07 00:36:28 +02:00
|
|
|
|
LOCK(this);
|
2009-05-03 20:53:31 +02:00
|
|
|
|
xmax = x;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int GuiElement::GetMaxX()
|
|
|
|
|
{
|
|
|
|
|
return xmax;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GuiElement::SetMinY(int y)
|
|
|
|
|
{
|
2009-05-07 00:36:28 +02:00
|
|
|
|
LOCK(this);
|
2009-05-03 20:53:31 +02:00
|
|
|
|
ymin = y;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int GuiElement::GetMinY()
|
|
|
|
|
{
|
|
|
|
|
return ymin;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GuiElement::SetMaxY(int y)
|
|
|
|
|
{
|
2009-05-07 00:36:28 +02:00
|
|
|
|
LOCK(this);
|
2009-05-03 20:53:31 +02:00
|
|
|
|
ymax = y;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int GuiElement::GetMaxY()
|
|
|
|
|
{
|
|
|
|
|
return ymax;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the width of the GuiElement.
|
|
|
|
|
* @see SetWidth()
|
|
|
|
|
* @return Width of the GuiElement.
|
|
|
|
|
*/
|
|
|
|
|
int GuiElement::GetWidth()
|
|
|
|
|
{
|
|
|
|
|
return width;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the height of the GuiElement.
|
|
|
|
|
* @see SetHeight()
|
|
|
|
|
* @return Height of the GuiElement.
|
|
|
|
|
*/
|
|
|
|
|
int GuiElement::GetHeight()
|
|
|
|
|
{
|
|
|
|
|
return height;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set the width and height of the GuiElement.
|
|
|
|
|
* @param[in] Width Width in pixel.
|
|
|
|
|
* @param[in] Height Height in pixel.
|
|
|
|
|
* @see SetWidth()
|
|
|
|
|
* @see SetHeight()
|
|
|
|
|
*/
|
|
|
|
|
void GuiElement::SetSize(int w, int h)
|
|
|
|
|
{
|
2009-05-07 00:36:28 +02:00
|
|
|
|
LOCK(this);
|
2009-05-03 20:53:31 +02:00
|
|
|
|
|
|
|
|
|
width = w;
|
|
|
|
|
height = h;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get visible.
|
|
|
|
|
* @see SetVisible()
|
|
|
|
|
* @return true if visible, false otherwise.
|
|
|
|
|
*/
|
|
|
|
|
bool GuiElement::IsVisible()
|
|
|
|
|
{
|
|
|
|
|
return visible;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set visible.
|
|
|
|
|
* @param[in] Visible Set to true to show GuiElement.
|
|
|
|
|
* @see IsVisible()
|
|
|
|
|
*/
|
|
|
|
|
void GuiElement::SetVisible(bool v)
|
|
|
|
|
{
|
2009-05-07 00:36:28 +02:00
|
|
|
|
LOCK(this);
|
2009-05-03 20:53:31 +02:00
|
|
|
|
visible = v;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GuiElement::SetAlpha(int a)
|
|
|
|
|
{
|
2009-05-07 00:36:28 +02:00
|
|
|
|
LOCK(this);
|
2009-05-03 20:53:31 +02:00
|
|
|
|
alpha = a;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int GuiElement::GetAlpha()
|
|
|
|
|
{
|
|
|
|
|
int a;
|
|
|
|
|
|
|
|
|
|
if(alphaDyn >= 0)
|
|
|
|
|
a = alphaDyn;
|
|
|
|
|
else
|
|
|
|
|
a = alpha;
|
|
|
|
|
|
|
|
|
|
if(parentElement)
|
|
|
|
|
a *= parentElement->GetAlpha()/255.0;
|
|
|
|
|
|
|
|
|
|
return a;
|
|
|
|
|
}
|
|
|
|
|
|
2009-05-27 19:16:36 +02:00
|
|
|
|
float GuiElement::GetAngleDyn()
|
|
|
|
|
{
|
|
|
|
|
float a = 0.0;
|
|
|
|
|
|
|
|
|
|
if(angleDyn)
|
|
|
|
|
a = angleDyn;
|
|
|
|
|
|
|
|
|
|
if(parentElement && !angleDyn)
|
|
|
|
|
a = parentElement->GetAngleDyn();
|
|
|
|
|
|
|
|
|
|
return a;
|
|
|
|
|
}
|
|
|
|
|
|
2009-05-03 20:53:31 +02:00
|
|
|
|
void GuiElement::SetScale(float s)
|
|
|
|
|
{
|
2009-05-07 00:36:28 +02:00
|
|
|
|
LOCK(this);
|
2009-05-03 20:53:31 +02:00
|
|
|
|
scale = s;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
float GuiElement::GetScale()
|
|
|
|
|
{
|
|
|
|
|
float s = scale * scaleDyn;
|
|
|
|
|
|
|
|
|
|
if(parentElement)
|
|
|
|
|
s *= parentElement->GetScale();
|
|
|
|
|
|
|
|
|
|
return s;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int GuiElement::GetState()
|
|
|
|
|
{
|
|
|
|
|
return state;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int GuiElement::GetStateChan()
|
|
|
|
|
{
|
|
|
|
|
return stateChan;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GuiElement::SetState(int s, int c)
|
|
|
|
|
{
|
2009-05-07 00:36:28 +02:00
|
|
|
|
LOCK(this);
|
2009-05-03 20:53:31 +02:00
|
|
|
|
state = s;
|
|
|
|
|
stateChan = c;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GuiElement::ResetState()
|
|
|
|
|
{
|
2009-05-07 00:36:28 +02:00
|
|
|
|
LOCK(this);
|
2009-05-03 20:53:31 +02:00
|
|
|
|
if(state != STATE_DISABLED)
|
|
|
|
|
{
|
|
|
|
|
state = STATE_DEFAULT;
|
|
|
|
|
stateChan = -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GuiElement::SetClickable(bool c)
|
|
|
|
|
{
|
2009-05-07 00:36:28 +02:00
|
|
|
|
LOCK(this);
|
2009-05-03 20:53:31 +02:00
|
|
|
|
clickable = c;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GuiElement::SetSelectable(bool s)
|
|
|
|
|
{
|
2009-05-07 00:36:28 +02:00
|
|
|
|
LOCK(this);
|
2009-05-03 20:53:31 +02:00
|
|
|
|
selectable = s;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GuiElement::SetHoldable(bool d)
|
|
|
|
|
{
|
2009-05-07 00:36:28 +02:00
|
|
|
|
LOCK(this);
|
2009-05-03 20:53:31 +02:00
|
|
|
|
holdable = d;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool GuiElement::IsSelectable()
|
|
|
|
|
{
|
|
|
|
|
if(state == STATE_DISABLED || state == STATE_CLICKED)
|
|
|
|
|
return false;
|
|
|
|
|
else
|
|
|
|
|
return selectable;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool GuiElement::IsClickable()
|
|
|
|
|
{
|
|
|
|
|
if(state == STATE_DISABLED ||
|
|
|
|
|
state == STATE_CLICKED ||
|
|
|
|
|
state == STATE_HELD)
|
|
|
|
|
return false;
|
|
|
|
|
else
|
|
|
|
|
return clickable;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool GuiElement::IsHoldable()
|
|
|
|
|
{
|
|
|
|
|
if(state == STATE_DISABLED)
|
|
|
|
|
return false;
|
|
|
|
|
else
|
|
|
|
|
return holdable;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GuiElement::SetFocus(int f)
|
|
|
|
|
{
|
2009-05-07 00:36:28 +02:00
|
|
|
|
LOCK(this);
|
2009-05-03 20:53:31 +02:00
|
|
|
|
focus = f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int GuiElement::IsFocused()
|
|
|
|
|
{
|
|
|
|
|
return focus;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GuiElement::SetTrigger(GuiTrigger * t)
|
|
|
|
|
{
|
2009-05-07 00:36:28 +02:00
|
|
|
|
LOCK(this);
|
2009-05-03 20:53:31 +02:00
|
|
|
|
if(!trigger[0])
|
|
|
|
|
trigger[0] = t;
|
|
|
|
|
else if(!trigger[1])
|
|
|
|
|
trigger[1] = t;
|
|
|
|
|
else if(!trigger[2])
|
|
|
|
|
trigger[2] = t;
|
|
|
|
|
else if(!trigger[3])
|
|
|
|
|
trigger[3] = t;
|
|
|
|
|
else if(!trigger[4])
|
|
|
|
|
trigger[4] = t;
|
|
|
|
|
else if(!trigger[5])
|
|
|
|
|
trigger[5] = t;
|
|
|
|
|
else // both were assigned, so we'll just overwrite the first one
|
|
|
|
|
trigger[0] = t;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GuiElement::SetTrigger(u8 i, GuiTrigger * t)
|
|
|
|
|
{
|
2009-05-07 00:36:28 +02:00
|
|
|
|
LOCK(this);
|
2009-05-03 20:53:31 +02:00
|
|
|
|
trigger[i] = t;
|
|
|
|
|
}
|
|
|
|
|
|
2009-05-13 08:48:30 +02:00
|
|
|
|
void GuiElement::RemoveTrigger(u8 i)
|
|
|
|
|
{
|
|
|
|
|
LOCK(this);
|
|
|
|
|
trigger[i] = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2009-05-03 20:53:31 +02:00
|
|
|
|
bool GuiElement::Rumble()
|
|
|
|
|
{
|
|
|
|
|
return rumble;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GuiElement::SetRumble(bool r)
|
|
|
|
|
{
|
2009-05-07 00:36:28 +02:00
|
|
|
|
LOCK(this);
|
2009-05-03 20:53:31 +02:00
|
|
|
|
rumble = r;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int GuiElement::GetEffect()
|
|
|
|
|
{
|
2009-05-20 22:09:57 +02:00
|
|
|
|
LOCK(this);
|
2009-05-03 20:53:31 +02:00
|
|
|
|
return effects;
|
**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-30 05:02:41 +02:00
|
|
|
|
int GuiElement::GetEffectOnOver()
|
|
|
|
|
{
|
|
|
|
|
LOCK(this);
|
|
|
|
|
return effectsOver;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
float GuiElement::GetFrequency()
|
|
|
|
|
{
|
|
|
|
|
LOCK(this);
|
|
|
|
|
return frequency;
|
2009-05-03 20:53:31 +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
|
|
|
|
void GuiElement::SetEffect(int eff, int speed, f32 circles, int r, f32 startdegree, f32 anglespeedset, int center_x, int center_y) {
|
2009-05-27 10:41:05 +02:00
|
|
|
|
|
|
|
|
|
if(eff & EFFECT_GOROUND) {
|
**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
|
|
|
|
xoffsetDyn = 0; //!position of circle in x
|
|
|
|
|
yoffsetDyn = 0; //!position of circle in y
|
|
|
|
|
Radius = r; //!radius of the circle
|
|
|
|
|
degree = startdegree; //!for example -90 (<28>) to start at top of circle
|
|
|
|
|
circleamount = circles; //!circleamoutn in degrees for example 360 for 1 circle
|
|
|
|
|
angleDyn = 0.0f; //!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
|
|
|
|
|
temp_xoffset = center_x; //!position of center in x
|
|
|
|
|
temp_yoffset = center_y; //!position of center in y
|
2009-05-27 10:41:05 +02:00
|
|
|
|
}
|
|
|
|
|
effects |= eff;
|
|
|
|
|
effectAmount = speed; //!Circlespeed
|
|
|
|
|
}
|
|
|
|
|
|
2009-05-03 20:53:31 +02:00
|
|
|
|
void GuiElement::SetEffect(int eff, int amount, int target)
|
|
|
|
|
{
|
2009-05-07 00:36:28 +02:00
|
|
|
|
LOCK(this);
|
2009-05-03 20:53:31 +02:00
|
|
|
|
if(eff & EFFECT_SLIDE_IN)
|
|
|
|
|
{
|
|
|
|
|
// these calculations overcompensate a little
|
|
|
|
|
if(eff & EFFECT_SLIDE_TOP)
|
|
|
|
|
yoffsetDyn = -screenheight;
|
|
|
|
|
else if(eff & EFFECT_SLIDE_LEFT)
|
|
|
|
|
xoffsetDyn = -screenwidth;
|
|
|
|
|
else if(eff & EFFECT_SLIDE_BOTTOM)
|
|
|
|
|
yoffsetDyn = screenheight;
|
|
|
|
|
else if(eff & EFFECT_SLIDE_RIGHT)
|
|
|
|
|
xoffsetDyn = screenwidth;
|
|
|
|
|
}
|
2009-05-27 00:48:20 +02:00
|
|
|
|
|
2009-05-03 20:53:31 +02:00
|
|
|
|
if(eff & EFFECT_FADE && amount > 0)
|
|
|
|
|
{
|
|
|
|
|
alphaDyn = 0;
|
|
|
|
|
}
|
|
|
|
|
else if(eff & EFFECT_FADE && amount < 0)
|
|
|
|
|
{
|
|
|
|
|
alphaDyn = alpha;
|
2009-05-27 00:48:20 +02:00
|
|
|
|
|
|
|
|
|
} else if(eff & EFFECT_ROCK_VERTICLE) {
|
|
|
|
|
changervar = 0;
|
|
|
|
|
yoffsetDyn = 0;
|
|
|
|
|
yoffsetDynFloat = 0.0;
|
2009-05-03 20:53:31 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
effects |= eff;
|
|
|
|
|
effectAmount = amount;
|
|
|
|
|
effectTarget = target;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GuiElement::SetEffectOnOver(int eff, int amount, int target)
|
|
|
|
|
{
|
2009-05-07 00:36:28 +02:00
|
|
|
|
LOCK(this);
|
2009-05-03 20:53:31 +02:00
|
|
|
|
effectsOver |= eff;
|
|
|
|
|
effectAmountOver = amount;
|
|
|
|
|
effectTargetOver = target;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GuiElement::SetEffectGrow()
|
|
|
|
|
{
|
|
|
|
|
SetEffectOnOver(EFFECT_SCALE, 4, 110);
|
|
|
|
|
}
|
|
|
|
|
|
2009-05-27 00:48:20 +02:00
|
|
|
|
void GuiElement::StopEffect()
|
|
|
|
|
{
|
**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
|
|
|
|
xoffsetDyn = 0;
|
2009-05-27 00:48:20 +02:00
|
|
|
|
yoffsetDyn = 0;
|
|
|
|
|
effects = 0;
|
|
|
|
|
effectsOver = 0;
|
|
|
|
|
effectAmount = 0;
|
|
|
|
|
effectAmountOver = 0;
|
|
|
|
|
effectTarget = 0;
|
|
|
|
|
effectTargetOver = 0;
|
|
|
|
|
scaleDyn = 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
|
|
|
|
frequency = 0.0f;
|
2009-05-27 00:48:20 +02:00
|
|
|
|
changervar = 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
|
|
|
|
//angleDyn = 0.0f;
|
|
|
|
|
anglespeed = 0.0f;
|
2009-05-27 00:48:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
2009-05-03 20:53:31 +02:00
|
|
|
|
void GuiElement::UpdateEffects()
|
|
|
|
|
{
|
2009-05-07 00:36:28 +02:00
|
|
|
|
LOCK(this);
|
2009-05-27 00:48:20 +02:00
|
|
|
|
|
|
|
|
|
if(effects & (EFFECT_SLIDE_IN | EFFECT_SLIDE_OUT | EFFECT_GOROUND))
|
2009-05-03 20:53:31 +02:00
|
|
|
|
{
|
|
|
|
|
if(effects & EFFECT_SLIDE_IN)
|
|
|
|
|
{
|
|
|
|
|
if(effects & EFFECT_SLIDE_LEFT)
|
|
|
|
|
{
|
|
|
|
|
xoffsetDyn += effectAmount;
|
|
|
|
|
|
|
|
|
|
if(xoffsetDyn >= 0)
|
|
|
|
|
{
|
|
|
|
|
xoffsetDyn = 0;
|
|
|
|
|
effects = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if(effects & EFFECT_SLIDE_RIGHT)
|
|
|
|
|
{
|
|
|
|
|
xoffsetDyn -= effectAmount;
|
|
|
|
|
|
|
|
|
|
if(xoffsetDyn <= 0)
|
|
|
|
|
{
|
|
|
|
|
xoffsetDyn = 0;
|
|
|
|
|
effects = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if(effects & EFFECT_SLIDE_TOP)
|
|
|
|
|
{
|
|
|
|
|
yoffsetDyn += effectAmount;
|
|
|
|
|
|
|
|
|
|
if(yoffsetDyn >= 0)
|
|
|
|
|
{
|
|
|
|
|
yoffsetDyn = 0;
|
|
|
|
|
effects = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if(effects & EFFECT_SLIDE_BOTTOM)
|
|
|
|
|
{
|
|
|
|
|
yoffsetDyn -= effectAmount;
|
|
|
|
|
|
|
|
|
|
if(yoffsetDyn <= 0)
|
|
|
|
|
{
|
|
|
|
|
yoffsetDyn = 0;
|
|
|
|
|
effects = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if(effects & EFFECT_SLIDE_LEFT)
|
|
|
|
|
{
|
|
|
|
|
xoffsetDyn -= effectAmount;
|
|
|
|
|
|
|
|
|
|
if(xoffsetDyn <= -screenwidth)
|
|
|
|
|
effects = 0; // shut off effect
|
|
|
|
|
}
|
|
|
|
|
else if(effects & EFFECT_SLIDE_RIGHT)
|
|
|
|
|
{
|
|
|
|
|
xoffsetDyn += effectAmount;
|
|
|
|
|
|
|
|
|
|
if(xoffsetDyn >= screenwidth)
|
|
|
|
|
effects = 0; // shut off effect
|
|
|
|
|
}
|
|
|
|
|
else if(effects & EFFECT_SLIDE_TOP)
|
|
|
|
|
{
|
|
|
|
|
yoffsetDyn -= effectAmount;
|
|
|
|
|
|
|
|
|
|
if(yoffsetDyn <= -screenheight)
|
|
|
|
|
effects = 0; // shut off effect
|
|
|
|
|
}
|
|
|
|
|
else if(effects & EFFECT_SLIDE_BOTTOM)
|
|
|
|
|
{
|
|
|
|
|
yoffsetDyn += effectAmount;
|
|
|
|
|
|
|
|
|
|
if(yoffsetDyn >= screenheight)
|
|
|
|
|
effects = 0; // shut off effect
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-05-27 00:48:20 +02:00
|
|
|
|
|
|
|
|
|
if(effects & EFFECT_GOROUND) {
|
2009-05-28 03:46:05 +02:00
|
|
|
|
//!< check out gui.h for info
|
|
|
|
|
xoffset = temp_xoffset;
|
**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
|
|
|
|
yoffset = temp_yoffset;
|
|
|
|
|
if(fabs(frequency) < circleamount) {
|
|
|
|
|
angleDyn = (frequency+degree+90.0f) * anglespeed;
|
|
|
|
|
xoffsetDyn = (int) lround(((f32) Radius)*cos((frequency+degree)*PI/180.0f));
|
|
|
|
|
yoffsetDyn = (int) lround(((f32) Radius)*sin((frequency+degree)*PI/180.0f));
|
|
|
|
|
frequency += ((f32) effectAmount)*0.01f;
|
2009-05-28 03:46:05 +02:00
|
|
|
|
} 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
|
|
|
|
f32 temp_frequency = ((effectAmount<0)?-1.0f:1.0f)*circleamount;
|
|
|
|
|
angleDyn = (temp_frequency+degree+90.0f) * anglespeed;
|
|
|
|
|
xoffsetDyn = (int) lround(((f32) Radius)*cos((temp_frequency+degree)*PI/180.0f));
|
|
|
|
|
yoffsetDyn = (int) lround(((f32) Radius)*sin((temp_frequency+degree)*PI/180.0f));
|
2009-05-28 03:46:05 +02:00
|
|
|
|
xoffset += xoffsetDyn;
|
|
|
|
|
yoffset += yoffsetDyn;
|
**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
|
|
|
|
effects ^= EFFECT_GOROUND;
|
|
|
|
|
frequency = 0.0f;
|
2009-05-28 03:46:05 +02:00
|
|
|
|
}
|
2009-05-27 00:48:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(effects & EFFECT_ROCK_VERTICLE) {
|
|
|
|
|
//move up to 10pixel above 0
|
|
|
|
|
if(changervar == 0 && yoffsetDynFloat < 11.0) {
|
|
|
|
|
yoffsetDynFloat += (effectAmount*0.01);
|
|
|
|
|
} else if(yoffsetDynFloat > 10.0) {
|
|
|
|
|
changervar = 1;
|
|
|
|
|
}
|
|
|
|
|
//move down till 10pixel under 0
|
|
|
|
|
if(changervar == 1 && yoffsetDynFloat > -11.0) {
|
|
|
|
|
yoffsetDynFloat -= (effectAmount*0.01);
|
|
|
|
|
} else if(yoffsetDynFloat < -10.0) {
|
|
|
|
|
changervar = 0;
|
|
|
|
|
}
|
|
|
|
|
yoffsetDyn = (int)(yoffsetDynFloat);
|
|
|
|
|
}
|
|
|
|
|
|
2009-05-03 20:53:31 +02:00
|
|
|
|
if(effects & EFFECT_FADE)
|
|
|
|
|
{
|
|
|
|
|
alphaDyn += effectAmount;
|
|
|
|
|
|
|
|
|
|
if(effectAmount < 0 && alphaDyn <= 0)
|
|
|
|
|
{
|
|
|
|
|
alphaDyn = 0;
|
|
|
|
|
effects = 0; // shut off effect
|
|
|
|
|
}
|
|
|
|
|
else if(effectAmount > 0 && alphaDyn >= alpha)
|
|
|
|
|
{
|
|
|
|
|
alphaDyn = alpha;
|
|
|
|
|
effects = 0; // shut off effect
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-05-27 00:48:20 +02:00
|
|
|
|
if(effects & EFFECT_SCALE)
|
2009-05-03 20:53:31 +02:00
|
|
|
|
{
|
|
|
|
|
scaleDyn += effectAmount/100.0;
|
|
|
|
|
|
|
|
|
|
if((effectAmount < 0 && scaleDyn <= effectTarget/100.0)
|
|
|
|
|
|| (effectAmount > 0 && scaleDyn >= effectTarget/100.0))
|
|
|
|
|
{
|
|
|
|
|
scaleDyn = effectTarget/100.0;
|
|
|
|
|
effects = 0; // shut off effect
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-05-27 00:48:20 +02:00
|
|
|
|
if(effects & EFFECT_PULSE)
|
|
|
|
|
{
|
|
|
|
|
int percent = 10; //go down from target by this
|
|
|
|
|
|
|
|
|
|
if((scaleDyn <= (effectTarget*0.01)) && (!changervar)) {
|
|
|
|
|
scaleDyn += (effectAmount*0.001);
|
|
|
|
|
} else if(scaleDyn > (effectTarget*0.01)) {
|
|
|
|
|
changervar = 1;
|
|
|
|
|
}
|
|
|
|
|
if((scaleDyn >= ((effectTarget-percent)*0.01)) && (changervar)) {
|
|
|
|
|
scaleDyn -= (effectAmount*0.001);
|
|
|
|
|
} else if(scaleDyn < ((effectTarget-percent)*0.01)) {
|
|
|
|
|
changervar = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-05-03 20:53:31 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GuiElement::Update(GuiTrigger * t)
|
|
|
|
|
{
|
2009-05-07 00:36:28 +02:00
|
|
|
|
LOCK(this);
|
2009-05-03 20:53:31 +02:00
|
|
|
|
if(updateCB)
|
|
|
|
|
updateCB(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GuiElement::SetUpdateCallback(UpdateCallback u)
|
|
|
|
|
{
|
2009-05-07 00:36:28 +02:00
|
|
|
|
LOCK(this);
|
2009-05-03 20:53:31 +02:00
|
|
|
|
updateCB = u;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GuiElement::SetPosition(int xoff, int yoff)
|
|
|
|
|
{
|
2009-05-07 00:36:28 +02:00
|
|
|
|
LOCK(this);
|
2009-05-03 20:53:31 +02:00
|
|
|
|
xoffset = xoff;
|
|
|
|
|
yoffset = yoff;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GuiElement::SetAlignment(int hor, int vert)
|
|
|
|
|
{
|
2009-05-07 00:36:28 +02:00
|
|
|
|
LOCK(this);
|
2009-05-03 20:53:31 +02:00
|
|
|
|
alignmentHor = hor;
|
|
|
|
|
alignmentVert = vert;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int GuiElement::GetSelected()
|
|
|
|
|
{
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Draw an element on screen.
|
|
|
|
|
*/
|
|
|
|
|
void GuiElement::Draw()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2009-05-04 21:06:16 +02:00
|
|
|
|
/**
|
|
|
|
|
* Draw Tooltips on screen.
|
|
|
|
|
*/
|
|
|
|
|
void GuiElement::DrawTooltip()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2009-05-03 20:53:31 +02:00
|
|
|
|
/**
|
|
|
|
|
* Check if a position is inside the GuiElement.
|
|
|
|
|
* @param[in] x X position in pixel.
|
|
|
|
|
* @param[in] y Y position in pixel.
|
|
|
|
|
*/
|
|
|
|
|
bool GuiElement::IsInside(int x, int y)
|
|
|
|
|
{
|
|
|
|
|
if(x > this->GetLeft() && x < (this->GetLeft()+width)
|
|
|
|
|
&& y > this->GetTop() && y < (this->GetTop()+height))
|
|
|
|
|
return true;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2009-05-07 00:36:28 +02:00
|
|
|
|
void GuiElement::Lock()
|
|
|
|
|
{
|
|
|
|
|
LWP_MutexLock(mutex);
|
|
|
|
|
}
|
|
|
|
|
void GuiElement::Unlock()
|
|
|
|
|
{
|
|
|
|
|
LWP_MutexUnlock(mutex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SimpleLock::SimpleLock(GuiElement *e) : element(e)
|
|
|
|
|
{
|
|
|
|
|
element->Lock();
|
|
|
|
|
}
|
|
|
|
|
SimpleLock::~SimpleLock()
|
|
|
|
|
{
|
|
|
|
|
element->Unlock();
|
|
|
|
|
}
|