i think this works on mac now
This commit is contained in:
parent
e7a5017dc5
commit
992fd043fd
|
|
@ -1,8 +1,8 @@
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
public static class AppInfo {
|
public static class AppInfo {
|
||||||
public const string Version = "0.0.1039";
|
public const string Version = "0.0.1040";
|
||||||
public static readonly DateTime Date = new DateTime(2023, 08, 11, 16, 44, 42, 336, DateTimeKind.Utc);
|
public static readonly DateTime Date = new DateTime(2023, 08, 14, 16, 49, 15, 063, DateTimeKind.Utc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,14 @@ using Jukebox;
|
||||||
using Jukebox.Legacy;
|
using Jukebox.Legacy;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
|
#if UNITY_STANDALONE_WIN
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
#elif UNITY_STANDALONE_OSX
|
||||||
|
using Foundation;
|
||||||
|
using Appkit;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace HeavenStudio
|
namespace HeavenStudio
|
||||||
{
|
{
|
||||||
|
|
@ -47,11 +54,17 @@ namespace HeavenStudio
|
||||||
here's a google doc with helpful sites(i think) for getting this working on mac
|
here's a google doc with helpful sites(i think) for getting this working on mac
|
||||||
https://docs.google.com/document/d/1mvHNNsXC6mo7PV6yZitpKam1fYnud7CXP73YLsebEo8/edit?usp=sharing
|
https://docs.google.com/document/d/1mvHNNsXC6mo7PV6yZitpKam1fYnud7CXP73YLsebEo8/edit?usp=sharing
|
||||||
good luck i cant figure this out
|
good luck i cant figure this out
|
||||||
|
|
||||||
|
update: just some default values for nscontroller or whatever it is:
|
||||||
|
|
||||||
|
windowstyle is closable; resizable; tilted
|
||||||
|
nsbackthingy's default is buffer
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//Credit to Grizmu on the unity forums for this
|
//Credit to Grizmu on the unity forums for this
|
||||||
//DLL Stuff for windows
|
//DLL Stuff for windows
|
||||||
#region WinDLLstuff
|
#region WinDLLstuff
|
||||||
|
#if UNITY_STANDALONE_WIN
|
||||||
const int SWP_HIDEWINDOW = 0x80; //idk why you would want this but here you go
|
const int SWP_HIDEWINDOW = 0x80; //idk why you would want this but here you go
|
||||||
const int SWP_SHOWWINDOW = 0x40; //show window flag.
|
const int SWP_SHOWWINDOW = 0x40; //show window flag.
|
||||||
const int SWP_NOMOVE = 0x0002; //don't move the window flag. idk why this either
|
const int SWP_NOMOVE = 0x0002; //don't move the window flag. idk why this either
|
||||||
|
|
@ -81,16 +94,50 @@ namespace HeavenStudio
|
||||||
uint uFlags
|
uint uFlags
|
||||||
);
|
);
|
||||||
|
|
||||||
|
System.IntPtr hWnd;
|
||||||
|
System.IntPtr HWND_TOP = new System.IntPtr(0);
|
||||||
|
System.IntPtr HWND_TOPMOST = new System.IntPtr(-1);
|
||||||
|
System.IntPtr HWND_NOTOPMOST = new System.IntPtr(-2);
|
||||||
|
#elif UNITY_STANDALONE_OSX
|
||||||
|
|
||||||
|
NSWindow _window;
|
||||||
|
var style = NSWindowStyle.Closable | NSWindowStyle.Resizable | NSWindowStyle.tilted;
|
||||||
|
|
||||||
|
|
||||||
|
public void SetWindowPos(double x, double y, double cX, double cY)
|
||||||
|
{
|
||||||
|
_window = new NSWindow(
|
||||||
|
new CoreGraphics.CGRect(x, Screen.mainWindowDisplayInfo.height - y, cx, cy),
|
||||||
|
style,
|
||||||
|
NSBackingStore.Buffered,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override NSWindow mainWindowDisplayInfo
|
||||||
|
{
|
||||||
|
get { return _window; }
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
public void SetPosition(System.IntPtr ptr, short x, short y, short resX, short resY)
|
public void SetPosition(System.IntPtr ptr, short x, short y, short resX, short resY)
|
||||||
{
|
{
|
||||||
if(!Application.isEditor && !Editor.Editor.instance.fullscreen && (pan != defaultPan | scale != defaultScale)) Reset();
|
if(!Application.isEditor && !Editor.Editor.instance.fullscreen && (pan != defaultPan | scale != defaultScale)) Reset();
|
||||||
if(Application.isEditor || !Editor.Editor.instance.fullscreen) return;
|
if(Application.isEditor || !Editor.Editor.instance.fullscreen) return;
|
||||||
|
#if UNITY_STANDALONE_WIN
|
||||||
SetWindowPos(ptr, HWND_NOTOPMOST, x, y, resX, resY, SWP_SHOWWINDOW);
|
SetWindowPos(ptr, HWND_NOTOPMOST, x, y, resX, resY, SWP_SHOWWINDOW);
|
||||||
|
#elif UNITY_STANDALONE_OSX
|
||||||
|
SetWindowPos(x, y, resX, resY);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
|
#if UNITY_STANDALONE_WIN
|
||||||
hWnd = GetActiveWindow();
|
hWnd = GetActiveWindow();
|
||||||
|
#endif
|
||||||
AspectRatioWidth = Screen.mainWindowDisplayInfo.width;
|
AspectRatioWidth = Screen.mainWindowDisplayInfo.width;
|
||||||
AspectRatioHeight = Screen.mainWindowDisplayInfo.height;
|
AspectRatioHeight = Screen.mainWindowDisplayInfo.height;
|
||||||
defaultScale = new Vector3(Screen.width, Screen.height, 0);
|
defaultScale = new Vector3(Screen.width, Screen.height, 0);
|
||||||
|
|
@ -98,10 +145,7 @@ namespace HeavenStudio
|
||||||
instance = this;
|
instance = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
System.IntPtr hWnd;
|
|
||||||
System.IntPtr HWND_TOP = new System.IntPtr(0);
|
|
||||||
System.IntPtr HWND_TOPMOST = new System.IntPtr(-1);
|
|
||||||
System.IntPtr HWND_NOTOPMOST = new System.IntPtr(-2);
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
@ -145,8 +189,11 @@ namespace HeavenStudio
|
||||||
UpdatePan();
|
UpdatePan();
|
||||||
//SetShakeIntensity();
|
//SetShakeIntensity();
|
||||||
|
|
||||||
|
#if UNITY_STANDALONE_WIN
|
||||||
SetPosition(hWnd, Convert.ToInt16(pan.x), Convert.ToInt16(pan.y), Convert.ToInt16(scale.x), Convert.ToInt16(scale.y));
|
SetPosition(hWnd, Convert.ToInt16(pan.x), Convert.ToInt16(pan.y), Convert.ToInt16(scale.x), Convert.ToInt16(scale.y));
|
||||||
|
#elif UNITY_STANDALONE_OSX
|
||||||
|
SetPosition(pan.x, pan.y, scale.x, scale.y);
|
||||||
|
#endif
|
||||||
//SetPosition(hWnd, Convert.ToInt16(pan.x + shakeResult.x), Convert.ToInt16(pan.y + shakeResult.y), Convert.ToInt16(scale.x), Convert.ToInt16(scale.y));
|
//SetPosition(hWnd, Convert.ToInt16(pan.x + shakeResult.x), Convert.ToInt16(pan.y + shakeResult.y), Convert.ToInt16(scale.x), Convert.ToInt16(scale.y));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -257,7 +304,11 @@ namespace HeavenStudio
|
||||||
scale = defaultScale;
|
scale = defaultScale;
|
||||||
shakeResult = defaultShake;
|
shakeResult = defaultShake;
|
||||||
if(Application.isEditor) return;
|
if(Application.isEditor) return;
|
||||||
|
#if UNITY_STANDALONE_WIN
|
||||||
SetWindowPos(hWnd, HWND_NOTOPMOST, Convert.ToInt16(pan.x), Convert.ToInt16(pan.y), Convert.ToInt16(scale.x), Convert.ToInt16(scale.y), SWP_SHOWWINDOW);
|
SetWindowPos(hWnd, HWND_NOTOPMOST, Convert.ToInt16(pan.x), Convert.ToInt16(pan.y), Convert.ToInt16(scale.x), Convert.ToInt16(scale.y), SWP_SHOWWINDOW);
|
||||||
|
#elif UNITY_STANDALONE_OSX
|
||||||
|
SetWindowPos(pan.x, pan.y, scale.x, scale.y);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -134,7 +134,7 @@ PlayerSettings:
|
||||||
16:10: 1
|
16:10: 1
|
||||||
16:9: 1
|
16:9: 1
|
||||||
Others: 1
|
Others: 1
|
||||||
bundleVersion: 0.0.1039
|
bundleVersion: 0.0.1040
|
||||||
preloadedAssets:
|
preloadedAssets:
|
||||||
- {fileID: 102900000, guid: 5348c08b82446e0478cee8bda6c02cfc, type: 3}
|
- {fileID: 102900000, guid: 5348c08b82446e0478cee8bda6c02cfc, type: 3}
|
||||||
metroInputSource: 0
|
metroInputSource: 0
|
||||||
|
|
@ -158,11 +158,11 @@ PlayerSettings:
|
||||||
applicationIdentifier:
|
applicationIdentifier:
|
||||||
Standalone: com.RHeavenStudio.Heaven-Studio
|
Standalone: com.RHeavenStudio.Heaven-Studio
|
||||||
buildNumber:
|
buildNumber:
|
||||||
Standalone: 1039
|
Standalone: 1040
|
||||||
iPhone: 0
|
iPhone: 0
|
||||||
tvOS: 0
|
tvOS: 0
|
||||||
overrideDefaultApplicationIdentifier: 0
|
overrideDefaultApplicationIdentifier: 0
|
||||||
AndroidBundleVersionCode: 1039
|
AndroidBundleVersionCode: 1040
|
||||||
AndroidMinSdkVersion: 22
|
AndroidMinSdkVersion: 22
|
||||||
AndroidTargetSdkVersion: 0
|
AndroidTargetSdkVersion: 0
|
||||||
AndroidPreferredInstallLocation: 1
|
AndroidPreferredInstallLocation: 1
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue