Handle GlobalAction.TakeScreenshot in ScreenshotManager

This commit is contained in:
TocoToucan
2018-03-14 22:55:24 +03:00
parent 25f738c4ae
commit 5a1af062d3
2 changed files with 20 additions and 8 deletions

View File

@ -3,13 +3,16 @@ using System.Drawing.Imaging;
using System.IO;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input;
using osu.Framework.Input.Bindings;
using osu.Framework.Platform;
using osu.Game.Configuration;
using osu.Game.Input.Bindings;
namespace osu.Game.Graphics
{
public class ScreenshotManager : Drawable
public class ScreenshotManager : Container, IKeyBindingHandler<GlobalAction>, IHandleGlobalInput
{
private Bindable<ScreenshotFormat> screenshotFormat;
private GameHost host;
@ -24,6 +27,20 @@ namespace osu.Game.Graphics
screenshotFormat = config.GetBindable<ScreenshotFormat>(OsuSetting.ScreenshotFormat);
}
public bool OnPressed(GlobalAction action)
{
switch (action)
{
case GlobalAction.TakeScreenshot:
TakeScreenshot();
return true;
}
return false;
}
public bool OnReleased(GlobalAction action) => false;
public void TakeScreenshot()
{
host.TakeScreenshot(screenshotBitmap =>