You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
763 B
35 lines
763 B
10 years ago
|
package mightypork.gamecore.core.plugins.screenshot;
|
||
10 years ago
|
|
||
|
|
||
10 years ago
|
import mightypork.gamecore.core.App;
|
||
10 years ago
|
import mightypork.gamecore.core.events.MainLoopRequest;
|
||
10 years ago
|
import mightypork.gamecore.core.plugins.AppPlugin;
|
||
10 years ago
|
import mightypork.utils.Support;
|
||
|
|
||
|
|
||
|
/**
|
||
|
* This plugin waits for a {@link ScreenshotRequest} event.<br>
|
||
|
* Upon receiving it, a screenshot is captured and written to file
|
||
|
* asynchronously.
|
||
|
*
|
||
|
* @author Ondřej Hruška (MightyPork)
|
||
|
*/
|
||
|
public class ScreenshotPlugin extends AppPlugin {
|
||
|
|
||
|
/**
|
||
|
* Take screenshot. Called by the trigger event.
|
||
|
*/
|
||
|
void takeScreenshot()
|
||
|
{
|
||
|
App.bus().send(new MainLoopRequest(new Runnable() {
|
||
|
|
||
|
@Override
|
||
|
public void run()
|
||
|
{
|
||
|
Runnable tts = new TaskTakeScreenshot();
|
||
|
Support.runAsThread(tts);
|
||
|
}
|
||
|
}));
|
||
|
}
|
||
|
}
|