Add in Rotating character display component

pull/28/head
sigonasr2 1 year ago
parent b702fa2fe5
commit 3ee6d03728
  1. 6
      Crawler/CharacterInfoWindow.cpp
  2. 38
      Crawler/CharacterRotatingDisplay.h
  3. 1
      Crawler/Crawler.vcxproj
  4. 3
      Crawler/Crawler.vcxproj.filters
  5. 1
      Crawler/DEFINES.h
  6. 2
      Crawler/Version.h
  7. 3
      Crawler/assets/config/gfx/gfx.txt

@ -3,8 +3,10 @@
#include "DEFINES.h"
#include "Menu.h"
#include "MenuLabel.h"
#include "CharacterRotatingDisplay.h"
INCLUDE_game
INCLUDE_GFX
typedef Attribute A;
void Menu::InitializeClassInfoWindow(){
@ -13,4 +15,8 @@ void Menu::InitializeClassInfoWindow(){
MenuLabel*label=new MenuLabel(CLASS_INFO,{{classInfoWindow->pos.x,classInfoWindow->pos.y+8},{classInfoWindow->size.x,16}},"Warrior",2,true,true);
classInfoWindow->AddComponent("Class Name",label);
CharacterRotatingDisplay*classDisplay=new CharacterRotatingDisplay(CLASS_INFO,{classInfoWindow->center()-vf2d{classInfoWindow->size.x/4,0},{72,120}},GFX["knight_full_render1.png"].Decal());
classInfoWindow->AddComponent("Rotating Character Display",classDisplay);
}

@ -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},
});
}
};

@ -264,6 +264,7 @@
<ClInclude Include="Buff.h" />
<ClInclude Include="Bullet.h" />
<ClInclude Include="BulletTypes.h" />
<ClInclude Include="CharacterRotatingDisplay.h" />
<ClInclude Include="Class.h" />
<ClInclude Include="config.h" />
<ClInclude Include="Crawler.h" />

@ -195,6 +195,9 @@
<ClInclude Include="InventoryScrollableWindowComponent.h">
<Filter>Header Files\Interface</Filter>
</ClInclude>
<ClInclude Include="CharacterRotatingDisplay.h">
<Filter>Header Files\Interface</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Player.cpp">

@ -15,6 +15,7 @@
#define INCLUDE_GFX extern safemap<std::string,Renderable>GFX;
#define INCLUDE_ITEM_DATA extern safemap<std::string,ItemInfo>ITEM_DATA;
#define INCLUDE_ITEM_CATEGORIES extern safemap<std::string,std::set<std::string>>ITEM_CATEGORIES;
#define DO_NOTHING [](MenuFuncData data){}
#define ACCESS_PLAYER Player*p=game->GetPlayer();

@ -2,7 +2,7 @@
#define VERSION_MAJOR 0
#define VERSION_MINOR 2
#define VERSION_PATCH 0
#define VERSION_BUILD 2184
#define VERSION_BUILD 2196
#define stringify(a) stringify_(a)
#define stringify_(a) #a

@ -54,4 +54,7 @@ Images
GFX_Ranger_RapidFire_Icon = Ability Icons/rapidfire.png
GFX_Ranger_ChargedShot_Icon = Ability Icons/chargedshot.png
GFX_Ranger_MultiShot_Icon = Ability Icons/multishot.png
# Full Class Icons
GFX_Warrior_Full = knight_full_render1.png
}
Loading…
Cancel
Save