Skip to content

Commit

Permalink
update view
Browse files Browse the repository at this point in the history
  • Loading branch information
tyanmahou committed Oct 31, 2023
1 parent d6765e4 commit 9744d1e
Showing 1 changed file with 37 additions and 12 deletions.
49 changes: 37 additions & 12 deletions Re-Abyss/app/views/UI/BossArrival/BossArrivalVM.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <abyss/views/UI/BossArrival/BossArrivalVM.hpp>
#include <abyss/views/util/Anchor/AnchorUtil.hpp>
#include <abyss/commons/Constants.hpp>
#include <abyss/commons/Resource/Font/FontAssetName.hpp>
#include <abyss/params/UI/BossArrival/Param.hpp>

Expand All @@ -16,13 +17,9 @@ namespace abyss::UI::BossArrival
}
void BossArrivalVM::draw() const
{
Vec2 pos = m_shader.getPos();
// Warning
{
constexpr auto* warningText = U"WARNING WARNING WARNING WARNING WARNING WARNING WARNING";
constexpr double thick = 3;
double move = -m_timeRate * 50;
const Vec2 pivot0{ move,Param::Pivot0 };
const Vec2 pivot1{ move,Param::Pivot1 };
const double alpha = [this]() {
if (m_timeRate <= 0.2) {
return m_timeRate / 0.2;
Expand All @@ -32,14 +29,42 @@ namespace abyss::UI::BossArrival
return 1.0-(m_timeRate-0.9) / 0.1;
}
}();
{
const double radiusRate = [this]() {
if (m_timeRate <= 0.9) {
return 0.9 + 0.1 * m_timeRate / 0.9;
} else {
return s3d::EaseInCirc(1 - (m_timeRate -0.9) / 0.1);
}
}();
const Vec2 center = Constants::AppResolution / 2 + pos;
const double radius0 = radiusRate * 250;
const double startAngle = ToRadians(20);
const double angle = ToRadians(140);
const double radius1 = radiusRate * 400;
const double thickHalf0 = 15;
const double thickHalf1 = 5;
const ColorF color(1, 0, 0, alpha * 0.4);
Circle(center, radius0).drawArc(m_timeRate + startAngle, angle, thickHalf0, thickHalf0, color);
Circle(center, radius0).drawArc(m_timeRate - startAngle, -angle, thickHalf0, thickHalf0, color);
Circle(center, radius1).drawArc(-m_timeRate + startAngle + Math::HalfPi, angle, thickHalf1, thickHalf1, color);
Circle(center, radius1).drawArc(-m_timeRate - startAngle + Math::HalfPi, -angle, thickHalf1, thickHalf1, color);
}
{
constexpr auto* warningText = U"WARNING WARNING WARNING WARNING WARNING WARNING WARNING";
constexpr double thick = 3;
double move = -m_timeRate * 50;
const Vec2 pivot0{ move,Param::Pivot0 };
const Vec2 pivot1{ move,Param::Pivot1 };
const ColorF color(1, 0, 0, alpha);

const ColorF color(1, 0, 0, alpha);
Line(AnchorUtil::FromTl(pivot0), AnchorUtil::FromTr(pivot0)).draw(thick, color);
Line(AnchorUtil::FromTl(pivot1), AnchorUtil::FromTr(pivot1)).draw(thick, color);
m_font(warningText).draw(Arg::leftCenter = (pivot0 + pivot1) /2 , color);
Line(AnchorUtil::FromBl(pivot0), AnchorUtil::FromBr(pivot0)).draw(thick, color);
Line(AnchorUtil::FromBl(pivot1), AnchorUtil::FromBr(pivot1)).draw(thick, color);
m_font(warningText).draw(Arg::rightCenter = AnchorUtil::FromBr((pivot0 + pivot1) / 2), color);
Line(pos+ AnchorUtil::FromTl(pivot0), pos + AnchorUtil::FromTr(pivot0)).draw(thick, color);
Line(pos+ AnchorUtil::FromTl(pivot1), pos + AnchorUtil::FromTr(pivot1)).draw(thick, color);
m_font(warningText).draw(Arg::leftCenter = pos + (pivot0 + pivot1) / 2, color);
Line(pos + AnchorUtil::FromBl(pivot0), pos + AnchorUtil::FromBr(pivot0)).draw(thick, color);
Line(pos + AnchorUtil::FromBl(pivot1), pos + AnchorUtil::FromBr(pivot1)).draw(thick, color);
m_font(warningText).draw(Arg::rightCenter = pos + AnchorUtil::FromBr((pivot0 + pivot1) / 2), color);
}
}
// Center Text
{
Expand Down

0 comments on commit 9744d1e

Please sign in to comment.