Jump to content

Creating a texture cache from JSON


dev.demid
 Share

Recommended Posts

Hello!

I'm new in Pixi, and I'm really sorry if if the issue was discussed earlier, but the last 6 hours of search did not give me the result.

Soo... I'm trying to figure out if it's possible to repeat this example without using a "loader".

I'm using react and webpack, so all my files (json/pictures) are already inside bundle and I don't really want to load them from the side (assets).

an example I want to repeat - http://pixijs.io/examples/#/basics/container-pivot.js

my component code - https://gist.github.com/demidborodin/209a3124ebb61e1f486717bb5d6fe503

I will be very happy if you give me a working example, since I have not found anything like this.

Link to comment
Share on other sites

your assets may be bundled, but despite of their bundled form (inlined b64 or image assets), they still need to be loaded into engine and this is not the case of 'use image from b64 string/asset' - this is not how game engines works. bundle images as assets and load them properly by pixi loader by url.

tell me, you bundle them to provide some basic anti-piracy? if yes, then you have to do it in different way: you'll have to pack your assets into asset pack and then load pack, unpack images into blobs and load blobs with loader.

i have solved this problem long time ago, but my solution will force you to use 3rd party loader, which you may not want to use because of addiyional abstraction layer.

Link to comment
Share on other sites

i've found a hack:

somehow get bundled image object or its b64 form and feed it into newly created basetexture and texture and add it to cache, using that hack:

https://github.com/pixijs/pixi.js/issues/204

i'm saying it's a hack, because it still does not gives you an easy solution for your problem, which modern engines should solve for you, but hey - at some point even old engines may get to the point where they will solve modern problems, so good luck and use that hack ;D

Link to comment
Share on other sites

14 hours ago, PsichiX said:

i have solved this problem long time ago, but my solution will force you to use 3rd party loader, which you may not want to use because of addiyional abstraction layer.

Thanks you for answer! It seems I'm starting to understand how pixi works and loading resources. I still would like to see yours and can show you?)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...