Exemplo n.º 1
0
void FindInFiles::_process() {
	// This part can be moved to a thread if needed

	OS &os = *OS::get_singleton();
	float time_before = os.get_ticks_msec();
	while (is_processing()) {
		_iterate();
		float elapsed = (os.get_ticks_msec() - time_before);
		if (elapsed > 1000.0 / 120.0)
			break;
	}
}
Exemplo n.º 2
0
void Timer::_notification(int p_what) {

	switch(p_what) {


		case NOTIFICATION_READY: {

			if (autostart) {
#ifdef TOOLS_ENABLED
				if (get_tree()->is_editor_hint() && get_tree()->get_edited_scene_root() && (get_tree()->get_edited_scene_root()==this || get_tree()->get_edited_scene_root()->is_a_parent_of(this)))
					break;
#endif
				start();
				autostart=false;
			}
		} break;
		case NOTIFICATION_PROCESS: {
			if (timer_process_mode == TIMER_PROCESS_FIXED || !is_processing())
				return;
			time_left -= get_process_delta_time();

			if (time_left<0) {
				if (!one_shot)
					//time_left=wait_time+time_left;
					time_left = wait_time;
				else
					stop();

				emit_signal("timeout");
			}

		} break;
		case NOTIFICATION_FIXED_PROCESS: {
			if (timer_process_mode == TIMER_PROCESS_IDLE || !is_fixed_processing())
				return;
			time_left -= get_fixed_process_delta_time();

			if (time_left<0) {
				if (!one_shot)
					//time_left = wait_time + time_left;
					time_left = wait_time;
				else
					stop();
				emit_signal("timeout");
			}

		} break;
	}
}
Exemplo n.º 3
0
void Timer::set_timer_process_mode(TimerProcessMode p_mode) {

	if (timer_process_mode == p_mode)
		return;

	switch (timer_process_mode) {
		case TIMER_PROCESS_FIXED:
			if (is_fixed_processing()) {
				set_fixed_process(false);
				set_process(true);
			}
		break;
		case TIMER_PROCESS_IDLE:
			if (is_processing()) {
				set_process(false);
				set_fixed_process(true);
			}
		break;
	}
	timer_process_mode = p_mode;
}
Exemplo n.º 4
0
void TimerNode::check_queue() {
    if (timer_objs.size() > 0 && !is_processing()) {
        set_process(true);
        set_pause_mode(Node::PAUSE_MODE_PROCESS);
    }
}
Exemplo n.º 5
0
bool AnimatedSprite::is_playing() const {

	return is_processing();
}