Merge remote-tracking branch 'origin/1.7' into 1.7
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include "SkinnedModelLOD.h"
|
||||
#include "MeshDeformation.h"
|
||||
#include "Engine/Core/Log.h"
|
||||
#include "Engine/Core/Math/Transform.h"
|
||||
#include "Engine/Graphics/GPUDevice.h"
|
||||
#include "Engine/Content/Assets/Model.h"
|
||||
#include "Engine/Serialization/MemoryReadStream.h"
|
||||
|
||||
@@ -56,36 +56,94 @@ DialogResult MessageBox::Show(Window* parent, const StringView& text, const Stri
|
||||
{
|
||||
if (CommandLine::Options.Headless)
|
||||
return DialogResult::None;
|
||||
CFStringRef textRef = AppleUtils::ToString(text);
|
||||
CFStringRef captionRef = AppleUtils::ToString(caption);
|
||||
CFOptionFlags flags = 0;
|
||||
NSAlert* alert = [[NSAlert alloc] init];
|
||||
ASSERT(alert);
|
||||
switch (buttons)
|
||||
{
|
||||
case MessageBoxButtons::AbortRetryIgnore:
|
||||
[alert addButtonWithTitle:@"Abort"];
|
||||
[alert addButtonWithTitle:@"Retry"];
|
||||
[alert addButtonWithTitle:@"Ignore"];
|
||||
break;
|
||||
case MessageBoxButtons::OK:
|
||||
[alert addButtonWithTitle:@"OK"];
|
||||
break;
|
||||
case MessageBoxButtons::OKCancel:
|
||||
[alert addButtonWithTitle:@"OK"];
|
||||
[alert addButtonWithTitle:@"Cancel"];
|
||||
break;
|
||||
case MessageBoxButtons::RetryCancel:
|
||||
[alert addButtonWithTitle:@"Retry"];
|
||||
[alert addButtonWithTitle:@"Cancel"];
|
||||
break;
|
||||
case MessageBoxButtons::YesNo:
|
||||
[alert addButtonWithTitle:@"Yes"];
|
||||
[alert addButtonWithTitle:@"No"];
|
||||
break;
|
||||
case MessageBoxButtons::YesNoCancel:
|
||||
flags |= kCFUserNotificationCancelResponse;
|
||||
[alert addButtonWithTitle:@"Yes"];
|
||||
[alert addButtonWithTitle:@"No"];
|
||||
[alert addButtonWithTitle:@"Cancel"];
|
||||
break;
|
||||
}
|
||||
switch (icon)
|
||||
{
|
||||
case MessageBoxIcon::Information:
|
||||
flags |= kCFUserNotificationNoteAlertLevel;
|
||||
[alert setAlertStyle:NSAlertStyleCritical];
|
||||
break;
|
||||
case MessageBoxIcon::Error:
|
||||
case MessageBoxIcon::Stop:
|
||||
flags |= kCFUserNotificationStopAlertLevel;
|
||||
[alert setAlertStyle:NSAlertStyleInformational];
|
||||
break;
|
||||
case MessageBoxIcon::Warning:
|
||||
flags |= kCFUserNotificationCautionAlertLevel;
|
||||
[alert setAlertStyle:NSAlertStyleWarning];
|
||||
break;
|
||||
}
|
||||
SInt32 result = CFUserNotificationDisplayNotice(0, flags, nullptr, nullptr, nullptr, captionRef, textRef, nullptr);
|
||||
CFRelease(captionRef);
|
||||
CFRelease(textRef);
|
||||
return DialogResult::OK;
|
||||
[alert setMessageText:(NSString*)AppleUtils::ToString(caption)];
|
||||
[alert setInformativeText:(NSString*)AppleUtils::ToString(text)];
|
||||
NSInteger button = [alert runModal];
|
||||
DialogResult result = DialogResult::OK;
|
||||
switch (buttons)
|
||||
{
|
||||
case MessageBoxButtons::AbortRetryIgnore:
|
||||
if (button == NSAlertFirstButtonReturn)
|
||||
result = DialogResult::Abort;
|
||||
else if (button == NSAlertSecondButtonReturn)
|
||||
result = DialogResult::Retry;
|
||||
else
|
||||
result = DialogResult::Ignore;
|
||||
break;
|
||||
case MessageBoxButtons::OK:
|
||||
result = DialogResult::OK;
|
||||
break;
|
||||
case MessageBoxButtons::OKCancel:
|
||||
if (button == NSAlertFirstButtonReturn)
|
||||
result = DialogResult::OK;
|
||||
else
|
||||
result = DialogResult::Cancel;
|
||||
break;
|
||||
case MessageBoxButtons::RetryCancel:
|
||||
if (button == NSAlertFirstButtonReturn)
|
||||
result = DialogResult::Retry;
|
||||
else
|
||||
result = DialogResult::Cancel;
|
||||
break;
|
||||
case MessageBoxButtons::YesNo:
|
||||
if (button == NSAlertFirstButtonReturn)
|
||||
result = DialogResult::Yes;
|
||||
else
|
||||
result = DialogResult::No;
|
||||
break;
|
||||
case MessageBoxButtons::YesNoCancel:
|
||||
if (button == NSAlertFirstButtonReturn)
|
||||
result = DialogResult::Yes;
|
||||
else if (button == NSAlertSecondButtonReturn)
|
||||
result = DialogResult::No;
|
||||
else
|
||||
result = DialogResult::Cancel;
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Float2 AppleUtils::PosToCoca(const Float2& pos)
|
||||
@@ -301,15 +359,16 @@ Float2 MacPlatform::GetMousePosition()
|
||||
CGEventRef event = CGEventCreate(nullptr);
|
||||
CGPoint cursor = CGEventGetLocation(event);
|
||||
CFRelease(event);
|
||||
return Float2((float)cursor.x, (float)cursor.y);
|
||||
return Float2((float)cursor.x, (float)cursor.y) * MacPlatform::ScreenScale;
|
||||
}
|
||||
|
||||
void MacPlatform::SetMousePosition(const Float2& pos)
|
||||
{
|
||||
CGPoint cursor;
|
||||
cursor.x = (CGFloat)pos.X;
|
||||
cursor.y = (CGFloat)pos.Y;
|
||||
cursor.x = (CGFloat)(pos.X / MacPlatform::ScreenScale);
|
||||
cursor.y = (CGFloat)(pos.Y / MacPlatform::ScreenScale);
|
||||
CGWarpMouseCursorPosition(cursor);
|
||||
CGAssociateMouseAndMouseCursorPosition(true);
|
||||
}
|
||||
|
||||
Float2 MacPlatform::GetDesktopSize()
|
||||
|
||||
@@ -72,11 +72,11 @@ KeyboardKeys GetKey(NSEvent* event)
|
||||
case 0x30: return KeyboardKeys::Tab;
|
||||
case 0x31: return KeyboardKeys::Spacebar;
|
||||
case 0x32: return KeyboardKeys::BackQuote;
|
||||
case 0x33: return KeyboardKeys::Delete;
|
||||
case 0x33: return KeyboardKeys::Backspace;
|
||||
//case 0x34:
|
||||
case 0x35: return KeyboardKeys::Escape;
|
||||
//case 0x36:
|
||||
//case 0x37: Command
|
||||
case 0x36: return KeyboardKeys::Control; // Command (right)
|
||||
case 0x37: return KeyboardKeys::Control; // Command (left)
|
||||
case 0x38: return KeyboardKeys::Shift;
|
||||
case 0x39: return KeyboardKeys::Capital;
|
||||
case 0x3A: return KeyboardKeys::Alt;
|
||||
@@ -378,7 +378,7 @@ static void ConvertNSRect(NSScreen *screen, NSRect *r)
|
||||
{
|
||||
KeyboardKeys key = GetKey(event);
|
||||
if (key != KeyboardKeys::None)
|
||||
Input::Keyboard->OnKeyDown(key);
|
||||
Input::Keyboard->OnKeyDown(key, Window);
|
||||
|
||||
// Send a text input event
|
||||
switch (key)
|
||||
@@ -400,7 +400,7 @@ static void ConvertNSRect(NSScreen *screen, NSRect *r)
|
||||
if (length >= 16)
|
||||
length = 15;
|
||||
[text getCharacters:buffer range:NSMakeRange(0, length)];
|
||||
Input::Keyboard->OnCharInput((Char)buffer[0]);
|
||||
Input::Keyboard->OnCharInput((Char)buffer[0], Window);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -408,7 +408,32 @@ static void ConvertNSRect(NSScreen *screen, NSRect *r)
|
||||
{
|
||||
KeyboardKeys key = GetKey(event);
|
||||
if (key != KeyboardKeys::None)
|
||||
Input::Keyboard->OnKeyUp(key);
|
||||
Input::Keyboard->OnKeyUp(key, Window);
|
||||
}
|
||||
|
||||
- (void)flagsChanged:(NSEvent*)event
|
||||
{
|
||||
int32 modMask;
|
||||
int32 keyCode = [event keyCode];
|
||||
if (keyCode == 0x36 || keyCode == 0x37)
|
||||
modMask = NSEventModifierFlagCommand;
|
||||
else if (keyCode == 0x38 || keyCode == 0x3c)
|
||||
modMask = NSEventModifierFlagShift;
|
||||
else if (keyCode == 0x3a || keyCode == 0x3d)
|
||||
modMask = NSEventModifierFlagOption;
|
||||
else if (keyCode == 0x3b || keyCode == 0x3e)
|
||||
modMask = NSEventModifierFlagControl;
|
||||
else
|
||||
return;
|
||||
KeyboardKeys key = GetKey(event);
|
||||
if (key != KeyboardKeys::None)
|
||||
{
|
||||
int32 modifierFlags = [event modifierFlags];
|
||||
if ((modifierFlags & modMask) == modMask)
|
||||
Input::Keyboard->OnKeyDown(key, Window);
|
||||
else
|
||||
Input::Keyboard->OnKeyUp(key, Window);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)scrollWheel:(NSEvent*)event
|
||||
@@ -643,7 +668,6 @@ MacWindow::MacWindow(const CreateWindowSettings& settings)
|
||||
// TODO: impl StartPosition for MacWindow
|
||||
// TODO: impl Fullscreen for MacWindow
|
||||
// TODO: impl ShowInTaskbar for MacWindow
|
||||
// TODO: impl AllowInput for MacWindow
|
||||
// TODO: impl IsTopmost for MacWindow
|
||||
}
|
||||
|
||||
|
||||
BIN
Source/Platforms/Mac/Binaries/ThirdParty/ARM64/libNvCloth.a
(Stored with Git LFS)
vendored
Normal file
BIN
Source/Platforms/Mac/Binaries/ThirdParty/ARM64/libNvCloth.a
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
BIN
Source/Platforms/Mac/Binaries/ThirdParty/x64/libNvCloth.a
(Stored with Git LFS)
vendored
Normal file
BIN
Source/Platforms/Mac/Binaries/ThirdParty/x64/libNvCloth.a
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
BIN
Source/Platforms/iOS/Binaries/ThirdParty/ARM64/libNvCloth.a
(Stored with Git LFS)
vendored
Normal file
BIN
Source/Platforms/iOS/Binaries/ThirdParty/ARM64/libNvCloth.a
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
2
Source/ThirdParty/NvCloth/NvCloth.Build.cs
vendored
2
Source/ThirdParty/NvCloth/NvCloth.Build.cs
vendored
@@ -35,6 +35,8 @@ public class NvCloth : DepsModule
|
||||
case TargetPlatform.PS4:
|
||||
case TargetPlatform.PS5:
|
||||
case TargetPlatform.Android:
|
||||
case TargetPlatform.Mac:
|
||||
case TargetPlatform.iOS:
|
||||
libName = "NvCloth";
|
||||
break;
|
||||
case TargetPlatform.Switch:
|
||||
|
||||
@@ -82,6 +82,13 @@ namespace Flax.Deps.Dependencies
|
||||
case TargetPlatform.Android:
|
||||
Build(options, platform, TargetArchitecture.ARM64);
|
||||
break;
|
||||
case TargetPlatform.Mac:
|
||||
Build(options, platform, TargetArchitecture.x64);
|
||||
Build(options, platform, TargetArchitecture.ARM64);
|
||||
break;
|
||||
case TargetPlatform.iOS:
|
||||
Build(options, platform, TargetArchitecture.ARM64);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,6 +147,16 @@ namespace Flax.Deps.Dependencies
|
||||
envVars.Add("PM_ANDROIDNDK_PATH", AndroidNdk.Instance.RootPath);
|
||||
}
|
||||
break;
|
||||
case TargetPlatform.Mac:
|
||||
cmakeArgs += " -DTARGET_BUILD_PLATFORM=mac";
|
||||
cmakeName = "mac";
|
||||
binariesPrefix = "lib";
|
||||
break;
|
||||
case TargetPlatform.iOS:
|
||||
cmakeArgs += " -DTARGET_BUILD_PLATFORM=ios";
|
||||
cmakeName = "ios";
|
||||
binariesPrefix = "lib";
|
||||
break;
|
||||
default: throw new InvalidPlatformException(platform);
|
||||
}
|
||||
var cmakeFolder = Path.Combine(nvCloth, "compiler", "cmake", cmakeName);
|
||||
|
||||
Reference in New Issue
Block a user