Jump to content

Image between resources


dugasz1

Recommended Posts

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

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

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