Remote Resource-STKs – ShiVa Engine

Remote Resource-STKs

Resource STKs should not contain games. Create them by right-clicking on your desired item and choose “Add to Export”. After you have added everything you want to group into one pack, click “Export” in that window and choose “STK” as export option.
Caching resource STKs is similar to caching textures or videos. For simplicity reasons, the snippet below runs in its own AI onLoop state.
Every resource in the pack can be accessed through its PackName/ResourceName handle after caching.

--------------------------------------------------------------------------------
function Main.loadResources_onLoop ( )
--------------------------------------------------------------------------------
    local nProgress = cache.getFileStatus  ( "ResourcePack.stk" )
    log.message ( "STK loading onLoop progress: "..nProgress )
    if ( nProgress < 0) then
        cache.addFile ( "ResourcePack.stk", "http://www.stonetrip.com/developer/dump/ResourcePack.stk" ) --remote file
        -- or if you want, a local file:
        --cache.addFile ( "ResourcePack.stk", "file://C:/path/to/your/ResourcePack.stk" )
    end
    if (nProgress == 1) then
        --load a HUD that was in the resource pack
        hud.newTemplateInstance ( this.getUser ( ), "ResourcePack/iPhoneJoypadEmulation", "JoyPad" )
        this.null ( ) -- go to another state and leave the loop
    end
--------------------------------------------------------------------------------
end
--------------------------------------------------------------------------------



Need more answers?

  • slackBanner