Fix spinner drawing
This commit is contained in:
parent
e7b653a0c7
commit
7084c8be28
@ -13,21 +13,30 @@
|
||||
using namespace ui;
|
||||
|
||||
Spinner::Spinner(Point position, Point size):
|
||||
Component(position, size), cValue(0)
|
||||
Component(position, size), cValue(0),
|
||||
tickInternal(0)
|
||||
{
|
||||
}
|
||||
void Spinner::Tick(float dt)
|
||||
{
|
||||
cValue += 0.05f;
|
||||
tickInternal++;
|
||||
if(tickInternal == 4)
|
||||
{
|
||||
cValue += 0.25f;//0.05f;
|
||||
tickInternal = 0;
|
||||
}
|
||||
}
|
||||
void Spinner::Draw(const Point& screenPos)
|
||||
{
|
||||
Graphics * g = ui::Engine::Ref().g;
|
||||
int baseX = screenPos.X+(Size.X/2);
|
||||
int baseY = screenPos.Y+(Size.Y/2);
|
||||
for(float t = 0.0f; t < 1.0f; t+=0.05f)
|
||||
int lineInner = (Size.X/2);
|
||||
int lineOuter = (Size.X/2)+3;
|
||||
for(float t = 0.0f; t < 6.0f; t+=0.25f)
|
||||
{
|
||||
//g->drawblob(baseX+(sin(cValue+t)*(Size.X/2)), baseY+(cos(cValue+t)*(Size.X/2)), t*255, t*255, t*255);
|
||||
g->draw_line(baseX+(sin(cValue+t)*lineInner), baseY+(cos(cValue+t)*lineInner), baseX+(sin(cValue+t)*lineOuter), baseY+(cos(cValue+t)*lineOuter), (t/6)*255, (t/6)*255, (t/6)*255, 255);
|
||||
}
|
||||
}
|
||||
Spinner::~Spinner()
|
||||
|
@ -16,6 +16,7 @@ namespace ui
|
||||
class Spinner: public Component
|
||||
{
|
||||
float cValue;
|
||||
int tickInternal;
|
||||
public:
|
||||
Spinner(Point position, Point size);
|
||||
virtual void Tick(float dt);
|
||||
|
Reference in New Issue
Block a user