The open source repository for the action RPG game in development by Sig Productions titled 'Adventures in Lestoria'!
https://forums.lestoria.net
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.5 KiB
38 lines
1.5 KiB
1 year ago
|
#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},
|
||
|
});
|
||
|
}
|
||
|
};
|