Jump to content

DGS Error loading image


Recommended Posts

Hello! I'm facing a problem where I can't change the texture of a button.
Debug gives an error: WARNING: dgs\utility.lua:1098: Error loading image @ 'dxDrawImage' [button5.png]

Added a picture in meta.xml. When using dgsCreateImage, the image is displayed correctly


The code:

local dgs = exports.dgs
local button = dgs:dgsCreateButton(900,300,160,40,'Button',false)
dgs:dgsSetProperty(button,'image','button5.png')


If someone knows how to fix this, please tell me.?

Link to comment

Hi, maybe you should try this: 

dgs:dgsSetProperty('button5.png','image',button)

if this doesn't work out as it should, then you should try to check the path, if the .png file is in the right place, like if it is in a folder, then change the path in the script too like this for example in meta:

<file src="files/button5.png" />

and it's also changes in the lua:

dgs:dgsSetProperty('files/button5.png','image',button)

 

Link to comment
  • Scripting Moderators
5 hours ago, Molvine said:

Hello! I'm facing a problem where I can't change the texture of a button.
Debug gives an error: WARNING: dgs\utility.lua:1098: Error loading image @ 'dxDrawImage' [button5.png]

Added a picture in meta.xml. When using dgsCreateImage, the image is displayed correctly


The code:

local dgs = exports.dgs
local button = dgs:dgsCreateButton(900,300,160,40,'Button',false)
dgs:dgsSetProperty(button,'image','button5.png')


If someone knows how to fix this, please tell me.?

Hi!
Please read this page: https://wiki.multitheftauto.com/wiki/Dgs-dxbutton#image
image property only accepts a texture and not a pathYou can use this function instead dgsImageSetImage or use dxCreateTexture to create a dx-texture.

Edited by xLive
wrong link
  • Thanks 1
Link to comment

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...