• Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by themoonrat

  1. Are those 2 devices using WebGL or Canvas rendering? If they're using WebGL, does forcing to Canvas solve the issues?
  2. let graphic = new PIXI.Graphics(); // Make graphic however you want // renderer is what was returned when you first created the pixi renderer via 'let renderer = PIXI.autoDetectRenderer()' let texture = renderer.generateTexture( graphic);
  3. It all depends on what devices / browsers your customer is asking you to support. If you know your device list it's easier to make the call. For what I do, which is making games to be played in the browsers of mobile devices, canvas support is still required IMO. Older IE usage is significant enough that customers would prefer us to support them, players on older Galaxy devices just use the internet button so aren't running a modern Chrome, and Chrome itself has a blacklist of devices / graphical driver versions which it deems are buggy and cause too many issues when WebGL is used, even though theoretically they're capable. But the time to drop it is close. A year, maybe 2 max.
  4. PIXI becomes Internet Explorer exclusive.
  5. PIXI v4 has the ability to listen to interaction events globally as well as through display objects. For example: renderer.plugins.interaction.on( 'mousedown', function() { console.log('mousedown') } );
  6. It isn't outputted to the JSDoc, no. I'll do a PR at some point to add the listenable events to the interaction manager documentation
  7. var anim = new PIXI.extras.MovieClip( textures); anim.loop = false;
  8. It's 'wordWrap'; the function looks at the string, and if it is too long, replaces a space with a new line. Because you only have one word, and therefore no spaces, it cannot find a place to insert a new line to keep the text within the wordWrapWidth
  9. The available events are 'mousedown','mouseup','rightdown','rightup','click','rightclick','mousemove','mouseover','mouseout','mouseupoutside','rightupoutside' so you need to listen to rightdown for right mouse button presses
  10. If you mean resolution being something other than 1, then yes. If you mean adjusting the size of the canvas via css, then yes. If you mean scaling the parent of accessible objects, then yes. If you mean scaling actual accessible objects, then yes.
  11. Slotted it into one of my games that uses 2 canvases layered on top of each other.... and..... everything pretty much worked!!! Which was a massive pleasure, since last time i tried that old webgl-2d project, it drew my game into a small corner of the window! Will investigate more for to see if there are actual performance benefits for the variety of devices I have to develop for. The only place it didn't work correctly is when dealing with globalAlpha I believe. The sprite class I use does a, changes globalAlpha, draws the image, then does a ctx.restore(). With pixi-canvas, as more and more faded images are drawn the globalAlpha decreases further and further towards 0, until the game is fully transparent!
  12. A lot of what become bigger projects start off as "i think it would be useful to me if i made library x, and it would also be fun/interesting/educational to me too". It's that kind of statement that keeps up your interest in not just starting, but finishing a project to a releasable state. "I'm going to make library x because i think other people might use it" tends to lead to abandonment, because you have less personal drive to invest your own time into it. My personal opinion? I'm with Rich, there are plenty of engines and toolsets like Unreal & Unity, down to libraries like Cocos and SFML. But it sounds like a cool personal project that'd gain tons of knowledge on how both libraries worked.
  13. By default, the tweens start playing after the last one has finished. If you want them to happen at the same time, you need to use the position parameter For example, this sets the starting point for all tweens at time 0 of the timeline, which is what you require var animation=new TimelineLite();,1,{x:100,y:100},0) .to(container.scale,1,{x:2,y:2},0);
  14. This isn't a Phaser issue, but a device/browser limitation.
  15. It feels like there's a memory leak. Either a PIXI object that contains an event emitter is not getting destroyed correctly, or listeners are being added but not removed, and so the number of Event Emitter listeners grows and grows. PIXI objects that contain an Event Emitter that I'd start looking at mostly would be: Texture, BaseTexture, DisplayObject (which in turn is inherited by Container which is in turn inherited by Graphics, Sprite, Text, BitmapText, Mesh & ParticleContainer) But these also contain Even Emitters Ticker, SystemRenderer, TextStyle (if on v4) I'd be very tempted to put some logging within EventEmitter within the 'EventEmitter.prototype.on' function, and log out the number of listeners for each event when another listener is added. I'd also be tempted to put logging into the constuctor and destroy method for a DisplayObject, to count out via a global var how many active objects there are. (+1 the total after a constructor is called, -1 when destroy is called). In one of those cases I'd hope you'd see something abnormal!
  16. With the Text class, you can choose to turn on and off word wrapping after a certain length, but what I require is to be able to limit the width and/or height of text. If I have a button of a certain size, I want the text 'Bob' to fit in it's natural size, and the text 'BobBobBobBobBobBob' to scale down to fit within this button. Scenario 1: Limiting width. This is actually quite easy, with word wrapping off, because after drawing the text, if the canvas width exceeds how wide I want it to be, I can just scale it down. Scenario 2: Limiting height. Now, in this scenario, word wrapping is on, so it's already wrapping at the appropriate width. However, I can't use the above method to scale the resulting canvas, because then the width would also be reduced, and I don't want that. I do have a very hack solution to these scenarios. Hack on scenario 1 requires checking in renderWebGL if I've scaled down due to limiting width, and if so record some variables so that if I scaled it up and down via .scale things still work. Hack on scenario 2 involves recursively calling updateText with smaller text sizes until it fits within the correct height! Ouch Wondered if anyone had thought about this before and come across any better solutions?
  17. The initial sound being played must occur through a user interaction. After that, the web browsers internal sound player becomes 'unlocked' and can then play sounds on any occasion. Therefore you'll find a lot of games have a splash 'Touch to play' screen that a player must pass through to get to the game; and on this touch event the game plays a sound (could be a silent one!).
  18. Try the latest v3 build, 3.0.11. It has changes to the interaction manager which solves this issue I believe
  19. Have you tried applying this patch to your pixi.js?
  20. Some browsers, Internet Explorer in particular, struggles to play small sounds. On individual sound files, a sound that's 400ms long might not get played at all, or might get cut off when played. Use audacity to 'pad' the file to 1s second by adding silence onto the end. Internet Explorer then finds it much easier to play these short effects. It's very similar when in audio sprites. Internet Explorer does not have the Web Audio API, so its 'seeking' to the correct part of the file is of a lower accuracy
  21. Or you could use a PIXI ticker and just call stop & start on it. The PIXI ticker uses rAF in the background
  22. I have access to iOS devices and a Mac at work, so if you supplied the audio files to test I could run them?
  23. Once graphics are loaded, they are decompressed for the device to use, so there is no difference in memory used for a .jpg or a .png, only the amount of disk space they take up. Memory taken up by an image is width * height * bitdepth, regardless of initial format. If disk space is your questions concern, I use a combination of jpgs and pngs, with some of the later pngcrushed, depending on size and visibility.
  24. Doing a little memory profiling on the game I'm working on using Chrome Task Manager. I load a single audio sprite, which is 6 minutes 40 seconds long. I tested with both a similarly encoded ogg and m4a, and there was no difference to the results No audio loaded: 94 mb 48kbits 44100hz mono: 171 mb 64kbits 44100hz stereo: 247 mb So you can see, decreasing the bitrate WILL decrease memory usage. It's up to you to judge at what quality is acceptable. As I mentioned, I personally feel that 48kbits is fine for mobiles, and 64kbits is fine for desktops, but that's my opinion for the type of games that I make. The other option is of course to decrease the number of sounds that you load for lower end devices. Do not be scared to do this. An iPhone 4s has 512mb of RAM, an iPhone 6s has 2gb; you can't expect the older device to cope with all of the sounds and animations that newer devices can handle. If you trim well enough, for example, the user of an iPhone 4s would never know that there are actually 4 different background tunes to the game; make them happy with the 2 they get!
  25. I also use the OGG / MP4 combo as described by b10b on SoundJS with no issues. Encoding to AAC gives you better compression and better sound looping than using MP3s In terms of compression, I went for 64kbits stereo when targetting devices with plenty of memory, such as desktops, and 48kbits mono for most mobile devices. I don't value high quality sound on mobiles; the speakers on devices are usually poor, lots of people turn off sound when playing games on their phone, and most importantly, it's hard enough just getting sound working on mobiles in the first place!