• Content Count

  • Joined

  • Last visited

About themoonrat

  • Rank
    Advanced Member
  • Birthday 11/25/1982

Contact Methods

  • Website URL
  • Twitter

Profile Information

  • Gender
  • Location

Recent Profile Visitors

2,274 profile views
  1. themoonrat

    Question about resolution

    Also for 2. I wouldn't just link devicePixelRatio to the resolution part of PIXI. Otherwise you get mobile devices trying to render at 4k or over... which is just silly. By all means, adjust resolution based on device, but I'd pick a few resolutions, and select which one to use based on inspecting the device To change resolution of the renderer dynamically, you can use code like this const oldResolution = renderer.resolution; renderer.plugins.interaction.resolution = newResolution; if ( ) ) { renderer.resolution = renderer.rootRenderTarget.resolution = newResolution; } else { renderer.resolution = renderer.rootResolution = newResolution; } renderer.resize( renderer.width / oldResolution, renderer.height / oldResolution );
  2. themoonrat

    PIXI element typof

    If you wanted to go down that route, you can also do const prettyImage = new PIXI.Sprite(); const constructorName =; // will return 'Sprite'
  3. themoonrat

    Pixi-Sound vs Howler

    Both are great options! The main advantage of Howler is it's wider use. I use it, and love it, and feel more secure in using it because so many devs do too. The main downside is fitting it into the Pixi loading process. Even if you download audio as a blob, you still need to account in your preloading process for passing it to Howler for it to be decoded. The main advantage for Pixi Sound is that it covers this integration for you. In production code, it's easier to get up and running. And the syntax and use is all very familiar because it was made by a Pixi Dev. But that's not saying Pixi Sound is not reliable, it is! And it's not saying Howler is hard to use... it really isn't. Both are great options with active and receptive maintainers.
  4. themoonrat

    Audio Format Compatibility

    1. I would use m4a as primary choice, and off as fallback. m4a has the same compatibility range on browsers as mp3, but sounds better for the same file size, and loops better for background music. ogg is the fallback for the uncommon occasion m4a isn't supported. 2. ALL mobile browsers now require a user touch to enable unlocking audio. If you have a 'touch here to continue' kinda screen after loading, that'll get you the touch you need
  5. themoonrat

    PIXI js game black screen delay

    They are popping in because the assets are loading in the background, and show when they've finished loading. To stop that effect, you should use the preloader within pixi to preload all assets (showing a loading screen perhaps) before starting the game
  6. themoonrat

    Audio on Mobile is made to integrate into the loader that pixi uses, and is successfully used in a number of projects. You really want to use another lib to handle sound to get web audio support at the very least. Otherwise you're setting yourself up for more issues in the future.
  7. themoonrat

    Audio on Mobile

    I'd really recommend using Howler or pixi sound for audio, it'll handle this stuff for you
  8. themoonrat

    Audio on Mobile

    Mobile requires a user interaction to 'unlock' audio and allow it to play
  9. The scale mode of the texture needs to be set to nearest. You can either do that on a texture by texture basis via the scaleMode property, or change the default via
  10. themoonrat

    set and cancel fullsreen mode in mobile.

    For mobile devices, some of those events above are not classes as valid events to unlock audio or unlock full screen API. touchstart or touchend is usually what you need
  11. themoonrat


    It's all about what the browser supports
  12. call .update() on the texture (the texture that is created with the canvas as the source) ?
  13. themoonrat

    Question about Pixi Interaction Manager

    Less telepathic, more your friendly neighbourhood @ping
  14. themoonrat

    Question about Pixi Interaction Manager

    So, what I do for my button class is something like this this.on( 'pointerdown', this._onPointerDown, this ); PIXI.renderer.plugins.interaction.on( 'pointerup', this._onPointerUp, this ); So, the down part looks for just the button being pressed down. But the up bit looks at the interaction manager global 'up' event. This way, if someone presses down on a button, then moves the mouse away from the button and releases, the 'up' still gets fired for this button. A quick overview of the pointdown and pointerup functions _onPointerDown( event ) { if ( !this._isDown && ) { this._isDown = true; // do down stuff } } _onPointerUp( event ) { if ( this._isDown && ) { this._isDown = false; // do up stuff } } So first thing we do is track ourselves if that button itself is down or up... that way on a global up, if the button is not down, nothing happens The other thing is we check against 'isPrimary', so we're looking at the primary mouse button, or the first touch event. You don't have to have that, and it stops a 2nd touch effecting a button press... but restricting it can make your life easier!
  15. themoonrat

    PIXI.TextStyle gradient stroke and pattern fillStyle

    When I saw the title I thought I'd done a pr for it at some stage! It wasn't accepted into pixi official because there were worries about the text api becoming a bit crazy. The hope in the future is that you could pass perhaps a PIXI.Gradient into the fill properties, and thus no need for separate stop point and gradient type settings every time it's an option. But I use the contents of that PR in my games on my own pixi fork