예제 #1
0
void TouchScreenButton::_notification(int p_what) {

	switch(p_what) {

		case NOTIFICATION_DRAW: {

			if (!is_inside_tree())
				return;
			if (!get_tree()->is_editor_hint() && !OS::get_singleton()->has_touchscreen_ui_hint() && visibility==VISIBILITY_TOUCHSCREEN_ONLY)
				return;

			if (finger_pressed!=-1) {

				if (texture_pressed.is_valid())
					draw_texture(texture_pressed,Point2());
				else if (texture.is_valid())
					draw_texture(texture,Point2());

			} else {
				if (texture.is_valid())
					draw_texture(texture,Point2());
			}

		} break;
		case NOTIFICATION_ENTER_TREE: {

			if (!get_tree()->is_editor_hint() && !OS::get_singleton()->has_touchscreen_ui_hint() && visibility==VISIBILITY_TOUCHSCREEN_ONLY)
				return;
			update();

			if (!get_tree()->is_editor_hint())
				set_process_input(true);

			if (action.operator String()!="" && InputMap::get_singleton()->has_action(action)) {
				action_id=InputMap::get_singleton()->get_action_id(action);
			} else {
				action_id=-1;
			}
		} break;
		case NOTIFICATION_EXIT_TREE: {
			if (is_pressed())
				Input::get_singleton()->action_release(action);
		} break;
	}
}
예제 #2
0
ViewportContainer::ViewportContainer() {

	stretch = false;
	shrink = 1;
	set_process_input(true);
}