I am working on a script for a game and I am running into an error "The type 'GTA.Graphics' has no constructors defined" Here is the code:
GTA.Graphics graphics = new GTA.Graphics();
public void showFPS()
{
string fps = Game.FPS.ToString();
if (Player.Character.isAlive)
{
graphics.DrawText(fps, 0.9f, 0.1f);
}
}
Any help will be much appreciated. Thanks.
@DOOMDUDEMX
I done
public void showFPS(GTA.GraphicsEventArgs e)
{
string fps = Game.FPS.ToString();
e.Graphics.DrawText(fps, 0.9f, 0.1f);
}
which works but causes a problem with my code that toggles this, the error I get from that is "No overload for 'showFPS' matches delegate 'GTA.KeyPressDelegate'"
Here is the code for toggle: BindKey(Keys.F7, new KeyPressDelegate(showFPS));
LetsPlayOrDy at gtaforums.com gave me the solution:
1: When the BindKey takes a function, the function should have no parameters (like this: public void showFPS() )
2: If you want to draw something, you have to use a PerFrameDrawing.
and the code:
BindKey(Keys.F7, new KeyPressDelegate(showFPS));
PerFrameDrawing += tehDrawingMaster;
}
bool drawFPS = false;
public void showFPS()
{
drawFPS = !drawFPS;
}
public void tehDrawingMaster(object sender, GTA.GraphicsEventArgs e)
{
if (drawFPS) e.Graphics.DrawText(Game.FPS.ToString(), 20, 20, System.Drawing.Color.Black)
Thank you all so much.