Closed Csharper1972 closed 9 years ago
Take a look at the code within FramesPerSecond class, it uses a font rendering class that I've included in that project under Capture\Hook\Common\TextElement.cs is passed to Hook\DX11\OverlayEngine.cs which in turn uses the DXFont.cs and DXSprite.cs classes to render the text.
So you can simply do something like:
new Capture.Hook.Common.TextElement(new System.Drawing.Font("Arial", 16)) {Text="The Text to display", Location = new System.Drawing.Point(5,5), Color = System.Drawing.Color.Red, AntiAliased = true }
Note the use of Text=".....".
Cheers, J
On Fri, May 1, 2015 at 8:41 PM, Csharper1972 notifications@github.com wrote:
For example this line in DXHookD3D11.cs write on the screen the fps(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 }
Now let's say i want to write on screen something else for example the words "Hello World" on location instead 5,5 but 5,30
How can i do it ? So when i'm running the game a Directx 11 game i will see the frapes per second and under it i will see the text "Hello World"
I tried to read about how making a Font in directx11 . For example i searched in google and found about DirectWrite: http://sharpdx.org/documentation/api/n-sharpdx-directwrite But i didn't understand how to use it since in the Capture project the SharpDX dosen't have the namespace DirectWrite.
Maybe you know and can show me how to add more text on screen ? Like it show the frames per second on screen so show other texts.
I found how to do it in DXHookD3D9.cs but in the DXHookD3D11.cs it's hard i couldn't find how to dit yet.
— Reply to this email directly or view it on GitHub https://github.com/spazzarama/Direct3DHook/issues/25.
Ok it's working but not as i wanted i mean i see the text but what i did is added this line: new Capture.Hook.Common.TextElement(new System.Drawing.Font("Arial",16)) {Text=FramesPerSecond.RunTime.ToString(), Location = new System.Drawing.Point(5,30), Color = System.Drawing.Color.Red, AntiAliased = true }
And you can see i did: Text=FramesPerSecond.RunTime.ToString() and in the FramesPerSecond class(Not the Capture.Hook.Common.FramesPerSecond) i added this part:
static DateTime _startTime = DateTime.Now;
public static TimeSpan RunTime
{
get
{
return DateTime.Now - _startTime;
}
}
This is working fine in the DXHookD3D9.cs it's showing a clock showing me in real time how much time i'm playing. But in the DXHookD3D11.cs the line with the Text= it's just showing still text of the clock.
What should i do that it will show the clock running ?
I mean that the line that display the fps i see on the game screen the fps change in real time live.
But the line with the Text = "text to display" when i'm doing
Text = FramesPerSecond.RunTime.ToString() i need to make Atl+Tab all the time to go to the windows and back to the game window then the value of the Text change. But i want that the Text will change in real time live on screen just like the fps.
Probably need to add to diff spot, checkout how the frames per second is added to the overlay engine in dx11
On Saturday, 2 May 2015, Csharper1972 notifications@github.com wrote:
I mean that the line that display the fps i see on the game screen the fps change in real time live. But the line with the Text = "text to display" when i'm doing
Text = FramesPerSecond.RunTime.ToString() i need to make Atl+Tab all the time to go to the windows and back to the game window then the value of the Text change. But i want that the Text will change in real time live on screen just like the fps.
— Reply to this email directly or view it on GitHub https://github.com/spazzarama/Direct3DHook/issues/25#issuecomment-98307586 .
For example this line in DXHookD3D11.cs write on the screen the fps(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 }
Now let's say i want to write on screen something else for example the words "Hello World" on location instead 5,5 but 5,30
How can i do it ? So when i'm running the game a Directx 11 game i will see the frapes per second and under it i will see the text "Hello World"
I tried to read about how making a Font in directx11 . For example i searched in google and found about DirectWrite: http://sharpdx.org/documentation/api/n-sharpdx-directwrite But i didn't understand how to use it since in the Capture project the SharpDX dosen't have the namespace DirectWrite.
Maybe you know and can show me how to add more text on screen ? Like it show the frames per second on screen so show other texts.
I found how to do it in DXHookD3D9.cs but in the DXHookD3D11.cs it's hard i couldn't find how to dit yet.