Solved DirectX Text draw

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat
Status
Not open for further replies.

traderain

Newbie
Dank Tier Donator
Full Member
Feb 19, 2016
40
583
1
Hi, I followed Fleep's tutorial about the external crosshair and modified it to my needs. My project is 90% done the only thing left is that I need a way to draw text on screen, If anyone have any idea and can help me please tell me I have been searhing for a way for quite a while. Thanks in advance.

EDIT: I am using c#
 
Last edited:

traderain

Newbie
Dank Tier Donator
Full Member
Feb 19, 2016
40
583
1
Alright I managed to fix it.
C++:
private void DxOverlayFrm_FormClosed(object sender, FormClosedEventArgs e)
        {
            device.Dispose();
            font.Dispose();
            Application.Exit();
        }
If anyone would have a similar problem here is how I fixed it.
 

traderain

Newbie
Dank Tier Donator
Full Member
Feb 19, 2016
40
583
1
yeah, but they are all c++ and most of them, are newer directx versions.
However I managed to figure out something which works but my app crahes.
C++:
An unhandled exception of type 'System.NullReferenceException' occurred in Microsoft.DirectX.Direct3DX.dll
My method is the following:
C++:
using Direct3d = Microsoft.DirectX.Direct3D;
using Font = System.Drawing.Font;
then
C++:
Font localFont = new Font("Arial", 74, FontStyle.Regular, GraphicsUnit.Point);
            font = new Direct3d.Font(device, localFont);
after this a create a method for drawing
C++:
private void Draw2Dtext(string text, int x, int y, Color c)
        {
            font.DrawText(null, text, new Rectangle(x, y, this.Width, this.Height), DrawTextFormat.NoClip, c);
        }
And between the beginscene and endscene
C++:
Draw2Dtext("asd",x,y,Color.Red);
I found this in some old scanned book: https://books.google.hu/books?id=8Y...LAhWF_iwKHYdOAyEQ6AEIOzAE#v=onepage&q&f=false
 

Alex

Sober linux neb
Dank Tier Donator
Nobleman
Nov 26, 2015
150
828
1
yeah, but they are all c++ and most of them, are newer directx versions.
However I managed to figure out something which works but my app crahes.
C++:
An unhandled exception of type 'System.NullReferenceException' occurred in Microsoft.DirectX.Direct3DX.dll
My method is the following:
C++:
using Direct3d = Microsoft.DirectX.Direct3D;
using Font = System.Drawing.Font;
then
C++:
Font localFont = new Font("Arial", 74, FontStyle.Regular, GraphicsUnit.Point);
            font = new Direct3d.Font(device, localFont);
after this a create a method for drawing
C++:
private void Draw2Dtext(string text, int x, int y, Color c)
        {
            font.DrawText(null, text, new Rectangle(x, y, this.Width, this.Height), DrawTextFormat.NoClip, c);
        }
And between the beginscene and endscene
C++:
Draw2Dtext("asd",x,y,Color.Red);
I found this in some old scanned book: https://books.google.hu/books?id=8Y...LAhWF_iwKHYdOAyEQ6AEIOzAE#v=onepage&q&f=false
https://www.riemers.net/eng/Tutorials/DirectX/Csharp/Series2/tut18.php
IDK anything about C#, so I can't help ya about the crashes :p
 
Status
Not open for further replies.
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods