Molvine Posted May 1, 2022 Share Posted May 1, 2022 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
Molvine Posted May 1, 2022 Author Share Posted May 1, 2022 Changed: I found out that the image will be shown if you register it in the meta.xml of the dgs resource. Is there any better way? Link to comment
Flashmyname Posted May 1, 2022 Share Posted May 1, 2022 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 xLive Posted May 1, 2022 Scripting Moderators Share Posted May 1, 2022 (edited) 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 path. You can use this function instead dgsImageSetImage or use dxCreateTexture to create a dx-texture. Edited May 1, 2022 by xLive wrong link 1 Link to comment
Molvine Posted May 1, 2022 Author Share Posted May 1, 2022 17 minutes ago, xLive said: Hi! Please read this page: https://wiki.multitheftauto.com/wiki/Dgs-dxbutton#image image property only accepts a texture and not a path. You can use this function instead dgsImageSetImage or use dxCreateTexture to create a dx-texture. Everything is working. Thanks for the help! Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now