Add MacWindow logo loading and use correct one for Editor
This commit is contained in:
@@ -239,7 +239,7 @@ String CookingData::GetGameBinariesPath() const
|
||||
archDir = TEXT("ARM64");
|
||||
break;
|
||||
default:
|
||||
CRASH;
|
||||
CRASH;
|
||||
return String::Empty;
|
||||
}
|
||||
|
||||
|
||||
@@ -69,8 +69,6 @@ bool ValidateStep::Perform(CookingData& data)
|
||||
return true;
|
||||
}
|
||||
|
||||
// TODO: validate version
|
||||
|
||||
AssetInfo info;
|
||||
if (!Content::GetAssetInfo(gameSettings->FirstScene, info))
|
||||
{
|
||||
@@ -79,9 +77,5 @@ bool ValidateStep::Perform(CookingData& data)
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: validate more game config
|
||||
|
||||
// TODO: validate all input scenes?
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -654,7 +654,7 @@ Window* Editor::CreateMainWindow()
|
||||
PROFILE_MEM(Editor);
|
||||
Window* window = Managed->GetMainWindow();
|
||||
|
||||
#if PLATFORM_LINUX || (PLATFORM_MAC && PLATFORM_SDL)
|
||||
#if PLATFORM_LINUX || PLATFORM_MAC
|
||||
// Set window icon
|
||||
const String iconPath = Globals::BinariesFolder / TEXT("Logo.png");
|
||||
if (FileSystem::FileExists(iconPath))
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "Engine/Input/Mouse.h"
|
||||
#include "Engine/Input/Keyboard.h"
|
||||
#include "Engine/Graphics/RenderTask.h"
|
||||
#include "Engine/Graphics/Textures/TextureData.h"
|
||||
#include <Cocoa/Cocoa.h>
|
||||
#include <AppKit/AppKit.h>
|
||||
#include <QuartzCore/CAMetalLayer.h>
|
||||
@@ -1302,4 +1303,37 @@ void MacWindow::SetCursor(CursorType type)
|
||||
}
|
||||
}
|
||||
|
||||
void MacWindow::SetIcon(TextureData& icon)
|
||||
{
|
||||
// Get pixels
|
||||
Array<Color32> colorData;
|
||||
icon.GetPixels(colorData);
|
||||
|
||||
// Convert to Cocoa image
|
||||
NSImage* image = [[NSImage alloc] initWithSize:NSMakeSize(icon.Width, icon.Height)];
|
||||
if (image == nil)
|
||||
return;
|
||||
NSBitmapImageRep* rep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
|
||||
pixelsWide:icon.Width
|
||||
pixelsHigh:icon.Height
|
||||
bitsPerSample:8
|
||||
samplesPerPixel:4
|
||||
hasAlpha:YES
|
||||
isPlanar:NO
|
||||
colorSpaceName:NSDeviceRGBColorSpace
|
||||
bytesPerRow:icon.Width * 4
|
||||
bitsPerPixel:32];
|
||||
if (rep == nil)
|
||||
return;
|
||||
|
||||
// Copy the pixels
|
||||
Platform::MemoryCopy([rep bitmapData], colorData.Get(), colorData.Count() * sizeof(Color32));
|
||||
|
||||
// Add the image representation
|
||||
[image addRepresentation:rep];
|
||||
|
||||
// Set app icon
|
||||
[NSApp setApplicationIconImage:image];
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -63,6 +63,7 @@ public:
|
||||
void StartTrackingMouse(bool useMouseScreenOffset) override;
|
||||
void EndTrackingMouse() override;
|
||||
void SetCursor(CursorType type) override;
|
||||
void SetIcon(TextureData& icon) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -71,8 +71,7 @@ public class FlaxEditor : EngineTarget
|
||||
break;
|
||||
case TargetPlatform.Mac:
|
||||
options.OutputFolder = Path.Combine(options.WorkingDirectory, "Binaries", "Editor", "Mac", options.Configuration.ToString());
|
||||
if (EngineConfiguration.WithSDL(options))
|
||||
options.DependencyFiles.Add(Path.Combine(Globals.EngineRoot, "Source", "Logo.png"));
|
||||
options.DependencyFiles.Add(Path.Combine(Globals.EngineRoot, "Source", "Platforms", "Mac", "Logo.png"));
|
||||
break;
|
||||
default: throw new InvalidPlatformException(options.Platform.Target, "Not supported Editor platform.");
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -357,8 +357,7 @@ namespace Flax.Deploy
|
||||
DeployFile(src, dst, "MoltenVK_icd.json");
|
||||
DeployFiles(src, dst, "*.dll");
|
||||
DeployFiles(src, dst, "*.dylib");
|
||||
if (EngineConfiguration.UseSDL && MacConfiguration.UseSDL)
|
||||
DeployFile(src, dst, "Logo.png");
|
||||
DeployFile(src, dst, "Logo.png");
|
||||
|
||||
// Optimize package size
|
||||
Utilities.Run("strip", "FlaxEditor", null, dst, Utilities.RunOptions.None);
|
||||
|
||||
Reference in New Issue
Block a user