parent
94f0b4c3e4
commit
7d61de7c61
@ -0,0 +1,12 @@ |
||||
package mightypork.gamecore.gui; |
||||
|
||||
|
||||
/** |
||||
* Element that can be assigned an action (ie. button); |
||||
* |
||||
* @author MightyPork |
||||
*/ |
||||
public interface ActionTrigger { |
||||
|
||||
void setAction(Action action); |
||||
} |
@ -1,7 +0,0 @@ |
||||
package mightypork.gamecore.input; |
||||
|
||||
|
||||
public interface ActionTrigger { |
||||
|
||||
void setAction(Action action); |
||||
} |
@ -1,56 +0,0 @@ |
||||
package mightypork.rogue; |
||||
|
||||
|
||||
import java.io.File; |
||||
import java.io.IOException; |
||||
import java.text.DateFormat; |
||||
import java.text.SimpleDateFormat; |
||||
import java.util.Date; |
||||
|
||||
import mightypork.gamecore.render.DisplaySystem; |
||||
import mightypork.gamecore.render.Screenshot; |
||||
import mightypork.utils.logging.Log; |
||||
|
||||
|
||||
public class TaskTakeScreenshot implements Runnable { |
||||
|
||||
private final Screenshot scr; |
||||
|
||||
|
||||
public TaskTakeScreenshot() { |
||||
scr = DisplaySystem.takeScreenshot(); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void run() |
||||
{ |
||||
final String fname = getUniqueScreenshotName(); |
||||
|
||||
// generate unique filename
|
||||
File file; |
||||
int index = 0; |
||||
while (true) { |
||||
file = new File(Paths.SCREENSHOTS, fname + (index > 0 ? "-" + index : "") + ".png"); |
||||
if (!file.exists()) break; |
||||
index++; |
||||
} |
||||
|
||||
Log.f3("Saving screenshot to file: " + file); |
||||
|
||||
// save to disk
|
||||
try { |
||||
scr.save(file); |
||||
} catch (final IOException e) { |
||||
Log.e("Failed to save screenshot.", e); |
||||
} |
||||
} |
||||
|
||||
|
||||
private static String getUniqueScreenshotName() |
||||
{ |
||||
final DateFormat df = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss"); |
||||
return df.format(new Date()); |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue