OpenSiv3D icon indicating copy to clipboard operation
OpenSiv3D copied to clipboard

Timer の残り時間(秒)を切り上げて取得する Timer::s_ceil()

Open Reputeless opened this issue 1 year ago • 1 comments

  • reported by: https://discord.com/channels/443310697397354506/999983621408567326/1249394551567679549

Reputeless avatar Jun 12 '24 12:06 Reputeless

# include <Siv3D.hpp>

void Main()
{
	Scene::SetBackground(ColorF{ 0.6, 0.8, 0.7 });
	const Font font{ FontMethod::MSDF, 40, Typeface::Bold };
	Timer timer{ 10s };

	while (System::Update())
	{
		if (SimpleGUI::Button(U"Start", Vec2{ 500, 60 }))
		{
			timer.start();
		}

		font(U"{}"_fmt(timer.format())).draw(60, Vec2{ 40, 40 }, ColorF{ 0.4 });
		font(U".s():		{}"_fmt(timer.s())).draw(60, Vec2{ 40, 140 }, ColorF{ 0.11 });
		font(U".s_ceil():	{}"_fmt(timer.s_ceil())).draw(60, Vec2{ 40, 240 }, ColorF{ 0.11 });
	}
}

Reputeless avatar Jun 12 '24 12:06 Reputeless