+ removed unnecessary EventInput code from the linux build, null check before disposing sprite texture
This commit is contained in:
Regalis
2016-11-09 21:01:38 +02:00
parent f3bea2702b
commit 50a770a2a6
4 changed files with 68 additions and 51 deletions
+2 -2
View File
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.5.3.2")] [assembly: AssemblyVersion("0.5.3.3")]
[assembly: AssemblyFileVersion("0.5.3.2")] [assembly: AssemblyFileVersion("0.5.3.3")]
+13 -11
View File
@@ -6,7 +6,7 @@ using Microsoft.Xna.Framework.Input;
namespace EventInput namespace EventInput
{ {
#if WINDOWS
public class KeyboardLayout public class KeyboardLayout
{ {
const uint KLF_ACTIVATE = 1; //activate the layout const uint KLF_ACTIVATE = 1; //activate the layout
@@ -32,6 +32,7 @@ namespace EventInput
return name.ToString(); return name.ToString();
} }
} }
#endif
public class CharacterEventArgs : EventArgs public class CharacterEventArgs : EventArgs
{ {
@@ -115,9 +116,12 @@ namespace EventInput
/// </summary> /// </summary>
public static event KeyEventHandler KeyUp; public static event KeyEventHandler KeyUp;
static bool initialized;
#if WINDOWS
delegate IntPtr WndProc(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam); delegate IntPtr WndProc(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam);
static bool initialized;
static IntPtr prevWndProc; static IntPtr prevWndProc;
static WndProc hookProcDelegate; static WndProc hookProcDelegate;
static IntPtr hIMC; static IntPtr hIMC;
@@ -145,7 +149,7 @@ namespace EventInput
[DllImport("user32.dll", CharSet = CharSet.Unicode)] [DllImport("user32.dll", CharSet = CharSet.Unicode)]
static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong); static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
#endif
/// <summary> /// <summary>
/// Initialize the TextInput with the given GameWindow. /// Initialize the TextInput with the given GameWindow.
@@ -157,15 +161,15 @@ namespace EventInput
{ {
return; return;
} }
//throw new InvalidOperationException("TextInput.Initialize can only be called once!");
hookProcDelegate = HookProc;
#if WINDOWS #if WINDOWS
hookProcDelegate = HookProc;
prevWndProc = (IntPtr)SetWindowLong(window.Handle, GWL_WNDPROC, prevWndProc = (IntPtr)SetWindowLong(window.Handle, GWL_WNDPROC,
(int)Marshal.GetFunctionPointerForDelegate(hookProcDelegate)); (int)Marshal.GetFunctionPointerForDelegate(hookProcDelegate));
hIMC = ImmGetContext(window.Handle); hIMC = ImmGetContext(window.Handle);
#elif LINUX #else
window.TextInput += ReceiveInput; window.TextInput += ReceiveInput;
#endif #endif
@@ -181,7 +185,7 @@ namespace EventInput
{ {
if (CharEntered != null) CharEntered(null, new CharacterEventArgs(character, 0)); if (CharEntered != null) CharEntered(null, new CharacterEventArgs(character, 0));
} }
#if WINDOWS
static IntPtr HookProc(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam) static IntPtr HookProc(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam)
{ {
IntPtr returnCode = CallWindowProc(prevWndProc, hWnd, msg, wParam, lParam); IntPtr returnCode = CallWindowProc(prevWndProc, hWnd, msg, wParam, lParam);
@@ -219,12 +223,10 @@ namespace EventInput
break; break;
} }
return returnCode; return returnCode;
}
} }
#endif
}
} }
+4
View File
@@ -379,7 +379,11 @@ namespace Barotrauma
} }
//if not, free the texture //if not, free the texture
if (texture != null)
{
texture.Dispose(); texture.Dispose();
texture = null;
}
} }
} }
+11
View File
@@ -1,3 +1,14 @@
---------------------------------------------------------------------------------------------------------
v0.5.3.3
---------------------------------------------------------------------------------------------------------
- fixed a bug that caused crashes after a husk-infected player died
- disabled the "zoom effect" when under pressure as a huskified human
- only a limited number of messages are kept in the debug console (prevents performance issues if large
amounts of messages are added)
- some item and electricity logic optimization
- fixed "sprite tigerthresher not found" errors in the Linux version
--------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------
v0.5.3.2 v0.5.3.2
--------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------