mirror of
https://github.com/beefytech/Beef.git
synced 2025-07-04 23:36:00 +02:00
Working on installer, fixing more Win32 issues
Throwing error on member references with ".." cascade token outside invocations (ie: "ts..mA = 123") Fixed 'Thread.ModuleTLSIndex' error - which caused us TLS lookup failures in Beef DLLs Fixed some hotswap errors Made BeefPerf shut down properly Fixed an 'int literal' FixIntUnknown issue where rhs was System.Object which caused an illegal boxing Fixed COFF::LocateSymbol issues with Win32 and also with linking to static libraries - showed up with hot-linking in fmod when hot-adding a floating point mod Fixed a couple memory leaks Fixed alignment issue in COFF::ParseCompileUnit
This commit is contained in:
parent
aad0a640c5
commit
b63a243fd7
73 changed files with 2474 additions and 293 deletions
|
@ -11,6 +11,7 @@ using Beefy.utils;
|
|||
using Beefy.res;
|
||||
using Beefy.geom;
|
||||
using System.Threading;
|
||||
using Beefy.sound;
|
||||
#if MONOTOUCH
|
||||
using MonoTouch;
|
||||
#endif
|
||||
|
@ -61,6 +62,7 @@ namespace Beefy
|
|||
public bool mStarted;
|
||||
|
||||
public ResourceManager mResourceManager ~ delete _;
|
||||
public SoundManager mSoundManager = new SoundManager() ~ delete _;
|
||||
|
||||
public int32 mFPSDrawCount;
|
||||
public int32 mFPSUpdateCount;
|
||||
|
@ -124,6 +126,9 @@ namespace Beefy
|
|||
[StdCall, CLink]
|
||||
public static extern void BFApp_RehupMouse();
|
||||
|
||||
[StdCall, CLink]
|
||||
public static extern void* BFApp_GetSoundManager();
|
||||
|
||||
UpdateDelegate mUpdateDelegate ~ delete _;
|
||||
DrawDelegate mDrawDelegate ~ delete _;
|
||||
|
||||
|
@ -467,6 +472,8 @@ namespace Beefy
|
|||
#endif
|
||||
BFApp_Init();
|
||||
|
||||
mSoundManager.[Friend]mNativeSoundManager = BFApp_GetSoundManager();
|
||||
|
||||
Interlocked.Fence();
|
||||
|
||||
mInstallDir = new String(BFApp_GetInstallDir());
|
||||
|
|
|
@ -107,9 +107,7 @@ namespace Beefy.gfx
|
|||
mClipDisposeProxy.mDisposeProxyDelegate = new => PopClip;
|
||||
mRenderStateDisposeProxy = new DisposeProxy();
|
||||
|
||||
String filePath = scope String();
|
||||
filePath.Append(BFApp.sApp.mInstallDir, "images/whiteDot.tga");
|
||||
mWhiteDot = Image.LoadFromFile(filePath);
|
||||
mWhiteDot = Image.LoadFromFile("!white");
|
||||
|
||||
for (int32 i = 0; i < MATIX_STACK_SIZE; i++)
|
||||
mMatrixStack[i] = Matrix.IdentityMatrix;
|
||||
|
|
|
@ -4,8 +4,8 @@ using System.Text;
|
|||
|
||||
namespace Beefy.res
|
||||
{
|
||||
public class SoundGameObject
|
||||
/*public class SoundGameObject
|
||||
{
|
||||
public void* mWwiseObject;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
|
43
BeefLibs/Beefy2D/src/sound/SoundInstance.bf
Normal file
43
BeefLibs/Beefy2D/src/sound/SoundInstance.bf
Normal file
|
@ -0,0 +1,43 @@
|
|||
using System;
|
||||
|
||||
namespace Beefy.sound
|
||||
{
|
||||
struct SoundInstance
|
||||
{
|
||||
[StdCall, CLink]
|
||||
public static extern void* BFSoundInstance_Play(void* nativeSoundInstance, bool looping, bool autoRelease);
|
||||
|
||||
[StdCall, CLink]
|
||||
public static extern void BFSoundInstance_Release(void* nativeSoundInstance);
|
||||
|
||||
[StdCall, CLink]
|
||||
public static extern bool BFSoundInstance_IsPlaying(void* nativeSoundInstance);
|
||||
|
||||
void* mNativeSoundInstance;
|
||||
|
||||
public this(void* nativeSoundInstance)
|
||||
{
|
||||
mNativeSoundInstance = nativeSoundInstance;
|
||||
}
|
||||
|
||||
public void Dispose() mut
|
||||
{
|
||||
BFSoundInstance_Release(mNativeSoundInstance);
|
||||
mNativeSoundInstance = null;
|
||||
}
|
||||
|
||||
public void Play(bool looping = false, bool autoRelease = false)
|
||||
{
|
||||
if (mNativeSoundInstance == null)
|
||||
return;
|
||||
BFSoundInstance_Play(mNativeSoundInstance, looping, autoRelease);
|
||||
}
|
||||
|
||||
public bool IsPlaying()
|
||||
{
|
||||
if (mNativeSoundInstance == null)
|
||||
return false;
|
||||
return BFSoundInstance_IsPlaying(mNativeSoundInstance);
|
||||
}
|
||||
}
|
||||
}
|
43
BeefLibs/Beefy2D/src/sound/SoundManager.bf
Normal file
43
BeefLibs/Beefy2D/src/sound/SoundManager.bf
Normal file
|
@ -0,0 +1,43 @@
|
|||
using System;
|
||||
|
||||
namespace Beefy.sound
|
||||
{
|
||||
struct SoundSource : int32
|
||||
{
|
||||
public bool IsInvalid
|
||||
{
|
||||
get
|
||||
{
|
||||
return this == (.)-1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class SoundManager
|
||||
{
|
||||
void* mNativeSoundManager;
|
||||
|
||||
[StdCall, CLink]
|
||||
public static extern int32 BFSoundManager_LoadSound(void* nativeSoundManager, char8* fileName);
|
||||
|
||||
[StdCall, CLink]
|
||||
public static extern void* BFSoundManager_GetSoundInstance(void* nativeSoundManager, int32 sfxId);
|
||||
|
||||
public SoundSource LoadSound(StringView fileName)
|
||||
{
|
||||
return (.)BFSoundManager_LoadSound(mNativeSoundManager, fileName.ToScopeCStr!());
|
||||
}
|
||||
|
||||
public SoundInstance GetSoundInstance(SoundSource soundSource)
|
||||
{
|
||||
void* nativeSoundInstance = BFSoundManager_GetSoundInstance(mNativeSoundManager, (.)soundSource);
|
||||
return .(nativeSoundInstance);
|
||||
}
|
||||
|
||||
public void PlaySound(SoundSource soundSource)
|
||||
{
|
||||
let soundInstance = GetSoundInstance(soundSource);
|
||||
soundInstance.Play(false, true);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -15,7 +15,7 @@ namespace Beefy.widgets
|
|||
{
|
||||
if ((mMouseOver && mMouseDown) && (mDownImage != null))
|
||||
g.Draw(mDownImage);
|
||||
if ((mMouseOver) && (mOverImage != null))
|
||||
else if ((mMouseOver) && (mOverImage != null))
|
||||
g.Draw(mOverImage);
|
||||
else
|
||||
g.Draw(mImage);
|
||||
|
|
|
@ -9,8 +9,9 @@ namespace Beefy.widgets
|
|||
public class LabelWidget : Widget
|
||||
{
|
||||
public Font mFont;
|
||||
public String mLabel;
|
||||
public String mLabel ~ delete _;
|
||||
public uint32 mColor = Color.White;
|
||||
public FontAlign mAlign = .Left;
|
||||
|
||||
public override void Draw(Graphics g)
|
||||
{
|
||||
|
@ -18,7 +19,12 @@ namespace Beefy.widgets
|
|||
|
||||
g.SetFont(mFont);
|
||||
using (g.PushColor(mColor))
|
||||
g.DrawString(mLabel, 0, 0);
|
||||
g.DrawString(mLabel, 0, 0, mAlign, mWidth);
|
||||
}
|
||||
|
||||
public float CalcWidth()
|
||||
{
|
||||
return mFont.GetWidth(mLabel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ namespace Beefy.widgets
|
|||
{
|
||||
if ((value.a == 1) && (value.b == 0) && (value.c == 0) && (value.d == 1))
|
||||
{
|
||||
mTransformData = null;
|
||||
DeleteAndNullify!(mTransformData);
|
||||
mX = value.tx;
|
||||
mY = value.ty;
|
||||
}
|
||||
|
@ -142,6 +142,11 @@ namespace Beefy.widgets
|
|||
mOnDeleted(this);
|
||||
}
|
||||
|
||||
public void ClearTransform()
|
||||
{
|
||||
DeleteAndNullify!(mTransformData);
|
||||
}
|
||||
|
||||
public void MarkDirty()
|
||||
{
|
||||
if (mWidgetWindow != null)
|
||||
|
|
|
@ -428,7 +428,15 @@ namespace Beefy.widgets
|
|||
{
|
||||
var result = mOnHitTest(x, y);
|
||||
if (result != HitTestResult.NotHandled)
|
||||
{
|
||||
if (result != .Client)
|
||||
{
|
||||
if (mHasMouseInside)
|
||||
MouseLeave();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
if (mWindowFlags.HasFlag(Flags.Resizable))
|
||||
|
@ -445,7 +453,7 @@ namespace Beefy.widgets
|
|||
if (!mHasMouseInside)
|
||||
return;
|
||||
|
||||
Widget aWidget = mRootWidget.FindWidgetByCoords(mMouseX, mMouseY);
|
||||
Widget aWidget = mRootWidget.FindWidgetByCoords(mMouseX, mMouseY);
|
||||
if (mCaptureWidget != null)
|
||||
{
|
||||
bool didSomething = false;
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
*/
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace SDL2
|
||||
{
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
|
||||
#region Using Statements
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
#endregion
|
||||
|
||||
namespace SDL2
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
*/
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace SDL2
|
||||
{
|
||||
|
@ -40,13 +39,13 @@ namespace SDL2
|
|||
public const int32 SDL_TTF_PATCHLEVEL = 12;
|
||||
|
||||
public const int32 UNICODE_BOM_NATIVE = 0xFEFF;
|
||||
public const int32 UNICODE_BOM_SWAPPED = 0xFFFE;
|
||||
public const int32 UNICODE_BOM_SWAPPED = 0xFFFE;
|
||||
|
||||
public const int32 TTF_STYLE_NORMAL = 0x00;
|
||||
public const int32 TTF_STYLE_BOLD = 0x01;
|
||||
public const int32 TTF_STYLE_ITALIC = 0x02;
|
||||
public const int32 TTF_STYLE_UNDERLINE = 0x04;
|
||||
public const int32 TTF_STYLE_STRIKETHROUGH = 0x08;
|
||||
public const int32 TTF_STYLE_NORMAL = 0x00;
|
||||
public const int32 TTF_STYLE_BOLD = 0x01;
|
||||
public const int32 TTF_STYLE_ITALIC = 0x02;
|
||||
public const int32 TTF_STYLE_UNDERLINE = 0x04;
|
||||
public const int32 TTF_STYLE_STRIKETHROUGH = 0x08;
|
||||
|
||||
public const int32 TTF_HINTING_NORMAL = 0;
|
||||
public const int32 TTF_HINTING_LIGHT = 1;
|
||||
|
|
|
@ -181,7 +181,7 @@ namespace System.Threading
|
|||
StartInternal();
|
||||
}
|
||||
|
||||
#if PLATFORM_WINDOWS
|
||||
#if BF_PLATFORM_WINDOWS
|
||||
[CLink]
|
||||
static extern int32 _tls_index;
|
||||
#endif
|
||||
|
@ -190,7 +190,7 @@ namespace System.Threading
|
|||
{
|
||||
get
|
||||
{
|
||||
#if PLATFORM_WINDOWS
|
||||
#if BF_PLATFORM_WINDOWS
|
||||
return _tls_index;
|
||||
#else
|
||||
return 0;
|
||||
|
|
|
@ -852,6 +852,12 @@ namespace System
|
|||
public const int32 OFN_USESHELLITEM = 0x01000000;
|
||||
|
||||
public const int32 CSIDL_DESKTOP = 0x0000;
|
||||
public const int32 CSIDL_PROGRAMS = 0x0002; // Start Menu\Programs
|
||||
public const int32 CSIDL_PERSONAL = 0x0005; // My Documents
|
||||
public const int32 CSIDL_STARTUP = 0x0007; // Start Menu\Programs\Startup
|
||||
public const int32 CSIDL_LOCAL_APPDATA = 0x001c;// <user name>\Local Settings\Applicaiton Data (non roaming)
|
||||
public const int32 CSIDL_COMMON_APPDATA = 0x0023; // All Users\Application Data
|
||||
public const int32 CSIDL_PROGRAM_FILES = 0x0026; // C:\Program Files
|
||||
|
||||
public const int32 WM_CLOSE = 0x0010;
|
||||
public const int32 WM_DESTROY = 0x0002;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue