Commit ae96f596 authored by AL's avatar AL

beautiful skillMicroInfoIcons

parent d19a8553
......@@ -2,15 +2,9 @@
ABox::ABox(DXGraphics& gfx, const ActionBox& actBox) :
actBox(actBox),
HudElement(L"Media\\Sprites\\pm_ABox.png", gfx),
HudElement(L"Media\\Sprites\\ABox.png", gfx),
skillIconInfo(actBox.GetPickedSkillsInfo()),
mi(gfx, L"Media\\Sprites\\skillIcon_quick.png")
skillMicroiconPositionReferences(L"Media\\Sprites\\blank.png", gfx)
{
skills.emplace(std::make_pair(Skill0::Inactive, std::make_unique<HudElement>(L"Media//Sprites//SkillSheet.png", gfx, 0, 7, 1)));
skills.emplace(std::make_pair(Skill0::Cut, std::make_unique<HudElement>(L"Media//Sprites//SkillSheet.png", gfx, 1, 7, 1)));
......@@ -32,17 +26,13 @@ ABox::ABox(DXGraphics& gfx, const ActionBox& actBox) :
pos4.emplace_back(-0.59f, -0.52f, 0.49f);
pos4.emplace_back(0.01f, -0.52f, 0.49f);
pos4.emplace_back(0.61f, -0.52f, 0.49f);
skillMicroiconPositionReferences.BindPositionData(&pos4);
skillMicroiconPositionReferences.AddParent(this, 0);
mi.AddDrawingPosition(0u, skills[Skill0::Inactive].get(), 0);
mi.AddDrawingPosition(0u, skills[Skill0::Inactive].get(), 1);
mi.AddDrawingPosition(0u, skills[Skill0::Inactive].get(), 2);
//skillMicroicons.emplace((SkillInfoMicroicons::Quick, std::make_unique<HudElement>(L"Media//Sprites//skillIcon_quick.png", gfx)));
//skillMicroicons.emplace((SkillInfoMicroicons::Rewinding, std::make_unique<HudElement>(L"Media//Sprites//skillIcon_rewinding.png", gfx)));
//skillMicroicons.emplace((SkillInfoMicroicons::TurnEnder, std::make_unique<HudElement>(L"Media//Sprites//skillIcon_turnEnder.png", gfx)));
//skillMicroicons.emplace((SkillInfoMicroicons::Upgraded, std::make_unique<HudElement>(L"Media//Sprites//skillIcon_upgraded.png", gfx)));
skillMicroicons.emplace(std::make_pair(SkillInfoMicroicons::Quick, std::make_unique<SkillMicroicon>(gfx, L"Media//Sprites//skillIcon_quick.png")));
skillMicroicons.emplace(std::make_pair(SkillInfoMicroicons::Rewinding, std::make_unique<SkillMicroicon>(gfx, L"Media//Sprites//skillIcon_rewinding.png")));
skillMicroicons.emplace(std::make_pair(SkillInfoMicroicons::TurnEnder, std::make_unique<SkillMicroicon>(gfx, L"Media//Sprites//skillIcon_turnEnder.png")));
skillMicroicons.emplace(std::make_pair(SkillInfoMicroicons::Upgraded, std::make_unique<SkillMicroicon>(gfx, L"Media//Sprites//skillIcon_upgraded.png")));
}
void ABox::SmartSubmit(FrameCommander& fc) const
......@@ -50,8 +40,9 @@ void ABox::SmartSubmit(FrameCommander& fc) const
this->Submit(fc, Techniques::Standart);
const auto dispSkills = actBox.GetPickedSkills();
const auto skillMicroInfo = actBox.GetPickedSkillsInfo();
posSkill[static_cast<size_t>(dispSkills.s0)].clear();
/* posSkill[static_cast<size_t>(dispSkills.s0)].clear();
posSkill[static_cast<size_t>(dispSkills.s1)].clear();
posSkill[static_cast<size_t>(dispSkills.s2)].clear();
posSkill[static_cast<size_t>(dispSkills.s3)].clear();
......@@ -59,43 +50,51 @@ void ABox::SmartSubmit(FrameCommander& fc) const
posSkill[static_cast<size_t>(dispSkills.s0)].push_back(pos4[0]);
posSkill[static_cast<size_t>(dispSkills.s1)].push_back(pos4[1]);
posSkill[static_cast<size_t>(dispSkills.s2)].push_back(pos4[2]);
posSkill[static_cast<size_t>(dispSkills.s3)].push_back(pos4[3]);
posSkill[static_cast<size_t>(dispSkills.s3)].push_back(pos4[3]);*/
for (size_t i = 0; i < 4u; i++)
{
posSkill[static_cast<size_t>(dispSkills.s[i])].clear();
}
for (size_t i = 0; i < 4u; i++) //has to be separate loops
{
posSkill[static_cast<size_t>(dispSkills.s[i])].push_back(pos4[i]);
}
skills.at(dispSkills.s0)->SmartSubmit(fc);
if (dispSkills.s0 != dispSkills.s1)skills.at(dispSkills.s1)->SmartSubmit(fc);
if (dispSkills.s0 != dispSkills.s2 && dispSkills.s1 != dispSkills.s2)skills.at(dispSkills.s2)->SmartSubmit(fc); //yep, pretty ugly, but does the job
if (dispSkills.s0 != dispSkills.s3 && dispSkills.s1 != dispSkills.s3 && dispSkills.s2 != dispSkills.s3)skills.at(dispSkills.s3)->SmartSubmit(fc); //the purpose of this contraption is to avoid multiople submissions of the same skill
skills.at(dispSkills.s[0])->SmartSubmit(fc); //the purpose of this contraption is to avoid multiople submissions of the same skill
if (dispSkills.s[0] != dispSkills.s[1])skills.at(dispSkills.s[1])->SmartSubmit(fc);
if (dispSkills.s[0] != dispSkills.s[2] && dispSkills.s[1] != dispSkills.s[2])skills.at(dispSkills.s[2])->SmartSubmit(fc); //yep, pretty ugly, but does the job
if (dispSkills.s[0] != dispSkills.s[3] && dispSkills.s[1] != dispSkills.s[3] && dispSkills.s[2] != dispSkills.s[3])skills.at(dispSkills.s[3])->SmartSubmit(fc);
//submiting skillMicroicons
mi.SmartSubmit(fc);
//for (int i = 0; i < ActionBox::GetPickedSkills().size(); i++) //drawing text over ABox skills
//{
// temp.push_back(elements[i]);
// std::string st;
// switch (i)
// {
// case(0):
// st = "W";
// break;
// case(1):
// st = "A";
// break;
// case(2):
// st = "S";
// break;
// case(3):
// st = "D";
// break;
// default:
// assert(false);
// break;
// }
// TD::DrawString(st, elements[i].second.GetPosition() + Vec2(0.04f, -0.04f), Colors::Black, 0.013f);
// TD::DrawString(st, elements[i].second.GetPosition() + Vec2(0.04f, -0.04f), Colors::Green, 0.01f);
//}
for (auto& s : skillMicroicons) s.second->ClearDrawingPositions();
for (size_t i = 0; i < skillMicroInfo.size(); i++)
{
if (dispSkills.s[i] != Skill0::Inactive)
{
size_t curIconInd = 0u;
if (skillMicroInfo[i].at(SkillInfoMicroicons::TurnEnder))
{
skillMicroicons.at(SkillInfoMicroicons::TurnEnder)->AddDrawingPosition(curIconInd, &skillMicroiconPositionReferences, i);
curIconInd++;
}
if (skillMicroInfo[i].at(SkillInfoMicroicons::Quick))
{
skillMicroicons.at(SkillInfoMicroicons::Quick)->AddDrawingPosition(curIconInd, &skillMicroiconPositionReferences, i);
curIconInd++;
}
if (skillMicroInfo[i].at(SkillInfoMicroicons::Rewinding))
{
skillMicroicons.at(SkillInfoMicroicons::Rewinding)->AddDrawingPosition(curIconInd, &skillMicroiconPositionReferences, i);
curIconInd++;
}
if (skillMicroInfo[i].at(SkillInfoMicroicons::Upgraded))
{
skillMicroicons.at(SkillInfoMicroicons::Upgraded)->AddDrawingPosition(curIconInd, &skillMicroiconPositionReferences, i);
curIconInd++;
}
}
}
for (auto& s : skillMicroicons) s.second->SmartSubmit(fc);
}
std::vector<PositionData> ABox::pos4;
std::vector<PositionData> ABox::myPosData;
......
......@@ -18,6 +18,6 @@ private:
std::unordered_map<Skill0, std::unique_ptr<HudElement>> skills;
const ActionBox& actBox;
const std::vector<std::map<SkillInfoMicroicons, bool>>& skillIconInfo; //idk why is it a vector
SkillMicroicon mi;
//std::map<SkillInfoMicroicons, std::unique_ptr<HudElement>> skillMicroicons;
HudElement skillMicroiconPositionReferences;
std::unordered_map<SkillInfoMicroicons, std::unique_ptr<SkillMicroicon>> skillMicroicons;
};
\ No newline at end of file
......@@ -68,10 +68,10 @@ void ActionBox::BlockSkills()
ABoxDrawingInfo ActionBox::GetPickedSkills() const
{
ABoxDrawingInfo abdi;
if (pickedSkills[0]->get()->GetAvalibility())abdi.s0 = static_cast<Skill0>(pickedSkills[0]->get()->GetID()); else abdi.s0 = static_cast<Skill0>(0);
if (pickedSkills[1]->get()->GetAvalibility())abdi.s1 = static_cast<Skill0>(pickedSkills[1]->get()->GetID()); else abdi.s1 = static_cast<Skill0>(0);
if (pickedSkills[2]->get()->GetAvalibility())abdi.s2 = static_cast<Skill0>(pickedSkills[2]->get()->GetID()); else abdi.s2 = static_cast<Skill0>(0);
if (pickedSkills[3]->get()->GetAvalibility())abdi.s3 = static_cast<Skill0>(pickedSkills[3]->get()->GetID()); else abdi.s3 = static_cast<Skill0>(0);
for (size_t i = 0;i<pickedSkills.size();i++)
{
if (pickedSkills[i]->get()->GetAvalibility())abdi.s[i] = static_cast<Skill0>(pickedSkills[i]->get()->GetID()); else abdi.s[i] = static_cast<Skill0>(0u);
}
return std::move(abdi);
}
......
......@@ -6,10 +6,7 @@
struct ABoxDrawingInfo
{
Skill0 s0;
Skill0 s1;
Skill0 s2;
Skill0 s3;
Skill0 s[4];
};
enum class SkillInfoMicroicons
......
......@@ -240,6 +240,9 @@ void HudElement::UnbindParents()
void HudElement::SmartSubmit(FrameCommander& fc) const
{
this->Submit(fc, Techniques::Standart);
for (size_t i = 1; i < posData->size(); i++)this->Submit(fc, Techniques::ConsecutiveStandart);
if (posData->size())
{
this->Submit(fc, Techniques::Standart);
for (size_t i = 1; i < posData->size(); i++)this->Submit(fc, Techniques::ConsecutiveStandart);
}
}
\ No newline at end of file
......@@ -27,7 +27,7 @@ public:
static void DrawString(std::wstring outputText, Vec2 position, Color c, float scale = 0.05f,float rot = 0.0f); //rotation is not implemented
static void DrawString(StringData sd);
static void DrawStringTimed(std::wstring outputText, Vec2 position, Color c, float scale = 0.02f, float time = 1.0f); //pust a string on the screen that lasts specified time
static void DrawStringAscending(std::wstring outputText, Vec2 position, Color c, float scale = 0.02f, float time = 1.0f, float speed = 0.4f); //pust a string on the screen that lasts specified time and ascends with specified speed
static void DrawStringAscending(std::wstring outputText, Vec2 position, Color c, float scale = 0.02f, float time = 1.0f, float speed = 0.3f); //pust a string on the screen that lasts specified time and ascends with specified speed
void SubmitText(float dt);
void EndFrame();
private:
......
......@@ -8,7 +8,6 @@
InitiativeBar::InitiativeBar(DXGraphics& gfx, const CombatData& cd ): cd(cd)
{
//getting main drawable data
using namespace Bind;
namespace dx = DirectX;
using Dvtx::VertexLayout;
......@@ -84,31 +83,6 @@ void InitiativeBar::UpdateFillness(DXGraphics& gfx)
cbuf->Update(gfx, cbData);
}
//DirectX::XMMATRIX InitiativeBar::GetTransformXM() const noexcept
//{
// assert(posData->size() && "no positions bound for this object - can't draw");
// currentObjectBeingDrawn++;
// if (currentObjectBeingDrawn == posData->size())currentObjectBeingDrawn = 0;
// DirectX::XMFLOAT4X4 store{ (*posData)[currentObjectBeingDrawn].pos.x,(*posData)[currentObjectBeingDrawn].pos.y,
// (*posData)[currentObjectBeingDrawn].rot.x,0.0f,
// 0.0f, 0.0f, 0.0f, 0.0f,
// 0.0f, 0.0f, 0.0f, 0.0f,
// 0.0f, 0.0f, 0.0f, 0.0f };
// if (parent.first)
// {
// DirectX::XMMATRIX parentTransform = parent.first->GetTransformXMSpecific(parent.second);
// DirectX::XMFLOAT4X4 parentDec;
// DirectX::XMStoreFloat4x4(&parentDec, parentTransform);
// store._11 *= parentDec._13;//scaling position offset
// store._12 *= parentDec._13;//scaling position offset
// store._11 += parentDec._11;//translating
// store._12 += parentDec._12;//translating
// store._13 *= parentDec._13;//scaling scale
// }
// DirectX::XMMATRIX encoded = DirectX::XMLoadFloat4x4(&store);
// return std::move(encoded);
//}
void InitiativeBar::SmartSubmit(FrameCommander& fc) const
{
this->Submit(fc, Techniques::Standart);
......@@ -116,7 +90,7 @@ void InitiativeBar::SmartSubmit(FrameCommander& fc) const
TD::DrawString(std::to_wstring(cbData.relation).substr(0u, 4u), Vec2(refPosData[0].pos.x - 0.1f, refPosData[0].pos.y), textColor,0.035f);
if (prevRelation > cbData.relation)
TD::DrawStringAscending(std::to_wstring(cbData.relation - prevRelation).substr(0u,5u), Vec2(refPosData[0].pos.x - 0.1f, refPosData[0].pos.y), Colors::Red, 0.035f, 1.0f, -0.4f);
TD::DrawStringAscending(std::to_wstring(cbData.relation - prevRelation).substr(0u,5u), Vec2(refPosData[0].pos.x - 0.1f, refPosData[0].pos.y), Colors::Red, 0.035f, 1.0f, -0.3f);
else if (prevRelation < cbData.relation)
TD::DrawStringAscending(L"+" + std::to_wstring(cbData.relation - prevRelation).substr(0u,4u), Vec2(refPosData[0].pos.x - 0.1f, refPosData[0].pos.y), Colors::LightBlue, 0.035f);
......
......@@ -57,8 +57,8 @@
void SkillMicroicon::AddDrawingPosition(size_t ind, const HudElement* parent, size_t parentInd)
{
const float y = 0.63f;
const float x = (1 + ind) * xOffset + size * ind - 1.0f;
const float y = 0.73f;
const float x = (xOffset+size) * ind - 1.0f+xInitOffset;
posData.emplace_back(x, y, size);
AddParent(parent, parentInd, posData.size() - 1u);
}
......
#pragma once
#include "Framework\HudElement.h"
class SkillMicroicon : public HudElement
class SkillMicroicon : protected HudElement
{
public:
using HudElement::SmartSubmit;
virtual ~SkillMicroicon() = default;
SkillMicroicon(DXGraphics& gfx, std::wstring spriteName) :
HudElement(spriteName, gfx) {
BindPositionData(&posData);
}
SkillMicroicon() = default;
SkillMicroicon(SkillMicroicon&&) = default;
SkillMicroicon& operator = (SkillMicroicon&&) = delete;
SkillMicroicon(SkillMicroicon&&) = delete;
//void SmartSubmit(FrameCommander& fc) const override;
//const std::vector<PositionData>& GetPosition() const;
void AddDrawingPosition(size_t ind, const HudElement* parent, size_t parentInd); //ind indicates the number (left-to-right) of this icon
......@@ -17,5 +19,6 @@ public:
protected:
std::vector<PositionData> posData;
static constexpr float xOffset = 0.04f;
static constexpr float xInitOffset = 0.60f;
static constexpr float size = 0.25f;
};
\ No newline at end of file
......@@ -69,14 +69,14 @@ void EnemyStatusBar::SmartSubmit(FrameCommander& fc) const
//handling ascending text
if (previousCD.enemyBlock > cd.enemyBlock)
TD::DrawStringAscending(std::to_wstring((int)cd.enemyBlock - (int)previousCD.enemyBlock), healthPosition + blockOffset, Colors::LightBlue, 0.035f, 1.0f, -0.4f);
TD::DrawStringAscending(std::to_wstring((int)cd.enemyBlock - (int)previousCD.enemyBlock), healthPosition + blockOffset, Colors::LightBlue, 0.035f, 1.0f, -0.3f);
else if (previousCD.enemyBlock < cd.enemyBlock)
TD::DrawStringAscending(L"+"+std::to_wstring(cd.enemyBlock - previousCD.enemyBlock), healthPosition + blockOffset, Colors::LightBlue, 0.035f, 1.0f, -0.4f);
TD::DrawStringAscending(L"+"+std::to_wstring(cd.enemyBlock - previousCD.enemyBlock), healthPosition + blockOffset, Colors::LightBlue, 0.035f, 1.0f, -0.3f);
if (previousCD.enemyHP > cd.enemyHP)
TD::DrawStringAscending(std::to_wstring((int)cd.enemyHP - (int)previousCD.enemyHP), healthPosition + healthOffset, Colors::Red, 0.035f, 1.0f, -0.4f);
TD::DrawStringAscending(std::to_wstring((int)cd.enemyHP - (int)previousCD.enemyHP), healthPosition + healthOffset, Colors::Red, 0.035f, 1.0f, -0.3f);
else if (previousCD.enemyHP < cd.enemyHP)
TD::DrawStringAscending(L"+" + std::to_wstring(cd.enemyHP - previousCD.enemyHP), healthPosition + healthOffset, Colors::Red, 0.035f, 1.0f, -0.4f);
TD::DrawStringAscending(L"+" + std::to_wstring(cd.enemyHP - previousCD.enemyHP), healthPosition + healthOffset, Colors::Red, 0.035f, 1.0f, -0.3f);
previousCD.enemyHP = cd.enemyHP;
previousCD.enemyMaxHP = cd.enemyMaxHP;
......
......@@ -16,7 +16,7 @@ void StatusIcon::SmartSubmit(FrameCommander& fc) const
if (activation.has_value())activation->SmartSubmit(fc);
this->Submit(fc, Techniques::Standart);
float speed = owner == StatusOwner::Enemy ? -0.4f : 0.4f;
float speed = owner == StatusOwner::Enemy ? -0.3f : 0.3f;
if (prevValue > value)
TD::DrawStringAscending(std::to_wstring(value - prevValue).substr(0u, 5u), Vec2(posData[0].pos.x - 0.01f, posData[0].pos.y + 0.12f), Colors::Red, 0.035f, 1.0f, speed);
else if (prevValue < value)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment