#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::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); std::cout<DrawWarpedDecal(icon,std::array{ 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}, }); } };