Jump to content

Help with drawing text using C# client-side


Recommended Posts

How do you draw text using C# on client side? I found the method inside RAGE.GAME namespace, but can't figure it out how to draw text.

Here is what I tried 

RAGE.Game.UIText.Draw("Testing", new System.Drawing.Point(100, 100), 3F, System.Drawing.Color.FromArgb(196, 15, 15), RAGE.Game.Font.Monospace, true);

this is how the constructor looks:

void RAGE.Game.UIText.Draw(string caption, System.Drawing.Point position, float scale, System.Drawing.Color color, RAGE.Game.Font font, bool centered)

I know the caption is the text that I want to be drawn (the scale may be the font size? I've tried with different scales, ex 0.3F, 0.7F, 3F, 10F, still nothing). The position gives me some headache because on JS you specify the position by percentage (0 to 1), but the constructor for System.Drawing.Point requires two integers (x and y, so I guess they are the screen pixels). I know how to do the color too, the font, and the last parameter (centered) I think it means centering the text inside the drawn object or something like that? I haven't found anything for the C# version of draw text. The problem is that even with my above code  nothing gets drawn on the screen. Am I doing something wrong?



Edit: As stupid as I am i realised that it was because I was running the function only one time and I expected the text to remain there without knowing that I need to render it every frame. In the meantime because I didn't knew how to get it working I managed to do the same thing using CEF, it works just fine to display text or even images in the corner of the screen. Does drawText even makes any sense if you can use CEF instead of it which you can have a lot more customization?

Edited by robearded
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...