dugasz1 Posted May 23, 2015 Share Posted May 23, 2015 Hello! How can i use an image from another resource? So for example i have 2 resource called 'res1' and 'res2'. I write in an image to the meta in res1. And how can i use it in res2? Link to comment
mommytellme Posted May 23, 2015 Share Posted May 23, 2015 yes, in path of image write :res1/image.png Link to comment
tosfera Posted May 23, 2015 Share Posted May 23, 2015 You can either use :resname/image.png or you can create an entire media system. That's what I'm always doing, the system will keep track of all your images and also draw them by using an exported function. Therefore you don't have to search for images in every resource if you want 2 different images. All you have to do, is call the exported function and... magic happens. Link to comment
Moderators IIYAMA Posted May 23, 2015 Moderators Share Posted May 23, 2015 Another way of requesting images from other resources: (not tested but should be working) <export function="requestImage" type="client"/> local requestDatabase = {} function requestImage (filePath,buffer) if requestDatabase[filePath] then return requestDatabase[filePath]["texture"] elseif fileExists (filePath) then local texture = dxCreateTexture(filePath) if texture then if buffer then requestDatabase[filePath] = {["texture"]= texture,["creationTime"]=getRealTime().timestamp} end return texture end end return false end local image = call ( getResourceFromName ( "**********" ), "requestImage",filePath,true) Link to comment
tosfera Posted May 23, 2015 Share Posted May 23, 2015 That's the thing I was saying, iiyama. Just create an exported function to retrieve all your images. (: Link to comment
Walid Posted May 23, 2015 Share Posted May 23, 2015 That's the thing I was saying, iiyama. Just create an exported function to retrieve all your images. (: A common resource for the image will save memory. but Make sure the other resources it. 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