Guad / NativeUI

UI library for Grand Theft Auto V
MIT License
270 stars 112 forks source link

Trying to display a custom image #16

Closed JAAYapps closed 9 years ago

JAAYapps commented 9 years ago

I have been trying to display a custom image in gta 5 with your sprite example

                    Sprite.DrawTexture(Sprite.WriteFileFromResources(Assembly.GetExecutingAssembly(), "BTTF Time Travel.amber0.pung", Application.StartupPath + "\\image.png"), new Point(0, 1), new Size(10, 10));

the game keeps crashing with

fatal: directx "path of the image" texture creation failed.

Game exits.

GTA 5 dot net script hook 2.1 latest nativeUI

any help?

Guad commented 9 years ago

First of all, you shouldn't call WriteFileFromResources in a tick, as it will constantly write the file to disk. Instead call it once in the constructor and save the absolute path. Second, your filename is proably wrong since the default namespace cannot contain spaces. Look in Project > BTTF Time Travel Properties...; There's a field named "Default namespace", it should be something like BTTF_Time_Travel, use that instead.

JAAYapps commented 9 years ago

I made the changes, but it still crashes

The file is present in the scripts folder as image.png

image

image.pmg is there

Guad commented 9 years ago

Make sure image.png is not empty, and the game has permissions to open it

JAAYapps commented 9 years ago

I ran gta 5 as admin, still crashed

JAAYapps commented 9 years ago

I found the problem. I left out the scripts folder. LOL Thankyou for the help.