mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 08:49:59 +09:00
Handle GlobalAction.TakeScreenshot in ScreenshotManager
This commit is contained in:
@ -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 =>
|
||||
|
Reference in New Issue
Block a user