com.badlogic.gdx.utils.Timer.Task Java Examples

The following examples show how to use com.badlogic.gdx.utils.Timer.Task. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CreateProjectDialog.java    From bladecoder-adventure-engine with Apache License 2.0 6 votes vote down vote up
@Override
protected void ok() {
	try {
		Ctx.project.getEditorConfig().setProperty(ANDROID_SDK_PROP, androidSdk.getText());
		Ctx.project.saveProject();
	} catch (Exception ex) {
		String msg = ex.getClass().getSimpleName()
				+ " - " + ex.getMessage();
		Message.showMsgDialog(getStage(), "Error saving project", msg);
	}
	
	final Stage stage = getStage();

	Message.showMsg(getStage(), "Creating project...", true);
	Timer.schedule(new Task() {
		@Override
		public void run() {
			createProject(stage);
		}
	},1);
}
 
Example #2
Source File: CreateResolutionDialog.java    From bladecoder-adventure-engine with Apache License 2.0 6 votes vote down vote up
@Override
protected void ok() {

	final Stage stage = getStage();

	Message.showMsg(stage, "Creating resolution...", true);

	Timer.schedule(new Task() {
		@Override
		public void run() {
			createResolution();

			String msg = scaleImages();

			if (listener != null)
				listener.changed(new ChangeEvent(), CreateResolutionDialog.this);

			Message.hideMsg();

			if (msg != null)
				Message.showMsgDialog(stage, "Error creating resolution", msg);
		}
	}, 1);
}
 
Example #3
Source File: Message.java    From bladecoder-adventure-engine with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unused")
public static void showMsg(final Stage stage, final String text, final boolean modal) {

	// show in the next frame to allow calling when no OpenGL context is available.
	Timer.post(new Task() {

		@Override
		public void run() {
			isModal = modal;

			if (text == null) {
				hideMsg();
				return;
			}

			add(stage, text);

			if (FADE_DURATION > 0) {
				msg.getColor().a = 0;
				msg.addAction(Actions.fadeIn(FADE_DURATION, Interpolation.fade));
			}

		}
	});

}
 
Example #4
Source File: CreateAtlasDialog.java    From bladecoder-adventure-engine with Apache License 2.0 5 votes vote down vote up
@Override
protected void ok() {
	Message.showMsg(getStage(), "Generating atlas...", true);

	Timer.schedule(new Task() {
		@Override
		public void run() {
			genAtlas();
		}
	}, 1);
}
 
Example #5
Source File: Message.java    From bladecoder-adventure-engine with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unused")
public static void showMsg(final Stage stage, final String text, final float duration) {

	Timer.post(new Task() {

		@Override
		public void run() {
			isModal = false;

			if (text == null) {
				hideMsg();
				return;
			}

			add(stage, text);

			if (FADE_DURATION > 0) {
				msg.getColor().a = 0;
				msg.addAction(sequence(Actions.fadeIn(FADE_DURATION, Interpolation.fade), Actions.delay(duration,
						sequence(fadeOut(FADE_DURATION, Interpolation.fade), Actions.removeActor()))));
			} else {
				msg.addAction(sequence(Actions.delay(duration, Actions.removeActor())));
			}
		}
	});

}
 
Example #6
Source File: Message.java    From bladecoder-adventure-engine with Apache License 2.0 5 votes vote down vote up
public static void showMsgDialog(final Stage stage, final String title, final String msg) {

		Timer.post(new Task() {

			@Override
			public void run() {
				Message.hideMsg();
				
				new Dialog(title, skin).text(msg).button("Close", true).key(Keys.ENTER, true).key(Keys.ESCAPE, false)
						.show(stage);
			}
		});
	}