Merge commit 'f2ecefb7ee9b9e6c5daac9f44fe40ebdccbb1c76' into 1.6
This commit is contained in:
@@ -329,15 +329,6 @@ void ApplePlatform::CreateGuid(Guid& result)
|
||||
result.D = ptr[3];
|
||||
}
|
||||
|
||||
bool ApplePlatform::CanOpenUrl(const StringView& url)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void ApplePlatform::OpenUrl(const StringView& url)
|
||||
{
|
||||
}
|
||||
|
||||
String ApplePlatform::GetExecutableFilePath()
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
|
||||
@@ -88,8 +88,6 @@ public:
|
||||
static String GetUserLocaleName();
|
||||
static bool GetHasFocus();
|
||||
static void CreateGuid(Guid& result);
|
||||
static bool CanOpenUrl(const StringView& url);
|
||||
static void OpenUrl(const StringView& url);
|
||||
static Float2 GetDesktopSize();
|
||||
static String GetMainDirectory();
|
||||
static String GetExecutableFilePath();
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "Engine/Platform/MemoryStats.h"
|
||||
#include "Engine/Platform/MessageBox.h"
|
||||
#include "Engine/Platform/FileSystem.h"
|
||||
#include "Engine/Platform/Window.h"
|
||||
#include "Engine/Platform/User.h"
|
||||
#include "Engine/Core/Log.h"
|
||||
#include "Engine/Core/Types/DateTime.h"
|
||||
@@ -157,7 +158,7 @@ void PlatformBase::LogInfo()
|
||||
LOG(Info, "CPU package count: {0}, Core count: {1}, Logical processors: {2}", cpuInfo.ProcessorPackageCount, cpuInfo.ProcessorCoreCount, cpuInfo.LogicalProcessorCount);
|
||||
LOG(Info, "CPU Page size: {0}, cache line size: {1} bytes", Utilities::BytesToText(cpuInfo.PageSize), cpuInfo.CacheLineSize);
|
||||
LOG(Info, "L1 cache: {0}, L2 cache: {1}, L3 cache: {2}", Utilities::BytesToText(cpuInfo.L1CacheSize), Utilities::BytesToText(cpuInfo.L2CacheSize), Utilities::BytesToText(cpuInfo.L3CacheSize));
|
||||
LOG(Info, "Clock speed: {0} GHz", Utilities::RoundTo2DecimalPlaces(cpuInfo.ClockSpeed * 1e-9f));
|
||||
LOG(Info, "Clock speed: {0}", Utilities::HertzToText(cpuInfo.ClockSpeed));
|
||||
|
||||
const MemoryStats memStats = Platform::GetMemoryStats();
|
||||
LOG(Info, "Physical Memory: {0} total, {1} used ({2}%)", Utilities::BytesToText(memStats.TotalPhysicalMemory), Utilities::BytesToText(memStats.UsedPhysicalMemory), Utilities::RoundTo2DecimalPlaces((float)memStats.UsedPhysicalMemory * 100.0f / (float)memStats.TotalPhysicalMemory));
|
||||
@@ -520,6 +521,30 @@ void PlatformBase::CreateGuid(Guid& result)
|
||||
result = Guid(dateThingHigh, randomThing | (sequentialThing << 16), cyclesThing, dateThingLow);
|
||||
}
|
||||
|
||||
bool PlatformBase::CanOpenUrl(const StringView& url)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void PlatformBase::OpenUrl(const StringView& url)
|
||||
{
|
||||
}
|
||||
|
||||
Float2 PlatformBase::GetMousePosition()
|
||||
{
|
||||
const Window* win = Engine::MainWindow;
|
||||
if (win)
|
||||
return win->ClientToScreen(win->GetMousePosition());
|
||||
return Float2::Minimum;
|
||||
}
|
||||
|
||||
void PlatformBase::SetMousePosition(const Float2& position)
|
||||
{
|
||||
const Window* win = Engine::MainWindow;
|
||||
if (win)
|
||||
win->SetMousePosition(win->ScreenToClient(position));
|
||||
}
|
||||
|
||||
Rectangle PlatformBase::GetMonitorBounds(const Float2& screenPos)
|
||||
{
|
||||
return Rectangle(Float2::Zero, Platform::GetDesktopSize());
|
||||
|
||||
@@ -167,7 +167,6 @@ DECLARE_SCRIPTING_TYPE_MINIMAL(PlatformBase);
|
||||
static void Exit();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Copy memory region
|
||||
/// </summary>
|
||||
@@ -334,7 +333,6 @@ public:
|
||||
static void FreePages(void* ptr);
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Returns the current runtime platform type. It's compile-time constant.
|
||||
/// </summary>
|
||||
@@ -409,7 +407,6 @@ public:
|
||||
static void Sleep(int32 milliseconds) = delete;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current time in seconds.
|
||||
/// </summary>
|
||||
@@ -455,7 +452,6 @@ public:
|
||||
static void GetUTCTime(int32& year, int32& month, int32& dayOfWeek, int32& day, int32& hour, int32& minute, int32& second, int32& millisecond) = delete;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Shows the fatal error message to the user.
|
||||
/// </summary>
|
||||
@@ -482,7 +478,6 @@ public:
|
||||
static void Info(const Char* msg);
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Shows the fatal error message to the user.
|
||||
/// </summary>
|
||||
@@ -520,7 +515,6 @@ public:
|
||||
static bool IsDebuggerPresent();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Performs a fatal crash.
|
||||
/// </summary>
|
||||
@@ -560,7 +554,6 @@ public:
|
||||
static void CheckFailed(const char* message, const char* file, int line);
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Sets the High DPI awareness.
|
||||
/// </summary>
|
||||
@@ -628,7 +621,6 @@ public:
|
||||
static void CreateGuid(Guid& result);
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The list of users.
|
||||
/// </summary>
|
||||
@@ -645,21 +637,31 @@ public:
|
||||
API_EVENT() static Delegate<User*> UserRemoved;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Returns a value indicating whether can open a given URL in a web browser.
|
||||
/// </summary>
|
||||
/// <param name="url">The URI to assign to web browser.</param>
|
||||
/// <returns>True if can open URL, otherwise false.</returns>
|
||||
API_FUNCTION() static bool CanOpenUrl(const StringView& url) = delete;
|
||||
API_FUNCTION() static bool CanOpenUrl(const StringView& url);
|
||||
|
||||
/// <summary>
|
||||
/// Launches a web browser and opens a given URL.
|
||||
/// </summary>
|
||||
/// <param name="url">The URI to assign to web browser.</param>
|
||||
API_FUNCTION() static void OpenUrl(const StringView& url) = delete;
|
||||
API_FUNCTION() static void OpenUrl(const StringView& url);
|
||||
|
||||
public:
|
||||
/// <summary>
|
||||
/// Gets the mouse cursor position in screen-space coordinates.
|
||||
/// </summary>
|
||||
/// <returns>Mouse cursor coordinates.</returns>
|
||||
API_PROPERTY() static Float2 GetMousePosition();
|
||||
|
||||
/// <summary>
|
||||
/// Sets the mouse cursor position in screen-space coordinates.
|
||||
/// </summary>
|
||||
/// <param name="position">Cursor position to set.</param>
|
||||
API_PROPERTY() static void SetMousePosition(const Float2& position);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the origin position and size of the monitor at the given screen-space location.
|
||||
@@ -686,7 +688,6 @@ public:
|
||||
API_PROPERTY() static Float2 GetVirtualDesktopSize();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets full path of the main engine directory.
|
||||
/// </summary>
|
||||
@@ -719,7 +720,6 @@ public:
|
||||
static bool SetWorkingDirectory(const String& path);
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the process environment variables (pairs of key and value).
|
||||
/// </summary>
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
#include <string>
|
||||
#endif
|
||||
|
||||
const char DirectorySeparatorChar = '\\';
|
||||
const char AltDirectorySeparatorChar = '/';
|
||||
const char VolumeSeparatorChar = ':';
|
||||
constexpr char DirectorySeparatorChar = '\\';
|
||||
constexpr char AltDirectorySeparatorChar = '/';
|
||||
constexpr char VolumeSeparatorChar = ':';
|
||||
|
||||
const Char* StringUtils::FindIgnoreCase(const Char* str, const Char* toFind)
|
||||
{
|
||||
@@ -378,20 +378,17 @@ void StringUtils::PathRemoveRelativeParts(String& path)
|
||||
path.Insert(0, TEXT("/"));
|
||||
}
|
||||
|
||||
const char DigitPairs[201] = {
|
||||
"00010203040506070809"
|
||||
"10111213141516171819"
|
||||
"20212223242526272829"
|
||||
"30313233343536373839"
|
||||
"40414243444546474849"
|
||||
"50515253545556575859"
|
||||
"60616263646566676869"
|
||||
"70717273747576777879"
|
||||
"80818283848586878889"
|
||||
"90919293949596979899"
|
||||
};
|
||||
|
||||
#define STRING_UTILS_ITOSTR_BUFFER_SIZE 15
|
||||
int32 StringUtils::HexDigit(Char c)
|
||||
{
|
||||
int32 result = 0;
|
||||
if (c >= '0' && c <= '9')
|
||||
result = c - '0';
|
||||
else if (c >= 'a' && c <= 'f')
|
||||
result = c + 10 - 'a';
|
||||
else if (c >= 'A' && c <= 'F')
|
||||
result = c + 10 - 'A';
|
||||
return result;
|
||||
}
|
||||
|
||||
bool StringUtils::Parse(const Char* str, float* result)
|
||||
{
|
||||
@@ -419,108 +416,22 @@ bool StringUtils::Parse(const char* str, float* result)
|
||||
|
||||
String StringUtils::ToString(int32 value)
|
||||
{
|
||||
char buf[STRING_UTILS_ITOSTR_BUFFER_SIZE];
|
||||
char* it = &buf[STRING_UTILS_ITOSTR_BUFFER_SIZE - 2];
|
||||
int32 div = value / 100;
|
||||
if (value >= 0)
|
||||
{
|
||||
while (div)
|
||||
{
|
||||
Platform::MemoryCopy(it, &DigitPairs[2 * (value - div * 100)], 2);
|
||||
value = div;
|
||||
it -= 2;
|
||||
div = value / 100;
|
||||
}
|
||||
Platform::MemoryCopy(it, &DigitPairs[2 * value], 2);
|
||||
if (value < 10)
|
||||
it++;
|
||||
}
|
||||
else
|
||||
{
|
||||
while (div)
|
||||
{
|
||||
Platform::MemoryCopy(it, &DigitPairs[-2 * (value - div * 100)], 2);
|
||||
value = div;
|
||||
it -= 2;
|
||||
div = value / 100;
|
||||
}
|
||||
Platform::MemoryCopy(it, &DigitPairs[-2 * value], 2);
|
||||
if (value <= -10)
|
||||
it--;
|
||||
*it = '-';
|
||||
}
|
||||
return String(it, (int32)(&buf[STRING_UTILS_ITOSTR_BUFFER_SIZE] - it));
|
||||
return String::Format(TEXT("{}"), value);
|
||||
}
|
||||
|
||||
String StringUtils::ToString(int64 value)
|
||||
{
|
||||
char buf[STRING_UTILS_ITOSTR_BUFFER_SIZE];
|
||||
char* it = &buf[STRING_UTILS_ITOSTR_BUFFER_SIZE - 2];
|
||||
int64 div = value / 100;
|
||||
if (value >= 0)
|
||||
{
|
||||
while (div)
|
||||
{
|
||||
Platform::MemoryCopy(it, &DigitPairs[2 * (value - div * 100)], 2);
|
||||
value = div;
|
||||
it -= 2;
|
||||
div = value / 100;
|
||||
}
|
||||
Platform::MemoryCopy(it, &DigitPairs[2 * value], 2);
|
||||
if (value < 10)
|
||||
it++;
|
||||
}
|
||||
else
|
||||
{
|
||||
while (div)
|
||||
{
|
||||
Platform::MemoryCopy(it, &DigitPairs[-2 * (value - div * 100)], 2);
|
||||
value = div;
|
||||
it -= 2;
|
||||
div = value / 100;
|
||||
}
|
||||
Platform::MemoryCopy(it, &DigitPairs[-2 * value], 2);
|
||||
if (value <= -10)
|
||||
it--;
|
||||
*it = '-';
|
||||
}
|
||||
return String(it, (int32)(&buf[STRING_UTILS_ITOSTR_BUFFER_SIZE] - it));
|
||||
return String::Format(TEXT("{}"), value);
|
||||
}
|
||||
|
||||
String StringUtils::ToString(uint32 value)
|
||||
{
|
||||
char buf[STRING_UTILS_ITOSTR_BUFFER_SIZE];
|
||||
char* it = &buf[STRING_UTILS_ITOSTR_BUFFER_SIZE - 2];
|
||||
int32 div = value / 100;
|
||||
while (div)
|
||||
{
|
||||
Platform::MemoryCopy(it, &DigitPairs[2 * (value - div * 100)], 2);
|
||||
value = div;
|
||||
it -= 2;
|
||||
div = value / 100;
|
||||
}
|
||||
Platform::MemoryCopy(it, &DigitPairs[2 * value], 2);
|
||||
if (value < 10)
|
||||
it++;
|
||||
return String((char*)it, (int32)((char*)&buf[STRING_UTILS_ITOSTR_BUFFER_SIZE] - (char*)it));
|
||||
return String::Format(TEXT("{}"), value);
|
||||
}
|
||||
|
||||
String StringUtils::ToString(uint64 value)
|
||||
{
|
||||
char buf[STRING_UTILS_ITOSTR_BUFFER_SIZE];
|
||||
char* it = &buf[STRING_UTILS_ITOSTR_BUFFER_SIZE - 2];
|
||||
int64 div = value / 100;
|
||||
while (div)
|
||||
{
|
||||
Platform::MemoryCopy(it, &DigitPairs[2 * (value - div * 100)], 2);
|
||||
value = div;
|
||||
it -= 2;
|
||||
div = value / 100;
|
||||
}
|
||||
Platform::MemoryCopy(it, &DigitPairs[2 * value], 2);
|
||||
if (value < 10)
|
||||
it++;
|
||||
return String((char*)it, (int32)((char*)&buf[STRING_UTILS_ITOSTR_BUFFER_SIZE] - (char*)it));
|
||||
return String::Format(TEXT("{}"), value);
|
||||
}
|
||||
|
||||
String StringUtils::ToString(float value)
|
||||
@@ -544,5 +455,3 @@ String StringUtils::GetZZString(const Char* str)
|
||||
}
|
||||
return String(str, (int32)(end - str));
|
||||
}
|
||||
|
||||
#undef STRING_UTILS_ITOSTR_BUFFER_SIZE
|
||||
|
||||
@@ -89,6 +89,7 @@ X11::Cursor Cursors[(int32)CursorType::MAX];
|
||||
X11::XcursorImage* CursorsImg[(int32)CursorType::MAX];
|
||||
Dictionary<StringAnsi, X11::KeyCode> KeyNameMap;
|
||||
Array<KeyboardKeys> KeyCodeMap;
|
||||
Delegate<void*> LinuxPlatform::xEventRecieved;
|
||||
|
||||
// Message boxes configuration
|
||||
#define LINUX_DIALOG_MIN_BUTTON_WIDTH 64
|
||||
@@ -2232,10 +2233,12 @@ void LinuxPlatform::Tick()
|
||||
{
|
||||
X11::XEvent event;
|
||||
X11::XNextEvent(xDisplay, &event);
|
||||
|
||||
if (X11::XFilterEvent(&event, 0))
|
||||
continue;
|
||||
|
||||
// External event handling
|
||||
xEventRecieved(&event);
|
||||
|
||||
LinuxWindow* window;
|
||||
switch (event.type)
|
||||
{
|
||||
@@ -2640,10 +2643,8 @@ Float2 LinuxPlatform::GetMousePosition()
|
||||
{
|
||||
if (!xDisplay)
|
||||
return Float2::Zero;
|
||||
|
||||
int32 x, y;
|
||||
int32 x = 0, y = 0;
|
||||
uint32 screenCount = (uint32)X11::XScreenCount(xDisplay);
|
||||
|
||||
for (uint32 i = 0; i < screenCount; i++)
|
||||
{
|
||||
X11::Window outRoot, outChild;
|
||||
@@ -2652,7 +2653,6 @@ Float2 LinuxPlatform::GetMousePosition()
|
||||
if (X11::XQueryPointer(xDisplay, X11::XRootWindow(xDisplay, i), &outRoot, &outChild, &x, &y, &childX, &childY, &mask))
|
||||
break;
|
||||
}
|
||||
|
||||
return Float2((float)x, (float)y);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,11 @@ public:
|
||||
/// <returns>The user home directory.</returns>
|
||||
static const String& GetHomeDirectory();
|
||||
|
||||
/// <summary>
|
||||
/// An event that is fired when an XEvent is received during platform tick.
|
||||
/// </summary>
|
||||
static Delegate<void*> xEventRecieved;
|
||||
|
||||
public:
|
||||
|
||||
// [UnixPlatform]
|
||||
|
||||
@@ -21,12 +21,11 @@ enum class StringSearchCase
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// The string operations utilities collection.
|
||||
/// The string operations utilities.
|
||||
/// </summary>
|
||||
class FLAXENGINE_API StringUtils
|
||||
{
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Calculates the hash code for input string.
|
||||
/// </summary>
|
||||
@@ -65,7 +64,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// Returns true if character is uppercase
|
||||
static bool IsUpper(char c);
|
||||
|
||||
@@ -92,7 +90,6 @@ public:
|
||||
static char ToLower(char c);
|
||||
|
||||
public:
|
||||
|
||||
// Returns true if character is uppercase
|
||||
static bool IsUpper(Char c);
|
||||
|
||||
@@ -119,7 +116,6 @@ public:
|
||||
static Char ToLower(Char c);
|
||||
|
||||
public:
|
||||
|
||||
// Compare two strings with case sensitive. Strings must not be null.
|
||||
static int32 Compare(const Char* str1, const Char* str2);
|
||||
|
||||
@@ -145,7 +141,6 @@ public:
|
||||
static int32 CompareIgnoreCase(const char* str1, const char* str2, int32 maxCount);
|
||||
|
||||
public:
|
||||
|
||||
// Get string length. Returns 0 if str is null.
|
||||
static int32 Length(const Char* str);
|
||||
|
||||
@@ -183,7 +178,6 @@ public:
|
||||
static const char* FindIgnoreCase(const char* str, const char* toFind);
|
||||
|
||||
public:
|
||||
|
||||
// Converts characters from ANSI to UTF-16
|
||||
static void ConvertANSI2UTF16(const char* from, Char* to, int32 len);
|
||||
|
||||
@@ -203,7 +197,6 @@ public:
|
||||
static char* ConvertUTF162UTF8(const Char* from, int32 fromLength, int32& toLength);
|
||||
|
||||
public:
|
||||
|
||||
// Returns the directory name of the specified path string
|
||||
// @param path The path string from which to obtain the directory name
|
||||
// @returns Directory name
|
||||
@@ -224,95 +217,8 @@ public:
|
||||
static void PathRemoveRelativeParts(String& path);
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Convert integer value to string
|
||||
/// </summary>
|
||||
/// <param name="value">Value to convert</param>
|
||||
/// <param name="base">Base (8,10,16)</param>
|
||||
/// <param name="buffer">Input buffer</param>
|
||||
/// <param name="length">Result string length</param>
|
||||
template<typename CharType>
|
||||
static void itoa(int32 value, int32 base, CharType* buffer, int32& length)
|
||||
{
|
||||
// Allocate buffer
|
||||
bool isNegative = false;
|
||||
CharType* pos = buffer;
|
||||
CharType* pos1 = buffer;
|
||||
length = 0;
|
||||
|
||||
// Validate input base
|
||||
if (base < 8 || base > 16)
|
||||
{
|
||||
*pos = '\0';
|
||||
return;
|
||||
}
|
||||
|
||||
// Special case for zero
|
||||
if (value == 0)
|
||||
{
|
||||
length++;
|
||||
*pos++ = '0';
|
||||
*pos = '\0';
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if value is negative
|
||||
if (value < 0)
|
||||
{
|
||||
isNegative = true;
|
||||
value = -value;
|
||||
}
|
||||
|
||||
// Convert. If base is power of two (2,4,8,16..)
|
||||
// we could use binary and operation and shift offset instead of division
|
||||
while (value)
|
||||
{
|
||||
length++;
|
||||
int32 reminder = value % base;
|
||||
*pos++ = reminder + (reminder > 9 ? 'a' - 10 : '0');
|
||||
value /= base;
|
||||
}
|
||||
|
||||
// Apply negative sign
|
||||
if (isNegative)
|
||||
*pos++ = '-';
|
||||
|
||||
// Add null terminator char
|
||||
*pos-- = 0;
|
||||
|
||||
// Reverse the buffer
|
||||
while (pos1 < pos)
|
||||
{
|
||||
CharType c = *pos;
|
||||
*pos-- = *pos1;
|
||||
*pos1++ = c;
|
||||
}
|
||||
}
|
||||
|
||||
static int32 HexDigit(Char c)
|
||||
{
|
||||
int32 result = 0;
|
||||
|
||||
if (c >= '0' && c <= '9')
|
||||
{
|
||||
result = c - '0';
|
||||
}
|
||||
else if (c >= 'a' && c <= 'f')
|
||||
{
|
||||
result = c + 10 - 'a';
|
||||
}
|
||||
else if (c >= 'A' && c <= 'F')
|
||||
{
|
||||
result = c + 10 - 'A';
|
||||
}
|
||||
else
|
||||
{
|
||||
result = 0;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
// Converts hexadecimal character into the value.
|
||||
static int32 HexDigit(Char c);
|
||||
|
||||
// Parse text to unsigned integer value
|
||||
// @param str String to parse
|
||||
@@ -431,7 +337,6 @@ public:
|
||||
static bool Parse(const char* str, float* result);
|
||||
|
||||
public:
|
||||
|
||||
static String ToString(int32 value);
|
||||
static String ToString(int64 value);
|
||||
static String ToString(uint32 value);
|
||||
@@ -440,7 +345,6 @@ public:
|
||||
static String ToString(double value);
|
||||
|
||||
public:
|
||||
|
||||
// Returns the String to double null-terminated string
|
||||
// @param str Double null-terminated string
|
||||
// @return Double null-terminated String
|
||||
|
||||
@@ -148,37 +148,6 @@ bool UWPPlatform::GetHasFocus()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool UWPPlatform::CanOpenUrl(const StringView& url)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void UWPPlatform::OpenUrl(const StringView& url)
|
||||
{
|
||||
// TODO: add support for OpenUrl on UWP
|
||||
}
|
||||
|
||||
Float2 UWPPlatform::GetMousePosition()
|
||||
{
|
||||
// Use the main window
|
||||
auto win = Engine::MainWindow;
|
||||
if (win)
|
||||
{
|
||||
return win->ClientToScreen(win->GetMousePosition());
|
||||
}
|
||||
return Float2::Minimum;
|
||||
}
|
||||
|
||||
void UWPPlatform::SetMousePosition(const Float2& pos)
|
||||
{
|
||||
// Use the main window
|
||||
auto win = Engine::MainWindow;
|
||||
if (win)
|
||||
{
|
||||
win->SetMousePosition(win->ScreenToClient(pos));
|
||||
}
|
||||
}
|
||||
|
||||
Float2 UWPPlatform::GetDesktopSize()
|
||||
{
|
||||
Float2 result;
|
||||
|
||||
@@ -35,10 +35,6 @@ public:
|
||||
static String GetUserLocaleName();
|
||||
static String GetComputerName();
|
||||
static bool GetHasFocus();
|
||||
static bool CanOpenUrl(const StringView& url);
|
||||
static void OpenUrl(const StringView& url);
|
||||
static Float2 GetMousePosition();
|
||||
static void SetMousePosition(const Float2& pos);
|
||||
static Float2 GetDesktopSize();
|
||||
static Window* CreateWindow(const CreateWindowSettings& settings);
|
||||
static void* LoadLibrary(const Char* filename);
|
||||
|
||||
@@ -109,7 +109,7 @@ public:
|
||||
static void CreateGuid(Guid& result);
|
||||
static String GetMainDirectory();
|
||||
static String GetExecutableFilePath();
|
||||
static struct Guid GetUniqueDeviceId();
|
||||
static Guid GetUniqueDeviceId();
|
||||
static String GetWorkingDirectory();
|
||||
static bool SetWorkingDirectory(const String& path);
|
||||
static void FreeLibrary(void* handle);
|
||||
|
||||
@@ -830,6 +830,18 @@ void WindowsPlatform::OpenUrl(const StringView& url)
|
||||
::ShellExecuteW(nullptr, TEXT("open"), *url, nullptr, nullptr, SW_SHOWNORMAL);
|
||||
}
|
||||
|
||||
Float2 WindowsPlatform::GetMousePosition()
|
||||
{
|
||||
POINT cursorPos;
|
||||
GetCursorPos(&cursorPos);
|
||||
return Float2((float)cursorPos.x, (float)cursorPos.y);
|
||||
}
|
||||
|
||||
void WindowsPlatform::SetMousePosition(const Float2& pos)
|
||||
{
|
||||
::SetCursorPos((int)pos.X, (int)pos.Y);
|
||||
}
|
||||
|
||||
struct GetMonitorBoundsData
|
||||
{
|
||||
Float2 Pos;
|
||||
@@ -1221,10 +1233,11 @@ void* WindowsPlatform::LoadLibrary(const Char* filename)
|
||||
return handle;
|
||||
}
|
||||
|
||||
#if CRASH_LOG_ENABLE
|
||||
|
||||
Array<PlatformBase::StackFrame> WindowsPlatform::GetStackFrames(int32 skipCount, int32 maxDepth, void* context)
|
||||
{
|
||||
Array<StackFrame> result;
|
||||
#if CRASH_LOG_ENABLE
|
||||
DbgHelpLock();
|
||||
|
||||
// Initialize
|
||||
@@ -1350,12 +1363,9 @@ Array<PlatformBase::StackFrame> WindowsPlatform::GetStackFrames(int32 skipCount,
|
||||
}
|
||||
|
||||
DbgHelpUnlock();
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
#if CRASH_LOG_ENABLE
|
||||
|
||||
void WindowsPlatform::CollectCrashData(const String& crashDataFolder, void* context)
|
||||
{
|
||||
// Create mini dump file for crash debugging
|
||||
|
||||
@@ -71,6 +71,8 @@ public:
|
||||
static bool GetHasFocus();
|
||||
static bool CanOpenUrl(const StringView& url);
|
||||
static void OpenUrl(const StringView& url);
|
||||
static Float2 GetMousePosition();
|
||||
static void SetMousePosition(const Float2& pos);
|
||||
static Rectangle GetMonitorBounds(const Float2& screenPos);
|
||||
static Float2 GetDesktopSize();
|
||||
static Rectangle GetVirtualDesktopBounds();
|
||||
@@ -80,8 +82,8 @@ public:
|
||||
static int32 CreateProcess(CreateProcessSettings& settings);
|
||||
static Window* CreateWindow(const CreateWindowSettings& settings);
|
||||
static void* LoadLibrary(const Char* filename);
|
||||
static Array<StackFrame, HeapAllocation> GetStackFrames(int32 skipCount = 0, int32 maxDepth = 60, void* context = nullptr);
|
||||
#if CRASH_LOG_ENABLE
|
||||
static Array<StackFrame, HeapAllocation> GetStackFrames(int32 skipCount = 0, int32 maxDepth = 60, void* context = nullptr);
|
||||
static void CollectCrashData(const String& crashDataFolder, void* context = nullptr);
|
||||
#endif
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user