#pragma once #include "MenuComponent.h" #include "DEFINES.h" #include "Crawler.h" INCLUDE_game class CharacterRotatingDisplay:public MenuComponent{ protected: Decal*icon; float timer; float rotatingFactor=7; float perspectiveFactor=6; public: inline CharacterRotatingDisplay(MenuType parent,geom2d::rectrect,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); game->DrawWarpedDecal(icon,std::array{ parentPos+rect.middle()+vf2d{abs(sin(timer)),sin(float(timer+PI))}*vf2d{rotatingFactor,perspectiveFactor}, parentPos+rect.middle()+vf2d{0,rect.size.y}+vf2d{abs(sin(timer)),sin(timer)}*vf2d{rotatingFactor,perspectiveFactor}, parentPos+rect.middle()+rect.size+vf2d{-abs(sin(float(timer+PI))),sin(float(timer+PI))}*vf2d{rotatingFactor,perspectiveFactor}, parentPos+rect.middle()+vf2d{rect.size.x,0}+vf2d{-abs(sin(float(timer+PI))),sin(timer)}*vf2d{rotatingFactor,perspectiveFactor}, }); } };