Add ScreenUtilities class, to replace ScreenUtils in the Engine, so it is being moved to the Editor.

This commit is contained in:
Menotdan
2023-05-16 10:50:53 -04:00
parent 818ee98b27
commit 5cf3803860
2 changed files with 51 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
#pragma once
#include "Engine/Core/Types/BaseTypes.h"
#include "Engine/Core/Delegate.h"
API_INJECT_CODE(cpp, "#include \"Editor/Utilities/ScreenUtilities/ScreenUtilities.h\"");
/// <summary>
/// Platform-dependent screen utilties.
/// </summary>
API_CLASS(Static, Name = "ScreenUtils", Tag = "NativeInvokeUseName")
class FLAXENGINE_API ScreenUtilities
{
public:
static struct FLAXENGINE_API ScriptingTypeInitializer TypeInitializer;
/// <summary>
/// Gets the pixel color at the specified coordinates.
/// </summary>
/// <param name="x">X Coordinate to read.</param>
/// <param name="y">Y Coordinate to read.</param>
/// <returns>Pixel color at the specified coordinates.</returns>
API_FUNCTION() static Color32 GetPixelAt(int32 x, int32 y);
/// <summary>
/// Gets the cursor position, in screen cooridnates.
/// </summary>
/// <returns>Cursor position, in screen coordinates.</returns>
API_FUNCTION() static Int2 GetScreenCursorPosition();
/// <summary>
/// Starts async color picking. Will return a color through ColorReturnCallback.
/// </summary
API_FUNCTION() static void PickColor();
/// <summary>
/// Blocks mouse input and runs a callback
/// </summary>
API_FUNCTION() static void BlockAndReadMouse();
/// <summary>
/// Called when PickColor() is finished.
/// </summary>
API_EVENT() static Delegate<Color32> PickColorDone;
};

View File

@@ -0,0 +1,6 @@
#if PLATFORM_WINDOWS
#include "ScreenUtilities.h"
#endif