File Screen.cs
File List > LemonUI > LemonUI > Screen.cs
Go to the documentation of this file
#if FIVEM
using CitizenFX.Core;
using CitizenFX.Core.Native;
using CitizenFX.Core.UI;
#elif RAGEMP
using RAGE.Game;
#elif RPH
using Rage;
using Rage.Native;
using Control = Rage.GameControl;
#elif SHVDN3 || SHVDNC
using GTA;
using GTA.Native;
using GTA.UI;
#elif ALTV
using AltV.Net.Client;
using LemonUI.Elements;
#endif
using System;
using System.Drawing;
using LemonUI.Tools;
namespace LemonUI
{
[Obsolete("Use the LemonUI.Tools and LemonUI.Math namespaces.")]
public static class Screen
{
#region Properties
public static float AspectRatio => GameScreen.AspectRatio;
#if ALTV
public static Size Resolution => GameScreen.AbsoluteResolution.ToSize();
#endif
public static PointF CursorPositionRelative => GameScreen.Cursor.ToRelative();
#endregion
#region Functions
public static void ToAbsolute(float relativeX, float relativeY, out float absoluteX, out float absoluteY)
{
absoluteX = relativeX.ToXScaled();
absoluteY = relativeY.ToYScaled();
}
public static void ToRelative(float absoluteX, float absoluteY, out float relativeX, out float relativeY)
{
relativeX = absoluteX.ToXRelative();
relativeY = absoluteY.ToYRelative();
}
public static bool IsCursorInArea(PointF pos, SizeF size) => IsCursorInArea(pos.X, pos.Y, size.Width, size.Height);
public static bool IsCursorInArea(float x, float y, float width, float height)
{
// intentionally kept this way to avoid breaking backwards compatibility
PointF realPos = GetRealPosition(x, y).ToRelative();
return GameScreen.IsCursorInArea(realPos.X, realPos.Y, width, height);
}
public static PointF GetRealPosition(PointF og) => GetRealPosition(og.X, og.Y);
public static PointF GetRealPosition(float x, float y) => SafeZone.GetSafePosition(x, y);
public static void ShowCursorThisFrame() => GameScreen.ShowCursorThisFrame();
public static void SetElementAlignment(Alignment horizontal, GFXAlignment vertical) => SafeZone.SetAlignment(horizontal, vertical);
public static void SetElementAlignment(GFXAlignment horizontal, GFXAlignment vertical) => SafeZone.SetAlignment(horizontal, vertical);
public static void ResetElementAlignment() => SafeZone.ResetAlignment();
#endregion
}
}