• Content Count

  • Joined

  • Last visited

About JAA

  • Rank

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Thanks xerver. I have tidied up my code and have it working great now. Once I get closer to finishing my game, I will let everyone know so you can all play it.
  2. Thanks @ivan.popelyshev and @themoonrat. Your combined answers where exactly the info I was looking for.
  3. I want to run myPixi.ticker.stop() when the window loses focus in any way, eg minimize, click a different tab or even closing the window. Q: Is there a javascript event that covers all the possibilities? Q2: Is there a javascript event that covers all possible methods of a window regaining focus, eg a return from minimize, reclicking the tab etc?
  4. Thanks for your hints and tips xerver. I had something similar to your ResourceContainer, but I really do like the idea of your ResourceManager and will be using that from now on. One thing I am still confused about, namely ResourceManager.BASETEXTURE in your code. I load these with PIXI.loader. I then fill my own array with these (like your ResourceContainer) ready to destroy. However, how should I destroy these? Should I destroy these with in the loader? Can I just cycle through the array and call destroy on them. If I do destroy using the latter (cycling through my array) will my PIXI.loader be able to reload these, or do I need to call destroy on the PIXI.loader?
  5. Thanks for these replies. It looks a little more complicated than I thought. I create my sprite from a style sheet. So I think this means I cannot just do destroy(true) as several sprites will share the same base texture and get the exception @xerver is talking about. In the sprite's destroy function it says I can pass an object. Since I am creating my sprite from a frame using the following: texture = PIXI.utils.TextureCache["textureId"]); rect = new PIXI.Rectangle(x, y, w, h); textureWithFrame = new PIXI.Texture(texture, rect); Option 1: I am guessing my SPRITE's destroy call needs to look like this: spr.destroy({children: true, texture: true, baseTexture: false}); Is this correct? The 'texture' is the one from the frame (textureWithFrame) so that needs to be destroyed as it is only used in one sprite. baseTexture is the entire spritesheet so cannot be destroyed as several sprites share this. Q: Will all the textureWithFrame be removed from PIXI.utils.TextureCache? How do I cycle through PIXI.utils.TextureCache destroying each element? Option 2: Since all the textures (including the ones like textureWithFrame) are stored in PIXI.utils.TextureCache, then I should destroy my sprite with: spr.destroy(false); Then I need to cycle through PIXI.utils.TextureCache and destroy every texture without worrying at all where it was used. Q: How do I cycle through PIXI.utils.TextureCache destroying each element? So which option is best, Option 1 or Option 2? Or am I completely getting this wrong?
  6. Simple question. How to cleanup? I want to do this well as I want to destroy every sprite and texture without exiting the window. I then want to create a load more textures and sprites, but some of the textures will be ones that were previously destroyed, so I want to avoid the 'Resource already exists' problem. I have created loads of sprites, and since I need to access them quickly I have them in a quick lookup, so I clean these up by going through each one and using the function destroy. However, I also want to clean up all the textures.They are in PIXI.utils.TextureCache I think. How do I clean these up? Is there any other references to these textures that need cleaning? Are there any other issue I might encounter?
  7. JAA

    Runtime Dimension Changes

    Thanks guys. [Question to Ivan at end.] My code is now (where strCanvas is the id of the canvas, not containing div): g_Pixi = new PIXI.Application(width, height, { view: document.getElementById(strCanvas), backgroundColor: 0x000000 }); And my adjust size code is now: g_Pixi.renderer.autoResize = true; g_Pixi.renderer.resize(widthDOM, heightDOM); @Ivan, I am not sure what I should be doing about the resolution for mobiles etc. How do I find the screen resolution, and how do I alter my code to take it into account?
  8. PLEASE DELETE: I apologise to the PixiJS gang. It is not the frightenly fast Pixi that is causing the low fps, it is the sound. My sound works in Chrome, Edge, Internet Explorer, but not Firefox. It slows the whole system to a snail's pace in Firefox only. If anyone knows a good sound library which can play sound on keybutton press immediately with no delay or gaps, please let me know. I am working on a game which is nowhere near completion yet, so I cannot give you a running example, however, I can say what I am doing. I have 5 cropped sections over the screen, each showing a different representation of the scene. Eg the user's main view, a mini-map showing the user's relation to others, etc There are several text areas giving the user important info. About 50 bits of text which need to be aligned, due to them needing to be in columns. I only have about 30 images in each scene that are moving. In the wonderful chrome I am getting 60fps. In edge I am getting 45fps, but it has the known keyboard input issue which might put some users off using edge. However in Firefox I am getting a terrible 6fps. Has anyone experienced such a thing before? Is there something in Firefox that needs to be turned on or something? UPDATE: I have literally removed most things except the very base animation (24 small 25x25 pixel sprites and 2 large 2000x2000 background sprites) and I am still only getting 10fps on firefox. There must be a firefox setting that is not right on my machine, or I am setting things up incorrectly somehow that firefox does not like.
  9. You set up an application element: g_Pixi = new PIXI.Application(width, height, { backgroundColor: 0x000000 }); document.getElementById(strCanvasDiv).appendChild(g_Pixi.view); 'width' and 'height' are the dimensions of the canvas with id strCanvasDiv.. Question 1: in the object, should I send the canvas in the 'view' element? Ie, g_Pixi = new PIXI.Application(width, height, { view: document.getElementById(strCanvasDiv), backgroundColor: 0x000000 }); But then the user decides he wants to change the dimensions of the screen (which in my code will change the dimensions of the canvas). For example, he could modify the window or even change landscape to portrait. Question 2: What do I do to change the dimensions of the renderer to the new dimensions of the canvas so it all works still?
  10. JAA

    Blurred Lines

    I want to draw a polygon, for simplicity let's make it a triangle. var graphics = new PIXI.Graphics(); graphics.lineStyle(5, 0xFFFFFF, 1); graphics.moveTo(10, 10); graphics.lineTo(100, 10); graphics.lineTo(50, 100); graphics.lineTo(10, 10); container.addChild(graphics); The question is this: How is the best way to add a black shadow to both sides on the lines, so it is pure black just to the left and right of the line, then fades by alpha out to about 5 pixels either side of the line? Effectively I want a blurred black line of about 15 pixels (with a solid center which fades in alpha at the outer edges) with a solid white line of 5 pixels right in the middle of the black blurred line.