Closed Csharper1972 closed 9 years ago
Can you include an example of what the value of the property "Texts" is please? From memory I think this is an issue with the specified character not existing within the generated font texture.
The other issue could have been related to the SharpDX version (change in Rectangle struct / constructor). Problem isn't occurring currently in my tests so closing this issue unless further input provided.
Let me explain. In the class DXHookD3D11.cs there is a line that write to the screen the frames per second.
new Capture.Hook.Common.FramesPerSecond(new System.Drawing.Font("Arial", 16)) { Location = new System.Drawing.Point(5,5), Color = System.Drawing.Color.Red, AntiAliased = true },
I created inside Capture.Hook.Common a new class called it TimeRunning this is the class code:
using System; using System.Collections.Generic; using System.Linq; using System.Text;
namespace Capture.Hook.Common { public class TimeRunning : TextElement { DateTime _startTime = DateTime.Now; TimeSpan RunTime;
}
Then in the DXHookD3D11.cs inside the Elements = Under the line with the FramesPerSecond:
new Capture.Hook.Common.TimeRunning(new System.Drawing.Font("Arial", 16)) { Location = new System.Drawing.Point(5,30), Color = System.Drawing.Color.Red, AntiAliased = true }
So now it look like this:
_overlayEngine.Overlays.Add(new Capture.Hook.Common.Overlay { Elements = { new Capture.Hook.Common.FramesPerSecond(new System.Drawing.Font("Arial", 16)) { Location = new System.Drawing.Point(5,5), Color = System.Drawing.Color.Red, AntiAliased = true }, new Capture.Hook.Common.TimeRunning(new System.Drawing.Font("Arial", 16)) { Location = new System.Drawing.Point(5,30), Color = System.Drawing.Color.Red, AntiAliased = true } } });
But when running the program and inject to a game i'm getting this exception:
Debug: DXHookD3D11: PresentHook: Exeception: System.IndexOutOfRangeException: System.IndexOutOfRangeException: Index was outside the bounds of the array. at Capture.Hook.DX11.DXFont.GetCharRect(Char c) in c:\Temp\hook\Direct3DHook-master\Capture\Hook\DX11\DXFont.cs:line 251 at Capture.Hook.DX11.DXSprite.DrawString(Int32 X, Int32 Y, String text, Int32 R, Int32 G, Int32 B, Int32 A, DXFont F) in c:\Temp\hook\Direct3DHook-master\Capture\Hook\DX11\DXSprite.cs:line 258 at Capture.Hook.DX11.DXOverlayEngine.Draw() in c:\Temp\hook\Direct3DHook-master\Capture\Hook\DX11\DXOverlayEngine.cs:line 145 at Capture.Hook.DXHookD3D11.PresentHook(IntPtr swapChainPtr, Int32 syncInterval, PresentFlags flags) in c:\Temp\hook\Direct3DHook-master\Capture\Hook\DXHookD3D11.cs:line 401
How can i fix it ? I want that the TimeRunning will be display on screen under the FramesPerSecond.