Ejemplo n.º 1
0
void Main()
{
	Window::SetTitle(L"10.00");

	Stopwatch stopwatch;

	Effect effect;

	const Font font(50);

	const Vec2 pos = font(L"00.00").regionCenter(Window::Center()).pos;

	while (System::Update())
	{
		if ((!stopwatch.isActive() || stopwatch.isPaused()) && Input::MouseL.clicked)
		{
			Graphics::SetVSyncEnabled(false);
			stopwatch.start();
		}
		else if (stopwatch.isActive() && Input::MouseL.clicked)
		{
			Graphics::SetVSyncEnabled(false);
			stopwatch.pause();
		}
		else if (Input::MouseR.clicked)
		{
			stopwatch.reset();
		}
		else if (stopwatch.isPaused() && stopwatch.ms() / 10 == 10'00)
		{
			Graphics::SetVSyncEnabled(true);
			effect.add<Firework>(Circular(200, Random(TwoPi)) + Window::Center(), 30);
		}

		font(L"{:0>2}.{:0>2}"_fmt, stopwatch.s(), stopwatch.ms() % 1000 / 10).draw(pos);

		if (effect.hasEffects())
		{
			Graphics2D::SetBlendState(BlendState::Additive);

			effect.update();

			Graphics2D::SetBlendState(BlendState::Default);
		}
		else
		{
			System::Sleep(4ms);
		}
	}
}
Ejemplo n.º 2
0
        /// <summary>
        /// EasingControllerを開始、再開します。
        /// </summary>
         /// <returns>
        /// なし
        /// </returns>
		void start()
		{
			if (m_stopwatch.isActive() && m_stopwatch.ms() >= m_timeMillisec)
			{
				m_stopwatch.reset();

				std::swap(m_start, m_end);

				m_swapped = true;
			}

			m_stopwatch.start();
		}
Ejemplo n.º 3
0
		bool isActive() const
		{
			return m_stopwatch.isActive() && !isEnd();
		}