2009-10-01 01:10:58 +02:00
|
|
|
#include "gui_diskcover.h"
|
2011-02-25 19:18:57 +01:00
|
|
|
#include "settings/CSettings.h"
|
2009-10-01 01:10:58 +02:00
|
|
|
|
2010-02-09 11:59:55 +01:00
|
|
|
GuiDiskCover::GuiDiskCover()
|
|
|
|
{
|
2011-07-26 00:28:22 +02:00
|
|
|
PosZ = 50;
|
|
|
|
Distance = 55;
|
|
|
|
OldDegBeta = 0.0;
|
|
|
|
deg_beta = 0.0;
|
|
|
|
eff_step = 0;
|
|
|
|
// spin_angle = 0;
|
|
|
|
spin_speedup = 1.0;
|
|
|
|
spin_up = false;
|
2009-10-01 01:10:58 +02:00
|
|
|
}
|
2010-09-24 02:48:03 +02:00
|
|
|
GuiDiskCover::GuiDiskCover(GuiImageData *Disk) :
|
2011-07-26 00:28:22 +02:00
|
|
|
GuiImage(Disk)
|
2010-02-09 11:59:55 +01:00
|
|
|
{
|
2011-07-26 00:28:22 +02:00
|
|
|
PosZ = 50;
|
|
|
|
Distance = 55;
|
|
|
|
OldDegBeta = 0.0;
|
|
|
|
deg_beta = 0.0;
|
|
|
|
eff_step = 0;
|
|
|
|
// spin_angle = 0;
|
|
|
|
spin_speedup = 1.0;
|
|
|
|
spin_up = false;
|
2009-10-01 01:10:58 +02:00
|
|
|
}
|
2010-02-09 11:59:55 +01:00
|
|
|
GuiDiskCover::~GuiDiskCover()
|
|
|
|
{
|
2009-10-01 01:10:58 +02:00
|
|
|
}
|
|
|
|
|
2010-09-24 02:48:03 +02:00
|
|
|
void GuiDiskCover::SetBeta(f32 beta)
|
2010-02-09 11:59:55 +01:00
|
|
|
{
|
2011-07-26 00:28:22 +02:00
|
|
|
deg_beta = beta;
|
2009-10-01 01:10:58 +02:00
|
|
|
}
|
2010-09-24 02:48:03 +02:00
|
|
|
void GuiDiskCover::SetBetaRotateEffect(f32 beta, u16 step)
|
2010-02-09 11:59:55 +01:00
|
|
|
{
|
2011-07-26 00:28:22 +02:00
|
|
|
eff_beta = beta / (f32) step;
|
|
|
|
eff_step = step;
|
2009-10-01 01:10:58 +02:00
|
|
|
}
|
2010-02-09 11:59:55 +01:00
|
|
|
bool GuiDiskCover::GetBetaRotateEffect()
|
|
|
|
{
|
2011-07-26 00:28:22 +02:00
|
|
|
return eff_step != 0;
|
2009-10-01 01:10:58 +02:00
|
|
|
}
|
|
|
|
|
2011-02-12 10:50:35 +01:00
|
|
|
void GuiDiskCover::SetState(int s, int c)
|
|
|
|
{
|
2011-07-26 00:28:22 +02:00
|
|
|
if(state == STATE_DEFAULT && s == STATE_DISABLED)
|
|
|
|
{
|
|
|
|
PosZ = 0;
|
|
|
|
Distance = 0;
|
|
|
|
OldDegBeta = deg_beta;
|
|
|
|
deg_beta = 0.0f;
|
|
|
|
}
|
|
|
|
else if(state == STATE_DISABLED && s == STATE_DEFAULT)
|
|
|
|
{
|
|
|
|
PosZ = 50;
|
|
|
|
Distance = 55;
|
|
|
|
deg_beta = OldDegBeta;
|
|
|
|
}
|
2011-02-12 10:50:35 +01:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
GuiImage::SetState(s, c);
|
2011-02-12 10:50:35 +01:00
|
|
|
}
|
|
|
|
|
2010-09-24 02:48:03 +02:00
|
|
|
void Menu_DrawDiskCover(f32 xpos, f32 ypos, f32 zpos, u16 width, u16 height, u16 distance, u8 data[], f32 deg_alpha,
|
2011-07-26 00:28:22 +02:00
|
|
|
f32 deg_beta, f32 scaleX, f32 scaleY, u8 alpha, bool shadow);
|
2009-10-01 01:10:58 +02:00
|
|
|
|
2010-02-09 11:59:55 +01:00
|
|
|
void GuiDiskCover::Draw()
|
|
|
|
{
|
2011-07-26 00:28:22 +02:00
|
|
|
LOCK( this );
|
|
|
|
if (!image || !this->IsVisible()) return;
|
|
|
|
float currScale = this->GetScale();
|
2011-06-24 21:11:36 +02:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
Menu_DrawDiskCover(this->GetLeft(), this->GetTop(), PosZ, width, height, Distance, image, imageangle, deg_beta,
|
|
|
|
widescreen ? currScale * Settings.WSFactor : currScale, currScale, 64, true);
|
|
|
|
Menu_DrawDiskCover(this->GetLeft(), this->GetTop(), PosZ, width, height, Distance, image, imageangle, deg_beta,
|
|
|
|
widescreen ? currScale * Settings.WSFactor : currScale, currScale, this->GetAlpha(), false);
|
2009-10-01 01:10:58 +02:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
if (eff_step)
|
|
|
|
{
|
|
|
|
deg_beta += eff_beta;
|
|
|
|
eff_step--;
|
|
|
|
}
|
|
|
|
GuiImage::imageangle += spin_speedup;
|
|
|
|
while (GuiImage::imageangle >= 360.0)
|
|
|
|
GuiImage::imageangle -= 360.0;
|
2010-09-19 01:16:05 +02:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
if (spin_up)
|
|
|
|
{
|
|
|
|
if (spin_speedup < 11) // speed up
|
|
|
|
spin_speedup += 0.20;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (spin_speedup > 1) spin_speedup -= 0.05; //slow down
|
|
|
|
}
|
2010-09-19 01:16:05 +02:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
this->UpdateEffects();
|
2009-10-01 01:10:58 +02:00
|
|
|
}
|