コード例 #1
0
ファイル: loading_screen.cpp プロジェクト: Wedge009/wesnoth
void loading_screen::timer_callback(window& window)
{
	if (!work_ || !worker_ || worker_->timed_join(boost::posix_time::milliseconds(0))) {
		if (exception_) {
			clear_timer();
			std::rethrow_exception(exception_);
		}
		window.close();
	}
	if (!work_) {
		return;
	}
	const char* stage = current_stage_
#if defined(_MSC_VER) && _MSC_VER < 1900
		;
#else
		.load(std::memory_order_acquire);
コード例 #2
0
ファイル: outro.cpp プロジェクト: fluffbeast/wesnoth-old
void outro::draw_callback(window& window)
{
	if(SDL_GetTicks() < next_draw_) {
		return;
	}

	/* If we've faded fully in...
	 *
	 * NOTE: we want fading to take around half a second. Given this function runs about every 3 frames, we
	 * limit ourselves to a reasonable 10 fade steps with an alpha difference (rounded up) of 25.5 each cycle.
	 * The actual calculation for alpha is done in the window definition in WFL.
	 */
	if(fading_in_ && fade_step_ > 10) {
		// Schedule the fadeout after the provided delay.
		if(timer_id_ == 0) {
			timer_id_ = add_timer(duration_, [this](size_t) { fading_in_ = false; });
		}

		return;
	}

	// If we've faded fully out...
	if(!fading_in_ && fade_step_ < 0) {
		window.close();
		return;
	}

	canvas& window_canvas = window.get_canvas(0);

	window_canvas.set_variable("fade_step", wfl::variant(fade_step_));
	window_canvas.set_is_dirty(true);

	window.set_is_dirty(true);

	if(fading_in_) {
		fade_step_ ++;
	} else {
		fade_step_ --;
	}

	set_next_draw();
}
コード例 #3
0
void title_screen::on_resize(window& win)
{
	redraw_background_ = true;
	win.close();
}