parent
b702fa2fe5
commit
3ee6d03728
@ -0,0 +1,38 @@ |
||||
#pragma once |
||||
#include "MenuComponent.h" |
||||
#include "DEFINES.h" |
||||
#include "Crawler.h" |
||||
|
||||
INCLUDE_game |
||||
|
||||
class CharacterRotatingDisplay:public MenuComponent{ |
||||
protected: |
||||
Decal*icon; |
||||
float timer; |
||||
float rotatingFactor=18; |
||||
float perspectiveFactor=6; |
||||
public: |
||||
inline CharacterRotatingDisplay(MenuType parent,geom2d::rect<float>rect,Decal*icon) |
||||
:MenuComponent(parent,rect,"",DO_NOTHING),icon(icon){} |
||||
protected: |
||||
virtual inline void Update(Crawler*game)override{ |
||||
MenuComponent::Update(game); |
||||
timer+=game->GetElapsedTime(); |
||||
if(timer>=2*PI){ |
||||
timer-=2*PI; |
||||
} |
||||
} |
||||
virtual inline void Draw(Crawler*game,vf2d parentPos,bool focused)override{ |
||||
//MenuComponent::Draw(game,parentPos,focused);
|
||||
} |
||||
virtual inline void DrawDecal(Crawler*game,vf2d parentPos,bool focused)override{ |
||||
//MenuComponent::DrawDecal(game,parentPos,focused);
|
||||
std::cout<<sin(timer)<<std::endl; |
||||
game->DrawWarpedDecal(icon,std::array<vf2d,4>{ |
||||
rect.pos-icon->sprite->Size()/2+vf2d{abs(sin(timer)),sin(float(timer+PI))}*vf2d{rotatingFactor,perspectiveFactor}, |
||||
rect.pos+vf2d{0,rect.size.y}-icon->sprite->Size()/2+vf2d{abs(sin(timer)),sin(timer)}*vf2d{rotatingFactor,perspectiveFactor}, |
||||
rect.pos+rect.size-icon->sprite->Size()/2+vf2d{-abs(sin(float(timer+PI))),sin(float(timer+PI))}*vf2d{rotatingFactor,perspectiveFactor}, |
||||
rect.pos+vf2d{rect.size.x,0}-icon->sprite->Size()/2+vf2d{-abs(sin(float(timer+PI))),sin(timer)}*vf2d{rotatingFactor,perspectiveFactor}, |
||||
}); |
||||
} |
||||
}; |
Loading…
Reference in new issue