カラーバー(放送休止の画面)
https://scrapbox.io/files/6444dcc7c0e77b001bf00d92.png
使い方
ColorBar(RectF 表示したい領域);
用途
ゲームの演出など
コード
code:カラーバー.cpp
# include <Siv3D.hpp>
void ColorBar(const RectF& rect)
{
constexpr std::array<ColorF,7> colors1
{
Palette::White,
Palette::Yellow,
Palette::Cyan,
Palette::Lawngreen,
Palette::Magenta,
Palette::Red,
Palette::Blue
};
constexpr std::array<ColorF,4> colors2
{
Palette::Darkblue,
Palette::White,
Palette::Purple,
Palette::Gray
};
const double w1 = rect.w / 7.0;
const double w2 = rect.h / 4.0;
rect.draw(Palette::Black);
for (auto i : step(7))
{
RectF{ rect.x + w1 * i,rect.y,w1,2 * rect.h / 3.0 }.draw(colors1i);
if (IsEven(i))
{
RectF{ rect.x + w1 * i ,rect.y + rect.h * 2 / 3.0,w1,rect.h * (3 / 4.0 - 2 / 3.0) }.draw(colors16 - i);
}
if (i < 4)
{
RectF{ rect.x + w2 * i ,rect.y + 3 * w2,w2 }.draw(colors2i);
}
}
}
void Main()
{
while (System::Update())
{
ColorBar(Scene::Rect());
}
}
#ゲーム
#背景